a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[frontend/components] Add mention button to compose

authored by

pancakes and committed by
Laura Hausmann
00053544 2a2754d8

+17
+17
Iceshrimp.Frontend/Components/Compose.razor
··· 70 70 <button class="btn" title="@Loc["Content warning"]" @onclick="ToggleCw" aria-label="content warning"> 71 71 <Icon Name="Icons.EyeSlash" Size="1.3rem"></Icon> 72 72 </button> 73 + <button class="btn" title="@Loc["Mention"]" @onclick="AddMention" aria-label="add mention"> 74 + <Icon Name="Icons.At" Size="1.3rem"></Icon> 75 + </button> 73 76 <button @ref="EmojiButton" class="btn" title="@Loc["Emoji"]" @onclick="ToggleEmojiPicker" 74 77 aria-label="emoji"> 75 78 <Icon Name="Icons.Smiley" Size="1.3rem"></Icon> ··· 590 593 private async Task ToggleEmojiPicker() 591 594 { 592 595 await GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback<EmojiResponse>(this, AddEmoji))!; 596 + } 597 + 598 + private async Task AddMention() => 599 + await GlobalComponentSvc.UserDialog?.Select(new EventCallback<UserResponse?>(this, AddMentionCallback), Loc["Select user"])!; 600 + 601 + private async Task AddMentionCallback(UserResponse? user) 602 + { 603 + if (user == null) return; 604 + 605 + var pos = await _module.InvokeAsync<int>("getSelectionStart", Textarea); 606 + var text = NoteDraft.Text; 607 + var mentionString = user.Host != null ? $"@{user.Username}@{user.Host} " : $"@{user.Username} "; 608 + NoteDraft.Text = text.Insert(pos, mentionString); 609 + StateHasChanged(); 593 610 } 594 611 595 612 private async Task AddQuote() =>