feat: add feed channel into search command panel

This commit is contained in:
moonrailgun 2024-07-28 00:05:52 +08:00
parent b2dccec283
commit 275f30f048
2 changed files with 29 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import {
CommandSeparator, CommandSeparator,
} from '@/components/ui/command'; } from '@/components/ui/command';
import { import {
LuActivitySquare,
LuAreaChart, LuAreaChart,
LuBellDot, LuBellDot,
LuFilePieChart, LuFilePieChart,
@ -143,6 +144,14 @@ export const CommandPanel: React.FC<CommandPanelProps> = React.memo((props) => {
<RiSurveyLine className="mr-2 h-4 w-4" /> <RiSurveyLine className="mr-2 h-4 w-4" />
{t('Survey')} {t('Survey')}
</CommandItem> </CommandItem>
<CommandItem
onSelect={handleJump({
to: '/feed',
})}
>
<LuActivitySquare className="mr-2 h-4 w-4" />
{t('Feed')}
</CommandItem>
</CommandGroup> </CommandGroup>
<CommandSeparator /> <CommandSeparator />
<CommandGroup heading={t('Settings')}> <CommandGroup heading={t('Settings')}>
@ -195,6 +204,9 @@ export const CommandPanelSearchGroup: React.FC<CommandPanelSearchGroupProps> =
const { data: surveys = [] } = trpc.survey.all.useQuery({ const { data: surveys = [] } = trpc.survey.all.useQuery({
workspaceId, workspaceId,
}); });
const { data: feedChannels = [] } = trpc.feed.channels.useQuery({
workspaceId,
});
if (!search) { if (!search) {
return null; return null;
@ -282,6 +294,22 @@ export const CommandPanelSearchGroup: React.FC<CommandPanelSearchGroupProps> =
{s.name} {s.name}
</CommandItem> </CommandItem>
))} ))}
{feedChannels.map((channel) => (
<CommandItem
key={channel.id}
value={channel.id}
keywords={[channel.name, channel.id]}
onSelect={handleJump({
to: '/feed/$channelId',
params: {
channelId: channel.id,
},
})}
>
<LuActivitySquare className="mr-2 h-4 w-4" />
{channel.name}
</CommandItem>
))}
</CommandGroup> </CommandGroup>
); );
}); });

View File

@ -201,7 +201,7 @@ export const UserConfig: React.FC<UserConfigProps> = React.memo((props) => {
</DropdownMenuPortal> </DropdownMenuPortal>
</DropdownMenuSub> </DropdownMenuSub>
<DropdownMenuLabel className="text-muted"> <DropdownMenuLabel className="text-muted-foreground dark:text-muted">
v{version} v{version}
</DropdownMenuLabel> </DropdownMenuLabel>
</DropdownMenuContent> </DropdownMenuContent>