impr: add community/normal search to command palette

This commit is contained in:
Xylight committed 2025-10-18 12:46:22 -07:00
1 parent 05140f4fc7
commit 7e990381a7
5 files changed
+71 -52

No files matched your search

+25 -2
View File
@@ -26,6 +26,7 @@ import {
Home,
Identification,
Inbox,
MagnifyingGlass,
MapPin,
Moon,
Newspaper,
@@ -68,7 +69,7 @@ export function getGroups(
profiles: ProfileInfo[],
td: ThemeData,
contextual?: Action[],
) {
): Group[] {
return [
{
name: t.get('nav.commands.recents'),
@@ -400,7 +401,7 @@ export function getGroups(
name: t.get('profile.subscribed'),
actions:
profile.user?.follows.map((f) => ({
icon: f.community.icon,
icon: f.community.icon ?? Newspaper,
name: f.community.title,
href: `/c/${fullCommunityName(
f.community.name,
@@ -411,3 +412,25 @@ export function getGroups(
},
]
}
// this should really be rewritten, but a temporary change
// to make sure we don't recalculate ALL of that per keypress
export function dynamicActions(query: string): Group {
const actions = [
{
name: t.get('nav.commands.search', { default: query }),
icon: MagnifyingGlass,
href: `/search?q=${query}`,
},
{
name: t.get('nav.commands.communities', { default: query }),
icon: Newspaper,
href: `/explore/communities?q=${query}`,
},
]
return {
name: t.get('routes.search.other'),
actions: actions,
}
}