Skip to content

Commit

Permalink
fix: Programming language name (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatehito authored Feb 8, 2024
1 parent d3d7063 commit edb1120
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/(withAuth)/courses/[courseId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import type { NextPage } from 'next';
import NextLink from 'next/link';
import React, { useEffect, useState } from 'react';

import { courseIdToProgramIdLists, languageIds, programIdToName } from '../../../../problems/problemData';
import {
courseIdToProgramIdLists,
languageIdToName,
languageIds,
programIdToName,
} from '../../../../problems/problemData';
import { getLanguageIdFromSessionStorage, setLanguageIdToSessionStorage } from '../../../lib/SessionStorage';

const CoursePage: NextPage<{ params: { courseId: string } }> = ({ params }) => {
Expand Down Expand Up @@ -47,7 +52,7 @@ const CoursePage: NextPage<{ params: { courseId: string } }> = ({ params }) => {
>
{languageIds.map((languageId) => (
<option key={languageId} value={languageId}>
{languageId}
{languageIdToName[languageId]}
</option>
))}
</Select>
Expand Down
5 changes: 5 additions & 0 deletions src/problems/problemData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export type ProgramId = (typeof programIds)[number];
export const languageIds = ['js', 'java'];
export type LanguageId = (typeof languageIds)[number];

export const languageIdToName: Record<LanguageId, string> = {
js: 'JavaScript',
java: 'Java',
};

export const courseIdToName: Record<CourseId, string> = {
tuBeginner1: '初級プログラミングⅠ',
tuBeginner2: '初級プログラミングⅡ',
Expand Down

0 comments on commit edb1120

Please sign in to comment.