Skip to content

Commit

Permalink
add errata and contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
ncukondo committed Mar 5, 2024
1 parent e25d3a5 commit 9def128
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 13 deletions.
19 changes: 14 additions & 5 deletions src/components/GeneralGuidance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@ const GeneralGuidance: React.FC<Props> = props => {
{t("linkMextText")}
<FiExternalLink className="ml-1 inline-block" />
</Link>
<Link target="_blank" className="link-hover link-info link" href={t("pdfLink")}>
<MdDownload className="mr-1 inline-block" />
{t("pdfLinkText")}
<MdOutlinePictureAsPdf className="ml-1 inline-block" />
</Link>
<span className="flex flex-row gap-3">
<Link target="_blank" className="link-hover link-info link" href={t("pdfLink")}>
<MdDownload className="mr-1 inline-block" />
{t("pdfLinkText")}
<MdOutlinePictureAsPdf className="ml-1 inline-block" />
</Link>
<span>
(
<Link className="link-hover link-info link" href="/errata">
{t("errata")}
</Link>
)
</span>
</span>
<Link className="link-hover link-info link" href="/movies">
{t("movies")}
</Link>
Expand Down
70 changes: 70 additions & 0 deletions src/pages/errata/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import type { NextPage, GetStaticProps } from "next";
import Head from "next/head";
import { BackButton } from "@components/buttons/BackButton";
import { Locale, useTranslation } from "@services/i18n/i18n";

type ErrataInfo = {
position: string;
error: string;
correct: string;
comment: string;
date: string;
};
type PageProps = {
data: ErrataInfo[];
};

export const getStaticProps: GetStaticProps<PageProps> = async ({ locale }) => {
locale = locale as Locale;
const data = locale === "ja" ? (await import("json_in_repo/errata/ja.json")).default : [];
return {
props: { data },
};
};

const HeaderBar = () => {
return (
<div className="bg-base-100/80 sticky top-0 flex w-full items-center backdrop-blur-sm">
<div className="ml-2">
<BackButton />
</div>
</div>
);
};

const ErrataAPage: NextPage<PageProps> = ({ data }: PageProps) => {
const { t } = useTranslation("@pages/errata");

return (
<>
<Head>
<title>{t("title")}</title>
</Head>
<HeaderBar />
<h1 className="text-base-content mt-4 text-center text-3xl">{t("h1")}</h1>
<div className="m-4 pb-24">
{data.map(({ position, error, correct, comment, date }, i) => {
return (
<section key={error} className="mx-auto mb-16 max-w-3xl">
<h3 className="text-base-content my-4 text-lg">{position}</h3>
<p className="text-base-content ml-2">
<span className="text-accent">{t("errorHeader")}</span> {error}
</p>
<p className="text-base-content ml-2">
<span className="text-accent">{t("correctHeader")}</span> {correct}
</p>
{comment && (
<p className="text-base-content ml-2">
<span className="text-accent">{t("commentHeader")}</span> {comment}
</p>
)}
<p className="text-base-content/40 ml-2 text-xs">{date}</p>
</section>
);
})}
</div>
</>
);
};

export default ErrataAPage;
55 changes: 52 additions & 3 deletions src/pages/movies/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import { Locale, useTranslation } from "@services/i18n/i18n";

type PageProps = {
data: DataList;
constributors: ContributorInfo[];
};

type ContributorInfo = {
team: string;
category: string;
name: string;
affiliation: string;
};

type FileInfo = {
Expand Down Expand Up @@ -135,8 +143,12 @@ export const loadMovieData = async (locale: Locale): Promise<DataList> => {

export const getStaticProps: GetStaticProps<PageProps> = async ({ locale }) => {
const data = await loadMovieData(locale as Locale);
const constributors =
locale === "ja"
? (await import("json_in_repo/contributors/ja.json")).default
: await import("json_in_repo/contributors/en.json");
return {
props: { data },
props: { data, constributors },
};
};

Expand Down Expand Up @@ -358,7 +370,29 @@ const Layout = ({ toc, main }: LayoutProps) => {
);
};

const MoviesPage: NextPage<PageProps> = ({ data }: { data: DataList }) => {
const ContributorsList = ({ constributors }: { constributors: ContributorInfo[] }) => {
const { t } = useTranslation("@pages/movies");
return (
<div className="p-8">
<h2 className="text-base-content mt-10 text-2xl" id="contributors">
{t("contributors")}
</h2>
<ul className="flex flex-col gap-3">
{constributors.map(({ team, category, name, affiliation }, i) => {
return (
<li key={i}>
<h3 className="text-base-content mt-10 text-xl">{name}</h3>
<p className="text-base-content">{affiliation}</p>
<p className="text-base-content">{category}</p>
</li>
);
})}
</ul>
</div>
);
};

const MoviesPage: NextPage<PageProps> = ({ data, constributors }) => {
const { t } = useTranslation("@pages/movies");
return (
<div className="h-dvh">
Expand All @@ -367,7 +401,22 @@ const MoviesPage: NextPage<PageProps> = ({ data }: { data: DataList }) => {
</Head>
<HeaderBar />
<div className="h-full">
<Layout toc={<MovieToc data={data} />} main={<WholeMovieCardList data={data} />} />
<Layout
toc={
<div className="flex flex-col gap-5">
<MovieToc data={data} />
<Link href="/movies#contributors" className="link-info block">
{t("contributors")}
</Link>
</div>
}
main={
<div>
<WholeMovieCardList data={data} />
<ContributorsList constributors={constributors} />
</div>
}
/>
</div>
</div>
);
Expand Down
10 changes: 5 additions & 5 deletions src/pages/qanda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const getStaticProps: GetStaticProps<PageProps> = async ({ locale }) => {

const HeaderBar = () => {
return (
<div className="sticky top-0 flex w-full items-center bg-base-100/80 backdrop-blur-sm">
<div className="bg-base-100/80 sticky top-0 flex w-full items-center backdrop-blur-sm">
<div className="ml-2">
<BackButton />
</div>
Expand All @@ -39,13 +39,13 @@ const QandAPage: NextPage<PageProps> = ({ data }: PageProps) => {
<HeaderBar />
<div className="m-4 pb-24">
{data.map(({ question, answer }, i) => {
const index = i+1
const index = i + 1;
return (
<section key={question} className="mx-auto mb-16 max-w-3xl">
<h3 className="my-4 text-lg text-base-content">
<span className="font-bold text-accent">Q{index}.</span> {question}
<h3 className="text-base-content my-4 text-lg">
<span className="text-accent font-bold">Q{index}.</span> {question}
</h3>
<p className="ml-2 text-base-content">
<p className="text-base-content ml-2">
<span className="text-accent">A{index}.</span> {answer}
</p>
</section>
Expand Down
12 changes: 12 additions & 0 deletions src/services/i18n/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ const text = {
notFound: { ja: "は見つかりませんでした。", en: " was not found." },
notFoundToBack: { ja: "動画一覧ページへ戻る", en: "Back to movies list" },
fileExists: { ja: "関連ファイルあり", en: "Related files exist" },
contributors: { ja: "動画制作協力者一覧 (敬称略)", en: "Movie contributors" },
},
"@pages/errata": {
title: { ja: "誤植・誤り一覧 | コアカリナビ", en: "Errata | Core Curriculum Navigator" },
h1: { ja: "誤植・誤り一覧", en: "Errata" },
errorHeader: { ja: "誤り", en: "Error" },
correctHeader: { ja: "訂正", en: "Correction" },
commentHeader: { ja: "コメント", en: "Comment" },
},
"@pages/404": {
title: {
Expand Down Expand Up @@ -306,6 +314,10 @@ const text = {
// eslint-disable-next-line max-len
en: `This page contains the official English translation of the original Japanese revision, produced by the Model Core Curriculum Expert Research Committee of the Japan Society for Medical Education, as part of a project commissioned by the Ministry of Education, Culture, Sports, Science and Technology (MEXT).`,
},
errata: {
ja: "誤植・誤り一覧",
en: "Errata",
},
linkMextText: {
ja: "文部科学省モデル・コア・カリキュラム公表ページ",
en: "MEXT Model Core Curriculum page (Japanese page)",
Expand Down

0 comments on commit 9def128

Please sign in to comment.