feat: add survey command panel
This commit is contained in:
parent
f7f191a53d
commit
c9bf016fbf
@ -16,6 +16,7 @@ import {
|
|||||||
LuMonitorDot,
|
LuMonitorDot,
|
||||||
LuSearch,
|
LuSearch,
|
||||||
LuServer,
|
LuServer,
|
||||||
|
LuTableProperties,
|
||||||
LuUserCircle2,
|
LuUserCircle2,
|
||||||
LuWifi,
|
LuWifi,
|
||||||
} from 'react-icons/lu';
|
} from 'react-icons/lu';
|
||||||
@ -133,6 +134,14 @@ export const CommandPanel: React.FC<CommandPanelProps> = React.memo((props) => {
|
|||||||
<LuFilePieChart className="mr-2 h-4 w-4" />
|
<LuFilePieChart className="mr-2 h-4 w-4" />
|
||||||
{t('Pages')}
|
{t('Pages')}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
|
<CommandItem
|
||||||
|
onSelect={handleJump({
|
||||||
|
to: '/survey',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<LuTableProperties className="mr-2 h-4 w-4" />
|
||||||
|
{t('Survey')}
|
||||||
|
</CommandItem>
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
<CommandSeparator />
|
<CommandSeparator />
|
||||||
<CommandGroup heading={t('Settings')}>
|
<CommandGroup heading={t('Settings')}>
|
||||||
@ -182,6 +191,9 @@ export const CommandPanelSearchGroup: React.FC<CommandPanelSearchGroupProps> =
|
|||||||
const { data: pages = [] } = trpc.monitor.getAllPages.useQuery({
|
const { data: pages = [] } = trpc.monitor.getAllPages.useQuery({
|
||||||
workspaceId,
|
workspaceId,
|
||||||
});
|
});
|
||||||
|
const { data: surveys = [] } = trpc.survey.all.useQuery({
|
||||||
|
workspaceId,
|
||||||
|
});
|
||||||
|
|
||||||
if (!search) {
|
if (!search) {
|
||||||
return null;
|
return null;
|
||||||
@ -253,6 +265,22 @@ export const CommandPanelSearchGroup: React.FC<CommandPanelSearchGroupProps> =
|
|||||||
{p.title}
|
{p.title}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
))}
|
))}
|
||||||
|
{surveys.map((s) => (
|
||||||
|
<CommandItem
|
||||||
|
key={s.id}
|
||||||
|
value={s.id}
|
||||||
|
keywords={[s.name, s.id]}
|
||||||
|
onSelect={handleJump({
|
||||||
|
to: '/survey/$surveyId',
|
||||||
|
params: {
|
||||||
|
surveyId: s.id,
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<LuTableProperties className="mr-2 h-4 w-4" />
|
||||||
|
{s.name}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user