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

Adds a button to copy basic achievement details to clipboard. #1001

Merged
merged 1 commit into from
Aug 26, 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
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
@using Microsoft.AspNetCore.Components
@using SSW.Rewards.Admin.UI.Components.Dialogs.Confirmations
@using SSW.Rewards.Admin.UI.Models.Interfaces
@using SSW.Rewards.Enums
@using SSW.Rewards.Shared.DTOs.Achievements
@using SSW.Rewards.Shared.DTOs.Leaderboard
@using SSW.Rewards.ApiClient.Services
@using Icons = MudBlazor.Icons

@inject ILeaderboardService leaderboardService
@inject IDialogService DialogService
@inject IJSRuntime JsRuntime

<MudDialog>
<TitleContent>
<div class="d-flex justify-center">
<AdminQRCode Height="200" QRCodeString="@dto.Code"/>
</div>
<div class="d-flex justify-center">
<MudButton StartIcon="@Icons.TwoTone.CopyAll" OnClick="CopyToClipboard">Copy details</MudButton>
</div>
</TitleContent>
<DialogContent>
<MudTextField @bind-Value="@dto.Code" Label="Code" ReadOnly="true" Disabled="true"/>
Expand Down Expand Up @@ -116,4 +120,10 @@
AchievementId = dto.Id
}));
}

async Task CopyToClipboard()
{
var achievementDetails = $"Achievement: {dto.Name} - {dto.Value} points";
await JsRuntime.InvokeVoidAsync("navigator.clipboard.writeText", achievementDetails);
}
}
Loading