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

View File

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