Skip to content

Commit 08b2c08

Browse files
authored
Merge pull request #759 from jeff-phillips-18/ia-updates
Update the navigation items per UX designs
2 parents 0e396ad + c02d480 commit 08b2c08

File tree

39 files changed

+657
-461
lines changed

39 files changed

+657
-461
lines changed

src/app/api/envConfig/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export async function GET() {
1717
DEPLOYMENT_TYPE: process.env.IL_UI_DEPLOYMENT || '',
1818
ENABLE_DEV_MODE: process.env.IL_ENABLE_DEV_MODE || 'false',
1919
ENABLE_DOC_CONVERSION: process.env.IL_ENABLE_DOC_CONVERSION || 'false',
20+
ENABLE_SKILLS_FEATURES: process.env.IL_ENABLE_SKILLS_FEATURES || '',
21+
ENABLE_PLAYGROUND_FEATURES: process.env.IL_ENABLE_PLAYGROUND_FEATURES || '',
2022
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || '',
2123
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '',
2224
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO:

src/app/edit-submission/knowledge/github/[...slug]/page.tsx renamed to src/app/contribute/knowledge/github/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// src/app/edit-submission/knowledge/github/[...slug]/page.tsx
1+
// src/app/contribute/knowledge/github/[...slug]/page.tsx
22
import * as React from 'react';
33
import { AppLayout } from '@/components/AppLayout';
44
import EditKnowledge from '@/components/Contribute/EditKnowledge/github/EditKnowledge';
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// src/app/contribute/knowledge/github/[...slug]/page.tsx
2+
import * as React from 'react';
3+
import { AppLayout } from '@/components/AppLayout';
4+
import EditKnowledge from '@/components/Contribute/EditKnowledge/native/EditKnowledge';
5+
6+
type PageProps = {
7+
params: Promise<{ slug: string[] }>;
8+
};
9+
10+
const EditKnowledgePage = async ({ params }: PageProps) => {
11+
const resolvedParams = await params;
12+
13+
return (
14+
<AppLayout className="contribute-page">
15+
<EditKnowledge branchName={resolvedParams.slug[0]} isDraft={resolvedParams.slug[1] != null ? true : false} />
16+
</AppLayout>
17+
);
18+
};
19+
20+
export default EditKnowledgePage;

src/app/contribute/knowledge/page.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
// src/app/contribute/knowledge/page.tsx
22
'use client';
3-
import React, { useEffect, useState } from 'react';
3+
import React from 'react';
44
import { Flex, Spinner } from '@patternfly/react-core';
55
import { t_global_spacer_xl as XlSpacerSize } from '@patternfly/react-tokens';
66
import { AppLayout } from '@/components/AppLayout';
77
import KnowledgeFormGithub from '@/components/Contribute/Knowledge/Github';
88
import KnowledgeFormNative from '@/components/Contribute/Knowledge/Native';
9+
import { useEnvConfig } from '@/context/EnvConfigContext';
910

1011
const KnowledgeFormPage: React.FunctionComponent = () => {
11-
const [deploymentType, setDeploymentType] = useState<string | undefined>();
12-
const [loaded, setLoaded] = useState<boolean>();
13-
14-
useEffect(() => {
15-
let canceled = false;
16-
17-
const getEnvVariables = async () => {
18-
const res = await fetch('/api/envConfig');
19-
const envConfig = await res.json();
20-
if (!canceled) {
21-
setDeploymentType(envConfig.DEPLOYMENT_TYPE);
22-
setLoaded(true);
23-
}
24-
};
25-
26-
getEnvVariables();
27-
28-
return () => {
29-
canceled = true;
30-
};
31-
}, []);
12+
const {
13+
loaded,
14+
envConfig: { isGithubMode }
15+
} = useEnvConfig();
3216

3317
return (
3418
<AppLayout className="contribute-page">
3519
{loaded ? (
36-
<>{deploymentType === 'native' ? <KnowledgeFormNative /> : <KnowledgeFormGithub />}</>
20+
<>{!isGithubMode ? <KnowledgeFormNative /> : <KnowledgeFormGithub />}</>
3721
) : (
3822
<Flex alignItems={{ default: 'alignItemsCenter' }} justifyContent={{ default: 'justifyContentCenter' }} style={{ padding: XlSpacerSize.var }}>
3923
<Spinner size="xl" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// src/app/contribute/knowledge/github/[...slug]/page.tsx
2+
import * as React from 'react';
3+
import { AppLayout } from '@/components/AppLayout';
4+
import EditSkill from '@/components/Contribute/EditSkill/github/EditSkill';
5+
6+
type PageProps = {
7+
params: Promise<{ slug: string[] }>;
8+
};
9+
10+
const EditKnowledgePage = async ({ params }: PageProps) => {
11+
const resolvedParams = await params;
12+
13+
return (
14+
<AppLayout className="contribute-page">
15+
<EditSkill prNumber={resolvedParams.slug[0]} isDraft={resolvedParams.slug[1] != null ? true : false} />
16+
</AppLayout>
17+
);
18+
};
19+
20+
export default EditKnowledgePage;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// src/app/contribute/knowledge/github/[...slug]/page.tsx
2+
import * as React from 'react';
3+
import { AppLayout } from '@/components/AppLayout';
4+
import EditSkill from '@/components/Contribute/EditSkill/native/EditSkill';
5+
6+
type PageProps = {
7+
params: Promise<{ slug: string[] }>;
8+
};
9+
10+
const EditKnowledgePage = async ({ params }: PageProps) => {
11+
const resolvedParams = await params;
12+
13+
return (
14+
<AppLayout className="contribute-page">
15+
<EditSkill branchName={resolvedParams.slug[0]} isDraft={resolvedParams.slug[1] != null ? true : false} />
16+
</AppLayout>
17+
);
18+
};
19+
20+
export default EditKnowledgePage;

src/app/contribute/skill/page.tsx

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
// src/app/contribute/skill/page.tsx
22
'use client';
3+
import React from 'react';
4+
import { Flex, Spinner } from '@patternfly/react-core';
5+
import { t_global_spacer_xl as XlSpacerSize } from '@patternfly/react-tokens/dist/esm/t_global_spacer_xl';
36
import { AppLayout } from '@/components/AppLayout';
47
import { SkillFormGithub } from '@/components/Contribute/Skill/Github/index';
58
import { SkillFormNative } from '@/components/Contribute/Skill/Native/index';
6-
import { t_global_spacer_xl as XlSpacerSize } from '@patternfly/react-tokens';
7-
import { Flex, Spinner } from '@patternfly/react-core';
8-
import { useEffect, useState } from 'react';
9+
import { useEnvConfig } from '@/context/EnvConfigContext';
910

1011
const SkillFormPage: React.FunctionComponent = () => {
11-
const [deploymentType, setDeploymentType] = useState<string | undefined>();
12-
const [loaded, setLoaded] = useState<boolean>();
13-
14-
useEffect(() => {
15-
let canceled = false;
16-
17-
const getEnvVariables = async () => {
18-
const res = await fetch('/api/envConfig');
19-
const envConfig = await res.json();
20-
if (!canceled) {
21-
setDeploymentType(envConfig.DEPLOYMENT_TYPE);
22-
setLoaded(true);
23-
}
24-
};
25-
26-
getEnvVariables();
12+
const {
13+
loaded,
14+
envConfig: { isGithubMode }
15+
} = useEnvConfig();
2716

28-
return () => {
29-
canceled = true;
30-
};
31-
}, []);
3217
return (
3318
<AppLayout className="contribute-page">
3419
{loaded ? (
35-
<>{deploymentType === 'native' ? <SkillFormNative /> : <SkillFormGithub />}</>
20+
!isGithubMode ? (
21+
<SkillFormNative />
22+
) : (
23+
<SkillFormGithub />
24+
)
3625
) : (
3726
<Flex alignItems={{ default: 'alignItemsCenter' }} justifyContent={{ default: 'justifyContentCenter' }} style={{ padding: XlSpacerSize.var }}>
3827
<Spinner size="xl" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// src/app/dashboard/knowledge/github/[...slug]/page.tsx
2+
import * as React from 'react';
3+
import { AppLayout } from '@/components/AppLayout';
4+
import EditKnowledge from '@/components/Contribute/EditKnowledge/github/EditKnowledge';
5+
6+
type PageProps = {
7+
params: Promise<{ slug: string[] }>;
8+
};
9+
10+
const EditKnowledgePage = async ({ params }: PageProps) => {
11+
const resolvedParams = await params;
12+
13+
return (
14+
<AppLayout className="contribute-page">
15+
<EditKnowledge prNumber={resolvedParams.slug[0]} isDraft={resolvedParams.slug[1] != null ? true : false} />
16+
</AppLayout>
17+
);
18+
};
19+
20+
export default EditKnowledgePage;

src/app/edit-submission/knowledge/native/[...slug]/page.tsx renamed to src/app/dashboard/knowledge/native/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// src/app/edit-submission/knowledge/native/[...slug]/page.tsx
1+
// src/app/dashboard/knowledge/native/[...slug]/page.tsx
22
import { AppLayout } from '@/components/AppLayout';
33
import EditKnowledgeNative from '@/components/Contribute/EditKnowledge/native/EditKnowledge';
44
import * as React from 'react';

src/app/dashboard/page.tsx

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
// src/app/dashboard/page.tsx
22
'use client';
33

4+
import React from 'react';
5+
import { Flex, Spinner } from '@patternfly/react-core';
6+
import { t_global_spacer_xl as XlSpacerSize } from '@patternfly/react-tokens/dist/esm/t_global_spacer_xl';
47
import '@patternfly/react-core/dist/styles/base.css';
58
import { AppLayout } from '@/components/AppLayout';
69
import { DashboardGithub } from '@/components/Dashboard/Github/dashboard';
710
import { DashboardNative } from '@/components/Dashboard/Native/dashboard';
8-
import { useEffect, useState } from 'react';
11+
import { useEnvConfig } from '@/context/EnvConfigContext';
912

1013
const Home: React.FunctionComponent = () => {
11-
const [deploymentType, setDeploymentType] = useState<string | undefined>();
14+
const {
15+
loaded,
16+
envConfig: { isGithubMode }
17+
} = useEnvConfig();
1218

13-
useEffect(() => {
14-
const getEnvVariables = async () => {
15-
const res = await fetch('/api/envConfig');
16-
const envConfig = await res.json();
17-
setDeploymentType(envConfig.DEPLOYMENT_TYPE);
18-
};
19-
getEnvVariables();
20-
}, []);
21-
22-
return <AppLayout>{deploymentType === 'native' ? <DashboardNative /> : <DashboardGithub />}</AppLayout>;
19+
return (
20+
<AppLayout>
21+
{loaded ? (
22+
!isGithubMode ? (
23+
<DashboardNative />
24+
) : (
25+
<DashboardGithub />
26+
)
27+
) : (
28+
<Flex alignItems={{ default: 'alignItemsCenter' }} justifyContent={{ default: 'justifyContentCenter' }} style={{ padding: XlSpacerSize.var }}>
29+
<Spinner size="xl" />
30+
</Flex>
31+
)}
32+
</AppLayout>
33+
);
2334
};
2435

2536
export default Home;

0 commit comments

Comments
 (0)