Skip to content

Commit

Permalink
bug fix + event json copy
Browse files Browse the repository at this point in the history
  • Loading branch information
vivganes committed Nov 14, 2023
1 parent 7b94a25 commit a019b41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/app/component/event-card/event-card.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
<div class="card" *ngIf="loadingApproval && !canModerate">
<div class="card-block">
<p class="card-text"> <clr-spinner clrInline translate>
Loading moderator approvals...
</clr-spinner>
<span translate>
Loading moderator approvals...
</span></p>
</div>
</div>

<div class="hidden-card-message" *ngIf="!loadingApproval && !canModerate && !mutedAuthor && (showUnapprovedPosts?false:approvalEvents?.size===0)">
<span class="hidden-card-span">{{'UNAPPROVED NOTE'|translate}}. <button class="btn btn-sm btn-inilne" (click)="showUnapprovedPosts = true" translate>Show anyways</button> <br/>
<span *ngIf="!hideCommunityHeader"><b translate>Community:</b> n/{{community?.name}} by {{community?.creatorProfile?.displayName ? community?.creatorProfile?.displayName : (community?.creatorProfile?.name ? community?.creatorProfile?.name : community?.creatorHexKey | abbreviateId)}}</span>
Expand Down Expand Up @@ -195,7 +184,7 @@
<div class="alert-icon-wrapper">
<cds-icon class="alert-icon" shape="info-circle"></cds-icon>
</div>
<span class="alert-text">Notes link copied!</span>
<span class="alert-text">Copied!</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -243,6 +232,7 @@
<div clrDropdownItem (click)="openInSnort()">Open in Snort</div>
<div clrDropdownItem (click)="copyNoteHexIdToClipboard()">Copy Hex ID</div>
<div *ngIf="!community" clrDropdownItem (click)="copyNote1IdToClipboard()">Copy note1 ID</div>
<div clrDropdownItem (click)="copyEventJson()">Copy Event JSON</div>
</clr-dropdown-menu>
</clr-dropdown>
</div>
Expand Down
5 changes: 5 additions & 0 deletions src/app/component/event-card/event-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ export class EventCardComponent implements OnInit, OnDestroy{
return this.event?.content;
}

async copyEventJson(){
await this.clipboard.copy(JSON.stringify(await this.event?.toNostrEvent()!));
this.linkCopied = true;
}

replaceNpubMentionsWithComponents(content?:string): string|undefined{
let displayedContent = content;
if(displayedContent){
Expand Down

0 comments on commit a019b41

Please sign in to comment.