Skip to content

Commit 28359f5

Browse files
author
tkokhing
committed
major revamp integrate seamless lang sw fr pages, + [frontier]
1 parent dd630ac commit 28359f5

6 files changed

Lines changed: 92 additions & 15 deletions

File tree

.github/workflows/nextjs.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,32 @@ jobs:
2727
token: ${{ secrets.PULL_SUB_FOLDERS_OF_PUBLIC_TOKEN }}
2828
path: temp_public
2929
- name: Copy and move [public] folder to correct level
30-
id: move_public_images
30+
id: move_public_images_AND_setup_data_exporter
3131
run: |
3232
echo "Present working directory --->:"
3333
pwd
3434
echo "ls ./ ----------------------->:"
3535
ls ./
3636
rm -rf public
3737
mkdir public
38-
mv ./temp_public/_frontier_data ./src/lib
3938
mv ./temp_public/* ./public
39+
mv ./temp_public/_data_exporter ./src/lib
4040
rm -rf ./temp_public ./public/README.md
41+
- name: Checkout [frontier_post] private repo
42+
uses: actions/checkout@v4
43+
with:
44+
repository: tkokhing/frontier_post
45+
token: ${{ secrets.PULL_FRONTIER_TOKEN }}
46+
path: temp_frontier
47+
- name: Move [_frontier] folder post to correct level
48+
id: move_frontier_post
49+
run: |
50+
echo "Present working directory---->: $(pwd)"
51+
mkdir _frontier
52+
mv ./temp_frontier/_frontier/*.mdx ./_frontier
53+
rm -rf ./temp_frontier
54+
echo "ls -lha ---->:"
55+
ls -lha .
4156
- name: Checkout [topic_post] private repo
4257
uses: actions/checkout@v4
4358
with:
@@ -154,7 +169,7 @@ jobs:
154169
- name: Clean Up Import Source Files
155170
id: clean-frontier-data
156171
run: |
157-
rm -rf ./src/lib/_frontier_data/
172+
rm -rf ./src/lib/_data_exporter/
158173
159174
deploy:
160175
environment:
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// for content injections and
2+
// export to different page.tsx for dynamic language switching
3+
'use client';
4+
5+
import enFrontierData from '@/lib/_data_exporter/frontier_data_en.mdx';
6+
import zhFrontierData from '@/lib/_data_exporter/frontier_data_zh.mdx';
7+
import enCyberDomainData from '@/lib/_data_exporter/strategic_cyber_domains_en.mdx';
8+
import zhCyberDomainData from '@/lib/_data_exporter/strategic_cyber_domains_zh.mdx';
9+
10+
import DisplayLanguageContent from '../language_handler/language-display';
11+
12+
export const FrontierData = () => {
13+
return <DisplayLanguageContent components={{ en: enFrontierData, zh: zhFrontierData }}/>
14+
}
15+
16+
export const CyberDomainData = () => {
17+
return <DisplayLanguageContent components={{ en: enCyberDomainData, zh: zhCyberDomainData }}/>
18+
}

src/app/_components/preference/frontier-data.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/app/blog/posts/[slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getPostBySlug } from "@/lib/api";
55
import { generatePageMetadata } from "@/lib/generatePageMetadata";
66
import { generatePageStaticParams } from "@/lib/generatePageStaticParams";
77
import Container from "@/app/_components/preference/container";
8-
import FrontierData from "@/app/_components/preference/frontier-data";
8+
import { FrontierData } from "@/app/_components/preference/data-exporter";
99
import { PostHeader } from "@/app/_components/post_gen/post-header";
1010
import { PostBody } from "@/app/_components/post_gen/post-body";
1111

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// pull from private repo: [tkokhing/frontier_post/_frontier] MDX_FOLDER
2+
import { Metadata } from "next";
3+
import { notFound } from "next/navigation";
4+
import Container from "@/app/_components/preference/container";
5+
import { CyberDomainData } from "@/app/_components/preference/data-exporter";
6+
import { PostHeader } from "@/app/_components/post_gen/post-header";
7+
import { PostBody } from "@/app/_components/post_gen/post-body";
8+
import { getPostBySlug } from "@/lib/api";
9+
import { generatePageMetadata } from "@/lib/generatePageMetadata";
10+
import { generatePageStaticParams } from "@/lib/generatePageStaticParams";
11+
12+
const MDX_FOLDER = "_frontier";
13+
14+
type Params = {
15+
params: Promise<{
16+
slug: string;
17+
}>;
18+
};
19+
20+
export default async function Post(props: Params) {
21+
const params = await props.params;
22+
const post = getPostBySlug(params.slug, MDX_FOLDER);
23+
const ImportComponents = {
24+
CyberDomainData,
25+
};
26+
if (!post) return notFound();
27+
28+
return (
29+
<main>
30+
<Container>
31+
<article className="mb-32">
32+
<PostHeader
33+
title={post.title}
34+
coverImage={post.coverImage}
35+
date={post.date}
36+
author={post.author}
37+
subPath={post.subPath}
38+
postStatus={post.postStatus}
39+
/>
40+
<PostBody content={post.content} components={ImportComponents}/>
41+
</article>
42+
</Container>
43+
</main>
44+
);
45+
}
46+
47+
export async function generateMetadata(props: Params): Promise<Metadata> {
48+
const params = await props.params;
49+
return generatePageMetadata(params.slug, MDX_FOLDER);
50+
}
51+
52+
export async function generateStaticParams() {
53+
return generatePageStaticParams(MDX_FOLDER);
54+
}

src/lib/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ export const Home = "https://tkokhing.github.io";
44
export const LOGO_PATH = "/img/logo";
55
export const REPO_NAME = ""; // for future expansion use
66
export const T_ANI_GIF_URL = `${LOGO_PATH}/tkokhing.gif`;
7-
export const TKOKHING_LOGO_SVG_URL = `${LOGO_PATH}/tkokhing.svg`;
8-
export const Frontier_Data_En = `@/../_frontier_data/frontier_data_en.mdx`;
7+
export const TKOKHING_LOGO_SVG_URL = `${LOGO_PATH}/tkokhing.svg`;

0 commit comments

Comments
 (0)