From 480e7bd78e28e391d46a1d70be13d8d0a2ab8522 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Mon, 24 Nov 2025 18:01:31 -0500 Subject: [PATCH] simplify mention logic --- components/Mention.tsx | 62 +++++++++++------------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/components/Mention.tsx b/components/Mention.tsx index 4e09acd5..883a7ed3 100644 --- a/components/Mention.tsx +++ b/components/Mention.tsx @@ -135,42 +135,6 @@ export function MentionAutocomplete(props: { const headerStyle = "text-xs text-tertiary font-bold pt-1 px-2"; - const getHeader = (type: Mention["type"]) => { - switch (type) { - case "did": - return "People"; - case "publication": - return "Publications"; - } - }; - - const getKey = (mention: Mention) => { - switch (mention.type) { - case "did": - return mention.did; - case "publication": - return mention.uri; - } - }; - - const getResultText = (mention: Mention) => { - switch (mention.type) { - case "did": - return mention.displayName || `@${mention.handle}`; - case "publication": - return mention.name; - } - }; - - const getSubtext = (mention: Mention) => { - switch (mention.type) { - case "did": - return mention.displayName ? `@${mention.handle}` : undefined; - case "publication": - return undefined; - } - }; - const sortedSuggestions = [...suggestions].sort((a, b) => { const order: Mention["type"][] = ["did", "publication"]; return order.indexOf(a.type) - order.indexOf(b.type); @@ -202,22 +166,28 @@ export function MentionAutocomplete(props: {