aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/user_mention_pill.php
diff options
context:
space:
mode:
authorwinter2025-01-26 21:53:26 +0000
committerwinter2025-01-26 21:53:26 +0000
commit6b58bf53e312a67119289b894c5b482d057e5665 (patch)
treefef168089a75d73353af1a79456e711c72385ca3 /templates/user_mention_pill.php
parent7d3f35b1895dd3fe08af0f5fe403ff339acd2456 (diff)
make mentions work properly + ui for them
Diffstat (limited to 'templates/user_mention_pill.php')
-rw-r--r--templates/user_mention_pill.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/templates/user_mention_pill.php b/templates/user_mention_pill.php
new file mode 100644
index 0000000..3b9a018
--- /dev/null
+++ b/templates/user_mention_pill.php
@@ -0,0 +1,31 @@
+<?php
+$type ??= 'add';
+?>
+
+<?php if ($type == 'add'): ?>
+
+ <button class="inlinePill" type="button" hx-get="/fragment/note/mentionPill" hx-disabled-elt="this" hx-swap="outerHTML">
+ <span class="pillIcon material-symbols add"></span>
+ <span class="pillText"><?= __('writeNote.mentions.add.action') ?></span>
+ </button>
+
+<?php elseif ($type == 'edit'): ?>
+
+ <form class="inlinePill nopanel <?= ($invalid ?? false) ? 'invalid' : '' ?>" hx-get="/fragment/note/mentionPill"
+ hx-disabled-elt="this" hx-swap="outerHTML">
+ <span class="pillIcon material-symbols alternate-email"></span>
+ <input type="text" name="handle" class="pillInput" value="<?= $value ?? '' ?>"
+ placeholder="<?= __('writeNote.mentions.placeholder') ?>" required autofocus>
+ <button type="submit" class="material-symbols add"></button>
+ </form>
+
+<?php elseif ($type == 'user'): ?>
+
+ <button class="inlinePill" type="button" _="on click remove me">
+ <img class="pillIcon" src="<?= $actor->avatar ?? '/static/default-avatar.png' ?>">
+ <span class="pillText"><?= $actor->displayName ?></span>
+ <input type="hidden" name="mentions[]" value="<?= $actor->id ?>">
+ <span class="pillIcon material-symbols close-small"></span>
+ </button>
+
+<?php endif; ?> \ No newline at end of file