Skip to content

Commit 6c0998c

Browse files
committed
Add StepNavigation component to EditLayout and UseCase layout for improved navigation
1 parent 71d934c commit 6c0998c

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { Tab, TabList, Tabs, toast } from 'opub-ui';
1010
import { GraphQL } from '@/lib/api';
1111
import TitleBar from '../../../../components/title-bar';
1212
import { useDatasetEditStatus } from '../context';
13+
import StepNavigation from '../../../../components/StepNavigation';
1314

1415
const datasetQueryDoc: any = graphql(`
1516
query datasetTitleQuery($filters: DatasetFilter) {
@@ -146,6 +147,9 @@ export function EditLayout({ children, params }: LayoutProps) {
146147
<div className="bg-surface border-l-divider rounded-tl-none my-6 flex-grow">
147148
{children}
148149
</div>
150+
<div>
151+
<StepNavigation steps={['metadata','resources','publish']}/>
152+
</div>
149153
</div>
150154
</div>
151155
);

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/details/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ const Details = () => {
210210
}, [editMutationLoading]);
211211

212212
return (
213-
<div>
214213
<div className=" flex flex-col gap-6">
215214
<div>
216215
<TextField
@@ -308,7 +307,6 @@ const Details = () => {
308307
/>
309308
</div> */}
310309
</div>
311-
</div>
312310
);
313311
};
314312

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

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

3-
import React from 'react';
43
import { useParams, usePathname, useRouter } from 'next/navigation';
54
import { graphql } from '@/gql';
65
import { UseCaseInputPartial } from '@/gql/generated/graphql';
76
import { useMutation, useQuery } from '@tanstack/react-query';
87
import { Tab, TabList, Tabs, toast } from 'opub-ui';
98

109
import { GraphQL } from '@/lib/api';
10+
import StepNavigation from '../../components/StepNavigation';
1111
import TitleBar from '../../components/title-bar';
1212
import { EditStatusProvider, useEditStatus } from './context';
1313

@@ -40,6 +40,7 @@ const TabsAndChildren = ({ children }: { children: React.ReactNode }) => {
4040
const pathItem = layoutList.find(function (v) {
4141
return pathName.indexOf(v) >= 0;
4242
});
43+
4344
const UseCaseData: { data: any; isLoading: boolean; refetch: any } = useQuery(
4445
[`fetch_UseCaseData`],
4546
() =>
@@ -57,6 +58,7 @@ const TabsAndChildren = ({ children }: { children: React.ReactNode }) => {
5758
refetchOnReconnect: true,
5859
}
5960
);
61+
6062
const { mutate, isLoading: editMutationLoading } = useMutation(
6163
(data: { data: UseCaseInputPartial }) =>
6264
GraphQL(UpdateUseCaseTitleMutation, {}, data),
@@ -100,7 +102,7 @@ const TabsAndChildren = ({ children }: { children: React.ReactNode }) => {
100102
};
101103

102104
const initialTabLabel =
103-
links.find((option) => option.selected)?.label || 'Details';
105+
links.find((option) => option.selected)?.label || 'Use Case Details';
104106

105107
const { status, setStatus } = useEditStatus();
106108

@@ -115,7 +117,14 @@ const TabsAndChildren = ({ children }: { children: React.ReactNode }) => {
115117
status={status}
116118
setStatus={setStatus}
117119
/>
118-
<Tabs defaultValue={initialTabLabel}>
120+
<Tabs
121+
value={initialTabLabel}
122+
onValueChange={(newValue) =>
123+
handleTabClick(
124+
links.find((link) => link.label === newValue)?.url || ''
125+
)
126+
}
127+
>
119128
<TabList fitted border>
120129
{links.map((item, index) => (
121130
<Tab
@@ -130,8 +139,11 @@ const TabsAndChildren = ({ children }: { children: React.ReactNode }) => {
130139
))}
131140
</TabList>
132141
</Tabs>
133-
<div className="bg-surface border-l-divider rounded-tl-none flex-grow">
134-
{children}
142+
<div className="">{children}</div>
143+
<div className="mb-6">
144+
<StepNavigation
145+
steps={['details', 'assign', 'contributors', 'publish']}
146+
/>
135147
</div>
136148
</div>
137149
);

0 commit comments

Comments
 (0)