Skip to content

Commit dd25135

Browse files
authored
Merge branch 'dev' into 184-add-image-flow-in-dataset-creation
2 parents ecd1913 + a31fde2 commit dd25135

File tree

14 files changed

+1103
-33
lines changed

14 files changed

+1103
-33
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/charts/components/ChartsVisualize.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ const ChartsVisualize: React.FC<VisualizationProps> = ({
221221
name: '',
222222
description: '',
223223
chartType: 'BAR_VERTICAL',
224-
resource: data?.datasetResources[0].id,
224+
resource: data?.datasetResources[0]?.id,
225225
xAxisColumn: '',
226226
xAxisLabel: '',
227227
yAxisColumn: '',
@@ -239,7 +239,7 @@ const ChartsVisualize: React.FC<VisualizationProps> = ({
239239

240240
useEffect(() => {
241241
if (data) {
242-
if (chartData.resource) {
242+
if (chartData.resource) {
243243
const resource = data?.datasetResources.find(
244244
(resource: any) => resource.id === chartData.resource
245245
);
@@ -325,7 +325,7 @@ const ChartsVisualize: React.FC<VisualizationProps> = ({
325325
showLegend: updatedData.showLegend,
326326
xAxisLabel: updatedData.xAxisLabel,
327327
yAxisLabel: updatedData.yAxisLabel,
328-
resource: updatedData.resource || data?.datasetResources[0].id,
328+
resource: updatedData.resource || data?.datasetResources[0]?.id,
329329
xAxisColumn: updatedData.xAxisColumn,
330330
yAxisColumn: updatedData.yAxisColumn,
331331
regionColumn: updatedData.regionColumn,
@@ -472,7 +472,7 @@ const ChartsVisualize: React.FC<VisualizationProps> = ({
472472
value: resource.id,
473473
}))}
474474
value={chartData.resource}
475-
defaultValue={data?.datasetResources[0].id}
475+
defaultValue={data?.datasetResources[0]?.id}
476476
label="Select Resources"
477477
onBlur={() => handleSave(chartData)}
478478
onChange={(e) => handleResourceChange(e)}

app/[locale]/dashboard/[entityType]/[entitySlug]/layout.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22

33
import React from 'react';
4-
import { useParams } from 'next/navigation';
4+
import { notFound, useParams } from 'next/navigation';
55
import { SidebarNavItem } from '@/types';
66

77
import { cn } from '@/lib/utils';
@@ -16,9 +16,15 @@ interface DashboardLayoutProps {
1616

1717
export default function OrgDashboardLayout({ children }: DashboardLayoutProps) {
1818
const [isOpened, setIsOpened] = React.useState(false);
19-
2019
const params = useParams<{ entityType: string; entitySlug: string }>();
2120

21+
if (
22+
process.env.NEXT_PUBLIC_DATASPACE_FEATURE_ENABLED !== 'true' &&
23+
params.entityType === 'dataspace'
24+
) {
25+
return notFound();
26+
}
27+
2228
const orgSidebarNav: Array<SidebarNavItem> = [
2329
{
2430
title: 'Datasets',
@@ -32,8 +38,6 @@ export default function OrgDashboardLayout({ children }: DashboardLayoutProps) {
3238
},
3339
];
3440

35-
const entitySlug = params.entitySlug;
36-
3741
return (
3842
<>
3943
<BreadCrumbs
@@ -62,7 +66,7 @@ export default function OrgDashboardLayout({ children }: DashboardLayoutProps) {
6266
' bg-surfaceDefault p-4 md:flex'
6367
)}
6468
>
65-
<DashboardNav items={orgSidebarNav} entitySlug={entitySlug} />
69+
<DashboardNav items={orgSidebarNav} entitySlug={params.entitySlug} />
6670

6771
<div className="z-1 basis-2 md:hidden">
6872
<MobileDashboardNav

app/[locale]/dashboard/[entityType]/page.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Image from 'next/image';
44
import Link from 'next/link';
5-
import { useParams, usePathname } from 'next/navigation';
5+
import { notFound, useParams, usePathname } from 'next/navigation';
66
import { useQuery } from '@tanstack/react-query';
77
import { Icon, Text } from 'opub-ui';
88

@@ -58,6 +58,13 @@ const Page = () => {
5858
)
5959
);
6060

61+
if (
62+
process.env.NEXT_PUBLIC_DATASPACE_FEATURE_ENABLED !== 'true' &&
63+
params.entityType === 'dataspace'
64+
) {
65+
return notFound();
66+
}
67+
6168
return (
6269
<div className=" bg-surfaceDefault">
6370
<div>

app/[locale]/dashboard/components/dashboard-header.tsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ export function DashboardHeader({ currentPath }: { currentPath: string }) {
99
selected: currentPath.indexOf('user') >= 0,
1010
disabled: false,
1111
},
12-
{
13-
label: 'My Data Spaces',
14-
url: `/dashboard/dataspace`,
15-
selected: currentPath.indexOf('dataspace') >= 0,
16-
disabled: false,
17-
},
12+
...(process.env.NEXT_PUBLIC_DATASPACE_FEATURE_ENABLED === 'true'
13+
? [
14+
{
15+
label: 'My Data Spaces',
16+
url: `/dashboard/dataspace`,
17+
selected: currentPath.indexOf('dataspace') >= 0,
18+
disabled: false,
19+
},
20+
]
21+
: []),
1822
{
1923
label: 'My Organizations',
2024
url: `/dashboard/organization`,
@@ -29,7 +33,7 @@ export function DashboardHeader({ currentPath }: { currentPath: string }) {
2933
};
3034

3135
const initialTabLabel =
32-
userDashboardOptions.find((option) => option.selected)?.label ||
36+
userDashboardOptions.find((option) => option?.selected)?.label ||
3337
'My Datasets';
3438

3539
return (
@@ -41,16 +45,18 @@ export function DashboardHeader({ currentPath }: { currentPath: string }) {
4145
<div>
4246
<Tabs defaultValue={initialTabLabel}>
4347
<TabList fitted>
44-
{userDashboardOptions.map((item, index) => (
45-
<Tab
46-
value={item.label}
47-
key={index}
48-
onClick={() => handleTabClick(item.url)}
49-
disabled={item.disabled}
50-
>
51-
{item.label}
52-
</Tab>
53-
))}
48+
{userDashboardOptions
49+
.filter((item) => item !== null)
50+
.map((item, index) => (
51+
<Tab
52+
value={item.label}
53+
key={index}
54+
onClick={() => handleTabClick(item.url)}
55+
disabled={item.disabled}
56+
>
57+
{item.label}
58+
</Tab>
59+
))}
5460
</TabList>
5561
</Tabs>
5662
</div>

app/[locale]/dashboard/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Button, Text } from 'opub-ui';
44

55
export default function NotFound() {
66
return (
7-
<div className="flex h-full flex-col items-center justify-center gap-2">
7+
<div className="flex h-[90lvh] flex-col items-center justify-center gap-2">
88
<Text variant="heading3xl">404</Text>
99
<Text variant="headingMd">Page not found</Text>
1010
<div className="mt-2">

app/[locale]/manage/layout.tsx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
'use client';
2+
3+
import React from 'react';
4+
import { useParams } from 'next/navigation';
5+
import { SidebarNavItem } from '@/types';
6+
7+
import { cn } from '@/lib/utils';
8+
import BreadCrumbs from '@/components/BreadCrumbs';
9+
import { DashboardNav } from '../dashboard/components/dashboard-nav';
10+
import { MobileDashboardNav } from '../dashboard/components/mobile-dashboard-nav';
11+
import styles from '../dashboard/components/styles.module.scss';
12+
import LoadingPage from '../dashboard/loading';
13+
14+
interface DashboardLayoutProps {
15+
children?: React.ReactNode;
16+
}
17+
18+
export default function OrgDashboardLayout({ children }: DashboardLayoutProps) {
19+
const [isOpened, setIsOpened] = React.useState(false);
20+
21+
const params = useParams<{ organizationId: string }>();
22+
23+
const orgSidebarNav: Array<SidebarNavItem> = [
24+
{
25+
title: 'Use Cases',
26+
href: `/manage/usecases`,
27+
icon: 'datasetEdit',
28+
},
29+
];
30+
31+
const organizationId = params.organizationId;
32+
33+
return (
34+
<React.Suspense fallback={<LoadingPage />}>
35+
<BreadCrumbs
36+
data={[
37+
{ href: '/', label: 'Home' },
38+
{
39+
href: '',
40+
label: 'Manage',
41+
},
42+
]}
43+
/>
44+
<div
45+
className={cn(
46+
'relative flex flex-col md:flex-row',
47+
' bg-surfaceDefault p-4 md:flex'
48+
)}
49+
>
50+
<DashboardNav items={orgSidebarNav} entitySlug={organizationId} />
51+
52+
<div className="z-1 basis-2 md:hidden">
53+
<MobileDashboardNav
54+
setIsOpened={setIsOpened}
55+
isOpened={isOpened}
56+
items={orgSidebarNav}
57+
/>
58+
</div>
59+
<div className={cn(styles.Main)}>{children}</div>
60+
</div>
61+
</React.Suspense>
62+
);
63+
}

app/[locale]/manage/page.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use client';
2+
3+
import { useRouter } from 'next/navigation';
4+
import { useEffect } from 'react';
5+
6+
import { Loading } from '@/components/loading';
7+
8+
const Manage = () => {
9+
const router = useRouter();
10+
useEffect(() => {
11+
// Redirect to the Use Cases page
12+
router.push(`/manage/usecases`);
13+
}, [router]);
14+
return (
15+
<div>
16+
<Loading />
17+
</div> // Optional: You can show a loading message or spinner here
18+
);
19+
};
20+
export default Manage;

0 commit comments

Comments
 (0)