-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4df9a5f
commit 04e93bf
Showing
5 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { useState } from 'react'; | ||
import { | ||
Popover, | ||
PopoverContent, | ||
PopoverTrigger, | ||
} from '@/components/ui/popover'; | ||
|
||
interface MetricsBlockProps { | ||
title: string; | ||
list: string[]; | ||
} | ||
export const MetricsBlock: React.FC<MetricsBlockProps> = React.memo((props) => { | ||
const [title, setTitle] = useState(props.title); | ||
|
||
return ( | ||
<div className="w-full"> | ||
<Popover> | ||
<PopoverTrigger asChild> | ||
<div className="border-muted hover:bg-muted w-full cursor-pointer rounded-lg border p-1"> | ||
{title} | ||
</div> | ||
</PopoverTrigger> | ||
<PopoverContent> | ||
<div> | ||
{props.list.map((item, i) => { | ||
return <div key={i}>{item}</div>; | ||
})} | ||
</div> | ||
</PopoverContent> | ||
</Popover> | ||
</div> | ||
); | ||
}); | ||
MetricsBlock.displayName = 'MetricsBlock'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { MetricsBlock } from './MetricsBlock'; | ||
|
||
interface MetricsSectionProps { | ||
title: string; | ||
} | ||
export const MetricsSection: React.FC<MetricsSectionProps> = React.memo( | ||
(props) => { | ||
return ( | ||
<div> | ||
<div>{props.title}</div> | ||
|
||
<MetricsBlock title={props.title} list={[]} /> | ||
</div> | ||
); | ||
} | ||
); | ||
MetricsSection.displayName = 'MetricsSection'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { createFileRoute, redirect } from '@tanstack/react-router'; | ||
import { useTranslation } from '@i18next-toolkit/react'; | ||
import { CommonWrapper } from '@/components/CommonWrapper'; | ||
import { routeAuthBeforeLoad } from '@/utils/route'; | ||
import { CommonHeader } from '@/components/CommonHeader'; | ||
import { ScrollArea } from '@/components/ui/scroll-area'; | ||
import { Layout } from '@/components/layout'; | ||
import { | ||
ResizableHandle, | ||
ResizablePanel, | ||
ResizablePanelGroup, | ||
} from '@/components/ui/resizable'; | ||
import { cn } from '@/utils/style'; | ||
import { MetricsSection } from '@/components/insights/MetricsSection'; | ||
import { isDev } from '@/utils/env'; | ||
|
||
export const Route = createFileRoute('/insights')({ | ||
beforeLoad: (opts) => { | ||
if (!isDev) { | ||
throw redirect({ | ||
to: '/', | ||
}); | ||
} | ||
|
||
return routeAuthBeforeLoad?.(opts); | ||
}, | ||
component: PageComponent, | ||
}); | ||
|
||
function PageComponent() { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Layout> | ||
<CommonWrapper header={<CommonHeader title={t('Insights')} />}> | ||
<ResizablePanelGroup | ||
className="flex-1 items-stretch" | ||
direction="horizontal" | ||
> | ||
<ResizablePanel collapsedSize={1} className={cn('flex flex-col')}> | ||
<ScrollArea className="h-full overflow-hidden p-4"> | ||
<div>foooooooooo</div> | ||
</ScrollArea> | ||
</ResizablePanel> | ||
|
||
<ResizableHandle withHandle /> | ||
|
||
<ResizablePanel defaultSize={30}> | ||
<ScrollArea className="h-full overflow-hidden p-4"> | ||
<div className="flex flex-col space-y-8"> | ||
<MetricsSection title="Metrics" /> | ||
<MetricsSection title="Filters" /> | ||
<MetricsSection title="Breakdown" /> | ||
</div> | ||
</ScrollArea> | ||
</ResizablePanel> | ||
</ResizablePanelGroup> | ||
</CommonWrapper> | ||
</Layout> | ||
); | ||
} |