File tree Expand file tree Collapse file tree 6 files changed +73
-0
lines changed
Expand file tree Collapse file tree 6 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 11@using Apollo .Components .Infrastructure .MessageBus
22@using Apollo .Components .NuGet .Commands
3+ @using Apollo .Components .Tools .Commands
34@using Apollo .Components .Theme
45@using MouseEvent = MudBlazor .MouseEvent
56
67<MudMenu Label =" Tools" Dense ActivationEvent =" MouseEvent.MouseOver" >
78 <MudMenuItem Icon =" @ApolloIcons.NuGet" OnClick =" @(async () => await Bus.PublishAsync(new OpenNuGetDialog()))" >
89 NuGet Packages
910 </MudMenuItem >
11+ <MudMenu StartIcon =" @ApolloIcons.Guid" Label =" Generate GUID" >
12+ <MudMenuItem Icon =" @ApolloIcons.Guid" OnClick =" @(async () => await Bus.PublishAsync(new GenerateGuid()))" >
13+ GUID
14+ </MudMenuItem >
15+ <MudMenuItem Icon =" @ApolloIcons.GuidV7" OnClick =" @(async () => await Bus.PublishAsync(new GenerateGuidV7()))" >
16+ GUID v7 (Timestamp)
17+ </MudMenuItem >
18+ </MudMenu >
1019</MudMenu >
1120
1221@code {
Original file line number Diff line number Diff line change @@ -117,4 +117,8 @@ public static class ApolloIcons
117117 public const string Search = Icons . Material . TwoTone . Search ;
118118
119119 public const string Verified = Icons . Material . TwoTone . Verified ;
120+
121+ public const string Guid = Icons . Material . TwoTone . Fingerprint ;
122+
123+ public const string GuidV7 = Icons . Material . TwoTone . Schedule ;
120124}
Original file line number Diff line number Diff line change 1+ namespace Apollo . Components . Tools . Commands ;
2+
3+ public record GenerateGuid ( ) ;
4+
Original file line number Diff line number Diff line change 1+ namespace Apollo . Components . Tools . Commands ;
2+
3+ public record GenerateGuidV7 ( ) ;
4+
Original file line number Diff line number Diff line change 1+ using Apollo . Components . Infrastructure . MessageBus ;
2+ using Apollo . Components . Shared . ApolloNotificationBar ;
3+ using Apollo . Components . Tools . Commands ;
4+ using MudBlazor ;
5+
6+ namespace Apollo . Components . Tools . Consumers ;
7+
8+ public class GuidGenerator : IConsumer < GenerateGuid >
9+ {
10+ private readonly IJsApiService _jsApiService ;
11+ private readonly ISnackbar _snackbar ;
12+
13+ public GuidGenerator ( IJsApiService jsApiService , ISnackbar snackbar )
14+ {
15+ _jsApiService = jsApiService ;
16+ _snackbar = snackbar ;
17+ }
18+
19+ public async Task Consume ( GenerateGuid message )
20+ {
21+ var guid = Guid . NewGuid ( ) . ToString ( ) ;
22+ await _jsApiService . CopyToClipboardAsync ( guid ) ;
23+ _snackbar . AddApolloNotification ( $ "Copied { guid } to clipboard!", Severity . Success ) ;
24+ }
25+ }
26+
Original file line number Diff line number Diff line change 1+ using Apollo . Components . Infrastructure . MessageBus ;
2+ using Apollo . Components . Shared . ApolloNotificationBar ;
3+ using Apollo . Components . Tools . Commands ;
4+ using MudBlazor ;
5+
6+ namespace Apollo . Components . Tools . Consumers ;
7+
8+ public class GuidV7Generator : IConsumer < GenerateGuidV7 >
9+ {
10+ private readonly IJsApiService _jsApiService ;
11+ private readonly ISnackbar _snackbar ;
12+
13+ public GuidV7Generator ( IJsApiService jsApiService , ISnackbar snackbar )
14+ {
15+ _jsApiService = jsApiService ;
16+ _snackbar = snackbar ;
17+ }
18+
19+ public async Task Consume ( GenerateGuidV7 message )
20+ {
21+ var guid = Guid . CreateVersion7 ( ) . ToString ( ) ;
22+ await _jsApiService . CopyToClipboardAsync ( guid ) ;
23+ _snackbar . AddApolloNotification ( $ "Copied { guid } to clipboard!", Severity . Success ) ;
24+ }
25+ }
26+
You can’t perform that action at this time.
0 commit comments