diff --git a/Iceshrimp.Frontend/Components/Compose.razor b/Iceshrimp.Frontend/Components/Compose.razor
index 3350494c..ed8a81bf 100644
--- a/Iceshrimp.Frontend/Components/Compose.razor
+++ b/Iceshrimp.Frontend/Components/Compose.razor
@@ -70,6 +70,12 @@
aria-label="emoji">
+ @if (NoteDraft.RenoteId == null && AttachedQuote == null)
+ {
+
+ }
+ @if (AttachedQuote != null)
+ {
+
+ }
@if (UploadingFiles != 0)
{
- @(UploadingFiles == 1 ? Loc["Uploading file"] : Loc["Uploading {0} files", UploadingFiles])
+
+ @(UploadingFiles == 1 ? Loc["Uploading file"] : Loc["Uploading {0} files", UploadingFiles])
+
}
@if (Attachments.Count != 0)
{
@@ -126,6 +143,7 @@
private int NoteLength { get; set; }
private bool SendLock { get; set; } = false;
private int UploadingFiles { get; set; }
+ private string? AttachedQuote { get; set; }
private NoteCreateRequest NoteDraft { get; set; } = new()
{
@@ -277,6 +295,7 @@
NoteDraft = new NoteCreateRequest { Text = "", Visibility = settings.DefaultNoteVisibility, Cw = null };
TextPlaceholder = AvailablePlaceholders["default"];
SendButton.State = StateButton.StateEnum.Initial;
+ AttachedQuote = null;
}
private async Task CloseDialog()
@@ -294,6 +313,7 @@
NoteDraft.MediaIds = Attachments.Select(x => x.Id).ToList();
}
+ NoteDraft.RenoteId ??= AttachedQuote;
try
{
await ApiService.Notes.CreateNoteAsync(NoteDraft);
@@ -357,6 +377,33 @@
GlobalComponentSvc.EmojiPicker?.Open(EmojiButton, new EventCallback(this, AddEmoji));
}
+ private async Task AddQuote() =>
+ await GlobalComponentSvc.PromptDialog?.Prompt(new EventCallback(this, AddQuoteCallback), Loc["Add quote"], Loc["Link to note"], "")!;
+
+ private async Task AddQuoteCallback(string? url)
+ {
+ if (url == null) return;
+
+ try
+ {
+ var res = await ApiService.Search.LookupAsync(url);
+ if (res != null)
+ {
+ if (!res.TargetUrl.StartsWith("/notes/"))
+ {
+ await GlobalComponentSvc.NoticeDialog?.Display(Loc["You cannot quote a user profile"], NoticeDialog.NoticeType.Error)!;
+ return;
+ }
+
+ AttachedQuote = res.TargetUrl[7..];
+ }
+ }
+ catch (ApiException e)
+ {
+ await GlobalComponentSvc.NoticeDialog?.Display(e.Response.Message ?? Loc["An unknown error occurred"], NoticeDialog.NoticeType.Error)!;
+ }
+ }
+
private async Task AddEmoji(EmojiResponse emoji)
{
var pos = await _module.InvokeAsync("getSelectionStart", Textarea);