[ENG-701] Add explorer top bar options to tags (#918)

Add top bar options
This commit is contained in:
nikec 2023-06-06 16:26:54 +02:00 committed by GitHub
parent 007e089fcf
commit f3a35a9c13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,9 @@
import { z } from 'zod';
import { useLibraryQuery } from '@sd/client';
import { useZodRouteParams } from '~/hooks';
import { useExplorerTopBarOptions, useZodRouteParams } from '~/hooks';
import Explorer from '../Explorer';
import { TopBarPortal } from '../TopBar/Portal';
import TopBarOptions from '../TopBar/TopBarOptions';
const PARAMS = z.object({
id: z.coerce.number()
@ -10,6 +12,8 @@ const PARAMS = z.object({
export const Component = () => {
const { id } = useZodRouteParams(PARAMS);
const topBarOptions = useExplorerTopBarOptions();
const explorerData = useLibraryQuery([
'search.objects',
{
@ -20,8 +24,19 @@ export const Component = () => {
]);
return (
<div className="w-full">
<>
<TopBarPortal
right={
<TopBarOptions
options={[
topBarOptions.explorerViewOptions,
topBarOptions.explorerToolOptions,
topBarOptions.explorerControlOptions
]}
/>
}
/>
{explorerData.data && <Explorer items={explorerData.data.items} />}
</div>
</>
);
};