Skip to content

Commit 0ca5c38

Browse files
loris-olivier-obiloris-marubilalesitolokoban
authored
Documentation page creation (#409)
* Removed the component of search bar and filter options * Added documentation page * Create the page + navigation component + content of the architecture * Added a layout and created the home page header * Added tutorial carousel * Added the workshop slider * Added transcript and steps to the query * Added transcript options to the single tutorial page * Added the timestamps for the videos * Added checker for the transcripts * Removed the checker for steps and transcript * Added chapter for each steps of the videos * Added coming soon to section on home * update error message for vlab exist on creation (#399) * 110/change user journey format 2 (#406) * New format for user journey used in suggestions * New format for user journey used in suggestions * Fix error with localStorage and SSR * Public project notebook update complete metadata (#405) * Removed the component of search bar and filter options * Added object of interest, scale and authors in addition to the readme in a dropdown * Refine H1, H2 and H3 of the readMe * Corrected import order --------- Co-authored-by: Loris Olivier <53363974+loris-maru@users.noreply.github.com> * 110/change user journey format 3 (#407) * New format for user journey used in suggestions * New format for user journey used in suggestions * Fix issue for new user * Public projects corrections ayima feedback (#412) * Removed the component of search bar and filter options * Correction round 1 * Correction round 2 * Notebook read more button style + unique key for tables rows --------- Co-authored-by: Loris Olivier <53363974+loris-maru@users.noreply.github.com> * Removed console log + import order * Ran prettier and removed comments * Fixes based on Fabien feedbacks --------- Co-authored-by: Loris Olivier <53363974+loris-maru@users.noreply.github.com> Co-authored-by: Bilal MEDDAH <b_meddah@esi.dz> Co-authored-by: Tolokoban <contact@tolokoban.org>
1 parent ed67716 commit 0ca5c38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1331
-33
lines changed
Loading

src/app/app/documentation/layout.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import DocumentationSideBloc from '@/components/documentation/global/side-bloc';
2+
3+
export default function DocumentationLayout({ children }: { children: React.ReactNode }) {
4+
return (
5+
<div className="relative min-h-screen w-screen bg-primary-9 p-8">
6+
<DocumentationSideBloc />
7+
<main className="ml-[255px] w-2/3">{children}</main>
8+
</div>
9+
);
10+
}

src/app/app/documentation/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import DocumentationHomepage from '@/components/documentation/main/Homepage';
2+
3+
export default function DocumentationPage() {
4+
return <DocumentationHomepage />;
5+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
'use client';
2+
3+
import { useParams } from 'next/navigation';
4+
import { useRef, useState } from 'react';
5+
6+
import { useSanityForSingleTutorial } from '@/components/documentation/tutorials/fetch-single-tutorial';
7+
import SliderTimestamps from '@/components/documentation/tutorials/slider-timestamps';
8+
import TextContentBloc from '@/components/documentation/tutorials/TextContentBloc';
9+
10+
export default function SingleTutorialPage() {
11+
const params = useParams();
12+
const slug = params.slug as string;
13+
14+
const videoRef = useRef<HTMLVideoElement>(null);
15+
const [videoTime, setVideoTime] = useState<number>(0);
16+
17+
const content = useSanityForSingleTutorial({ slug });
18+
19+
const handleTimeUpdate = () => {
20+
if (videoRef.current) {
21+
setVideoTime(Math.floor(videoRef.current.currentTime));
22+
}
23+
};
24+
25+
if (!content) {
26+
return (
27+
<div className="container mx-auto p-4 text-white">
28+
<h1 className="text-3xl font-bold">Tutorial Not Found</h1>
29+
<p>The tutorial with slug &quot;{slug}&quot; could not be found or is still loading.</p>
30+
</div>
31+
);
32+
}
33+
34+
return (
35+
<div className="relative flex w-full flex-col">
36+
<header className="mb-4 w-full text-white">
37+
<div className="text-base font-normal uppercase tracking-wider">Tutorial</div>
38+
<h1 className="text-3xl font-bold">{content.title}</h1>
39+
</header>
40+
<div className="mb-4 w-full">
41+
{content.url ? (
42+
<video
43+
playsInline
44+
loop
45+
controls
46+
className="h-auto w-full rounded-lg border border-solid border-primary-7"
47+
src={content.url}
48+
ref={videoRef}
49+
onTimeUpdate={handleTimeUpdate}
50+
>
51+
<track kind="captions" srcLang="en" label="English captions" />
52+
</video>
53+
) : (
54+
<p className="text-white">Video URL not available.</p>
55+
)}
56+
</div>
57+
<SliderTimestamps
58+
content={content.steps ?? []}
59+
videoTime={videoTime}
60+
setVideoTime={setVideoTime}
61+
videoRef={videoRef}
62+
/>
63+
<TextContentBloc content={content} />
64+
</div>
65+
);
66+
}

src/components/PublicProjects/tables/e-model-table.tsx

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

33
import { Table, TableProps } from 'antd';
4-
import { useState } from 'react';
4+
import { Key, useState } from 'react';
55
import { EModelsProps } from '../type/artifactsType';
66
import columns from './columns/e-model-columns';
77

@@ -13,17 +13,17 @@ export default function EModelTable({ content }: { content: EModelsProps[] }) {
1313

1414
const rowSelection: TableProps<EModelsProps>['rowSelection'] = {
1515
type: 'radio',
16-
onChange: (selectedRowKeys: React.Key[], selectedRows: EModelsProps[]) => {
16+
onChange: (selectedRowKeys: Key[], selectedRows: EModelsProps[]) => {
1717
setSelectedRow(selectedRows[0] || null);
1818
},
1919
};
2020

2121
const handleDownload = () => {
22-
console.log('Want to download:', selectedRow?.download);
2322
if (selectedRow?.downloadLink) {
2423
const link = document.createElement('a');
2524
link.href = selectedRow.download ?? '';
26-
link.download = selectedRow.name || 'model'; // Use model name as filename or fallback to 'model'
25+
link.download = selectedRow.name || 'model';
26+
2727
document.body.appendChild(link);
2828
link.click();
2929
document.body.removeChild(link);

src/components/SideMenu/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
'use client';
22

3-
import { useAtomValue } from 'jotai';
4-
import { unwrap } from 'jotai/utils';
53
import {
64
DownOutlined,
75
HomeOutlined,
86
QuestionCircleOutlined,
97
UpOutlined,
108
UserOutlined,
119
} from '@ant-design/icons';
10+
import { useAtomValue } from 'jotai';
11+
import { unwrap } from 'jotai/utils';
1212
import Link from 'next/link';
13-
1413
import HelpMenu from '../HelpMenu';
14+
import DocumentationIcon from '../icons/DocumentationIcon';
15+
1516
import UserMenu from '@/components/user-menu';
1617
import { LabItem, LinkItem, ProjectItem } from '@/components/VerticalLinks';
18+
import { useUnwrappedValue } from '@/hooks/hooks';
1719
import { virtualLabDetailAtomFamily } from '@/state/virtual-lab/lab';
1820
import { virtualLabProjectDetailsAtomFamily } from '@/state/virtual-lab/projects';
1921
import { classNames } from '@/util/utils';
20-
import { useUnwrappedValue } from '@/hooks/hooks';
2122

2223
type SideMenuProps = {
2324
lab: LabItem;
@@ -99,6 +100,9 @@ export default function SideMenu({ lab, project, links }: SideMenuProps) {
99100
</div>
100101

101102
<div className="mb-5 flex w-full flex-col items-center gap-2 overflow-hidden text-primary-3">
103+
<Link href="/app/virtual-lab" className="group cursor-pointer">
104+
<DocumentationIcon iconColor="white" />
105+
</Link>
102106
<HelpMenu>
103107
<QuestionCircleOutlined className="group-hover:text-white" />
104108
</HelpMenu>

src/components/VirtualLab/side-bar/control.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
'use client';
22

3-
import Link from 'next/link';
43
import { HomeOutlined, QuestionCircleOutlined, UserOutlined } from '@ant-design/icons';
4+
import Link from 'next/link';
55

6-
import { classNames } from '@/util/utils';
7-
import UserMenu from '@/components/user-menu';
86
import HelpMenu from '@/components/HelpMenu';
7+
import { DocumentationIcon } from '@/components/icons';
8+
import UserMenu from '@/components/user-menu';
9+
import { classNames } from '@/util/utils';
910

1011
export default function Profile() {
1112
return (
1213
<div className="mt-auto flex flex-col gap-4">
14+
<Link
15+
href="/app/documentation"
16+
aria-label="documentation"
17+
className={classNames(
18+
'flex h-12 w-12 items-center justify-center p-3',
19+
'text-white transition-all duration-200',
20+
'border border-primary-6 hover:border-primary-5 hover:bg-primary-5'
21+
)}
22+
>
23+
<DocumentationIcon className="h-auto w-5 text-white" />
24+
</Link>
1325
<HelpMenu
1426
cls={{
1527
trigger: '!p-0',
@@ -19,7 +31,7 @@ export default function Profile() {
1931
className={classNames(
2032
'flex w-max items-center justify-center p-3',
2133
'text-white transition-all duration-200',
22-
'border border-white hover:border-primary-5 hover:bg-primary-5'
34+
'border border-primary-6 hover:border-primary-5 hover:bg-primary-5'
2335
)}
2436
>
2537
<QuestionCircleOutlined className="text-xl" />
@@ -32,7 +44,7 @@ export default function Profile() {
3244
className={classNames(
3345
'flex w-max items-center justify-center p-3',
3446
'text-white transition-all duration-200',
35-
'border border-white hover:border-primary-5 hover:bg-primary-5'
47+
'border border-primary-6 hover:border-primary-5 hover:bg-primary-5'
3648
)}
3749
>
3850
<HomeOutlined className="text-xl" />
@@ -46,7 +58,7 @@ export default function Profile() {
4658
className={classNames(
4759
'flex w-max items-center justify-center p-3',
4860
'text-white transition-all duration-200',
49-
'border border-white hover:border-primary-5 hover:bg-primary-5'
61+
'border border-primary-6 hover:border-primary-5 hover:bg-primary-5'
5062
)}
5163
>
5264
<UserOutlined className="text-xl" />

0 commit comments

Comments
 (0)