Skip to content

Commit ec7ed1d

Browse files
committed
fix: AI assistant page
1 parent f6ef001 commit ec7ed1d

File tree

3 files changed

+55
-55
lines changed

3 files changed

+55
-55
lines changed

apps/dashboard/app/(main)/websites/[id]/assistant/components/ai-assistant-main.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,25 @@ export default function AIAssistantMain() {
5555
);
5656

5757
return (
58-
<div className="fixed inset-0 flex flex-col bg-gradient-to-br from-background to-muted/20 pt-16 md:pl-72">
59-
<div className="flex flex-1 overflow-hidden p-3 sm:p-4 lg:p-6">
60-
<div className="flex flex-1 flex-col gap-3 overflow-hidden lg:flex-row">
61-
<div
62-
className={cn(
63-
'flex flex-col overflow-hidden',
64-
shouldShowVisualization ? 'lg:flex-[0.6]' : 'flex-1'
65-
)}
66-
>
67-
<Suspense fallback={<ChatSkeleton />}>
68-
<ChatSection />
69-
</Suspense>
70-
</div>
71-
{shouldShowVisualization && (
72-
<div className="flex flex-[0.4] flex-col overflow-hidden">
73-
<Suspense fallback={<VisualizationSkeleton />}>
74-
<VisualizationSection />
75-
</Suspense>
76-
</div>
58+
<div className="flex h-full flex-col">
59+
<div className="flex flex-1 flex-col gap-3 overflow-hidden lg:flex-row">
60+
<div
61+
className={cn(
62+
'flex flex-col overflow-hidden',
63+
shouldShowVisualization ? 'lg:flex-[0.6]' : 'flex-1'
7764
)}
65+
>
66+
<Suspense fallback={<ChatSkeleton />}>
67+
<ChatSection />
68+
</Suspense>
7869
</div>
70+
{shouldShowVisualization && (
71+
<div className="flex flex-[0.4] flex-col overflow-hidden">
72+
<Suspense fallback={<VisualizationSkeleton />}>
73+
<VisualizationSection />
74+
</Suspense>
75+
</div>
76+
)}
7977
</div>
8078
</div>
8179
);

apps/dashboard/app/(main)/websites/[id]/assistant/page.tsx

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,34 @@ const AIAssistantMain = dynamic(
2222

2323
function AIAssistantLoadingSkeleton() {
2424
return (
25-
<div className="flex flex-1 gap-3 overflow-hidden p-3">
26-
<div className="flex flex-[2_2_0%] flex-col overflow-hidden rounded-lg border bg-background shadow-sm">
27-
<div className="flex-shrink-0 border-b p-3">
28-
<Skeleton className="mb-1 h-5 w-32" />
29-
<Skeleton className="h-3 w-48" />
30-
</div>
31-
<div className="flex-1 space-y-3 overflow-y-auto p-3">
32-
<div className="flex gap-2">
33-
<Skeleton className="h-8 w-8 flex-shrink-0 rounded-full" />
34-
<Skeleton className="h-16 w-3/4 rounded-lg" />
25+
<div className="flex h-full flex-col gap-3">
26+
<div className="flex flex-1 gap-3 overflow-hidden">
27+
<div className="flex flex-[2_2_0%] flex-col overflow-hidden rounded border bg-background shadow-sm">
28+
<div className="flex-shrink-0 border-b p-3">
29+
<Skeleton className="mb-1 h-5 w-32" />
30+
<Skeleton className="h-3 w-48" />
3531
</div>
36-
<div className="ml-auto flex flex-row-reverse gap-2">
37-
<Skeleton className="h-8 w-8 flex-shrink-0 rounded-full" />
38-
<Skeleton className="h-10 w-1/2 rounded-lg" />
32+
<div className="flex-1 space-y-3 overflow-y-auto p-3">
33+
<div className="flex gap-2">
34+
<Skeleton className="h-8 w-8 flex-shrink-0 rounded-full" />
35+
<Skeleton className="h-16 w-3/4 rounded" />
36+
</div>
37+
<div className="ml-auto flex flex-row-reverse gap-2">
38+
<Skeleton className="h-8 w-8 flex-shrink-0 rounded-full" />
39+
<Skeleton className="h-10 w-1/2 rounded" />
40+
</div>
41+
</div>
42+
<div className="flex-shrink-0 border-t p-3">
43+
<Skeleton className="h-9 w-full rounded" />
3944
</div>
4045
</div>
41-
<div className="flex-shrink-0 border-t p-3">
42-
<Skeleton className="h-9 w-full rounded-md" />
43-
</div>
44-
</div>
45-
<div className="flex flex-[3_3_0%] flex-col overflow-hidden rounded-lg border bg-background shadow-sm">
46-
<div className="flex-shrink-0 border-b p-3">
47-
<Skeleton className="mb-1 h-5 w-32" />
48-
</div>
49-
<div className="flex-1 p-3">
50-
<Skeleton className="h-full w-full rounded-lg" />
46+
<div className="flex flex-[3_3_0%] flex-col overflow-hidden rounded border bg-background shadow-sm">
47+
<div className="flex-shrink-0 border-b p-3">
48+
<Skeleton className="mb-1 h-5 w-32" />
49+
</div>
50+
<div className="flex-1 p-3">
51+
<Skeleton className="h-full w-full rounded" />
52+
</div>
5153
</div>
5254
</div>
5355
</div>
@@ -76,14 +78,12 @@ export default function AssistantPage() {
7678
}, [id, setWebsiteId, websiteData, setWebsiteData, setDateRange]);
7779

7880
return (
79-
<div className="fixed inset-0 flex flex-col bg-gradient-to-br from-background to-muted/20 pt-16 md:pl-72">
80-
<div className="mt-6 flex flex-1 overflow-hidden">
81-
{isLoading || !websiteData ? (
82-
<AIAssistantLoadingSkeleton />
83-
) : (
84-
<AIAssistantMain />
85-
)}
86-
</div>
81+
<div className="flex h-full flex-col bg-gradient-to-br from-background to-muted/20">
82+
{isLoading || !websiteData ? (
83+
<AIAssistantLoadingSkeleton />
84+
) : (
85+
<AIAssistantMain />
86+
)}
8787
</div>
8888
);
8989
}

apps/dashboard/app/(main)/websites/[id]/layout.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useQueryClient } from '@tanstack/react-query';
44
import { useAtom } from 'jotai';
5-
import { useParams } from 'next/navigation';
5+
import { useParams, usePathname } from 'next/navigation';
66
import { toast } from 'sonner';
77
import { useTrackingSetup } from '@/hooks/use-tracking-setup';
88
import {
@@ -18,13 +18,16 @@ interface WebsiteLayoutProps {
1818

1919
export default function WebsiteLayout({ children }: WebsiteLayoutProps) {
2020
const { id } = useParams();
21+
const pathname = usePathname();
2122
const queryClient = useQueryClient();
2223
const { isTrackingSetup } = useTrackingSetup(id as string);
2324
const [isRefreshing, setIsRefreshing] = useAtom(isAnalyticsRefreshingAtom);
2425
const [selectedFilters, setSelectedFilters] = useAtom(
2526
dynamicQueryFiltersAtom
2627
);
2728

29+
const isAssistantPage = pathname.includes('/assistant');
30+
2831
const handleRefresh = async () => {
2932
setIsRefreshing(true);
3033
try {
@@ -48,10 +51,10 @@ export default function WebsiteLayout({ children }: WebsiteLayoutProps) {
4851

4952
return (
5053
<div className="mx-auto max-w-[1600px] p-3 sm:p-4 lg:p-6">
51-
{isTrackingSetup && (
54+
{isTrackingSetup && !isAssistantPage && (
5255
<div className="space-y-4">
53-
<AnalyticsToolbar
54-
isRefreshing={isRefreshing}
56+
<AnalyticsToolbar
57+
isRefreshing={isRefreshing}
5558
onRefresh={handleRefresh}
5659
/>
5760
<FiltersSection
@@ -62,7 +65,6 @@ export default function WebsiteLayout({ children }: WebsiteLayoutProps) {
6265
)}
6366

6467
{children}
65-
6668
</div>
6769
);
6870
}

0 commit comments

Comments
 (0)