unstable sharing refactor
This commit is contained in:
@@ -2,14 +2,16 @@ import { store } from "@/store";
|
||||
import { render } from "solid-js/web";
|
||||
import tippy, { type Instance as TippyInstance } from "tippy.js";
|
||||
import { MentionList } from "@/components/MentionList";
|
||||
import { buildShareTag } from "@/lib/tags";
|
||||
|
||||
export const userSuggestion = {
|
||||
items: ({ query }: { query: string }) => {
|
||||
return store.tagDefinitions
|
||||
.filter(tag => tag.isUser && tag.name.toLowerCase().substring(1).startsWith(query.toLowerCase()))
|
||||
.map(tag => ({
|
||||
id: tag.name, // Use the tag name as ID for sharing logic
|
||||
label: tag.name.substring(1),
|
||||
return store.contexts
|
||||
.filter(context => context.kind === "user" && !context.deletedAt)
|
||||
.filter(context => context.displayName.toLowerCase().startsWith(query.toLowerCase()))
|
||||
.map(context => ({
|
||||
id: buildShareTag(context.displayName),
|
||||
label: context.displayName,
|
||||
type: 'user' as const
|
||||
}));
|
||||
},
|
||||
@@ -90,10 +92,10 @@ export const noteSuggestion = {
|
||||
items: ({ query }: { query: string }) => {
|
||||
return store.notes
|
||||
.filter(note => !(note.tags || []).some(t => t.startsWith("child-of-")))
|
||||
.filter(note => note.title.toLowerCase().includes(query.toLowerCase()))
|
||||
.filter(note => (note.key || note.title).toLowerCase().includes(query.toLowerCase()))
|
||||
.map(note => ({
|
||||
id: note.id,
|
||||
label: note.title,
|
||||
label: note.key || note.title,
|
||||
sublabel: note.content?.substring(0, 50).replace(/<[^>]*>?/gm, ''),
|
||||
type: 'note' as const
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user