Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a link to profile editor for founders #232

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/Angor/Client/Pages/View.razor
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,15 @@ else
<label for="NostrHexPublicKey" class="form-label">Project NOSTR public key (hex)</label>
<div class="input-group">
<InputText id="NostrHexPublicKey" @bind-Value="project.ProjectInfo.NostrPubKey" class="form-control" placeholder="@project.ProjectInfo.NostrPubKey" readonly/>
<button @onclick="OpenInBrowseAsync" class="btn btn-border">
@* <button @onclick="OpenInBrowseAsync" class="btn btn-border">
<Icon IconName="link"></Icon>
</button>
</button> *@
</div>


@if (founder)
{
<button @onclick="OpenInBrowseProfileAsync" class="btn btn-border mt-4 mr-1">Edit project profile</button>
<button @onclick="ShowNsecAsync" class="btn btn-border mt-4">Show private key</button>

@if (isGeneratingNsec)
Expand Down Expand Up @@ -733,13 +734,29 @@ else
});
}

private async void OpenInBrowseProfileAsync()
{
var npub = NostrHelper.ConvertHexToNpub(project.ProjectInfo.NostrPubKey);

if (!string.IsNullOrEmpty(npub))
{
var url = $"https://profile.angor.io/profile/{npub}";

await Js.InvokeVoidAsync("window.open", url, "_blank");
}
else
{
notificationComponent.ShowNotificationMessage("Public key is not available.", 3);
}
}

private async void OpenInBrowseAsync()
{
var pubkey = project.ProjectInfo.NostrPubKey;

if (!string.IsNullOrEmpty(pubkey))
{
var url = $"https://hub.angor.io/profile/{pubkey}";
var url = $"https://hub.angor.io/project/{pubkey}";

await Js.InvokeVoidAsync("window.open", url, "_blank");
}
Expand Down
Loading