Skip to content

Commit 5e167c8

Browse files
committed
Merge branch 'main' into notion
2 parents 935f3aa + fae92fb commit 5e167c8

File tree

18 files changed

+1866
-516
lines changed

18 files changed

+1866
-516
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_MODE=default

package-lock.json

Lines changed: 1081 additions & 513 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7+
"dev:mock": "export NEXT_PUBLIC_MODE=mock && next dev",
78
"build": "next build",
89
"start": "next start",
910
"lint": "next lint",

readme/developer_readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,13 @@ if there are any prettier errors, please run the following command to fix them.
2626
```bash
2727
npx prettier . --write
2828
```
29+
30+
## mock mode
31+
32+
To run the mock mode, run the following command.
33+
34+
```bash
35+
npm run dev:mock
36+
```
37+
38+
It will run the application with the mock data.

src/app/components/Sample/ClassModal/SampleClassData.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,90 @@ export const SampleClasses: ClassDataType[] = [
9696
shortenedEvaluation: "レポ出席",
9797
shortenedClassroom: "他(学内等)",
9898
},
99+
{
100+
code: "50033",
101+
type: "基礎",
102+
category: "既修外国語",
103+
semester: "A",
104+
dayPeriod: [
105+
{
106+
day: "mon",
107+
period: 2,
108+
},
109+
],
110+
classroom: "駒場5号館 516教室",
111+
titleJp: "英語二列W(ALESA)",
112+
lecturer: "Simon Perry",
113+
titleEn: "English Language",
114+
lecturerEn: "Simon Perry",
115+
ccCode: "CAS-FC1114S3",
116+
credits: 2,
117+
detail:
118+
"This course introduces students to the skill of building an effective written argument in English supported by sources and evidence, and to the conventions of formal writing. By the end of the course, students will:\n- be able to present a clear position which is supported by evidence and addresses alternative points of view;\n- understand the organisation and rhetorical features of an argumentative essay;\n- be familiar with basic stylistic conventions of academic writing.",
119+
schedule: "",
120+
methods:
121+
"Class activities will include reading and analyzing argumentative writing in English; developing a position on an issue on the basis of individual research; engaging in a variety of pre-writing exercises; writing and revising; and using peer feedback to improve students’ own and others’ work in discussion and written comments.\n\nThe class is taught in English, and students are encouraged to speak English in class. Graduate-student teaching assistants are available in the Komaba Writers’ Studio to help students with their research, writing, and discussion.",
122+
evaluation:
123+
"Grades are based on writing assignments, discussion, and participation in class activities.",
124+
notes: "",
125+
class: "1年 文一二(8,22)文三(5,7,9)",
126+
guidance: "なし",
127+
guidanceDate: "",
128+
guidancePeriod: "",
129+
time: 90,
130+
timeCompensation:
131+
"Students will be encouraged to contact the instructor by email when they have further questions.",
132+
targetClass: [
133+
["l1_8", "l2_8", "l1_22", "l2_22", "l3_5", "l3_7", "l3_9"],
134+
[],
135+
],
136+
importance: [["l1", "l2", "l3", "s1", "s2", "s3"], []],
137+
shortenedCategory: "基礎",
138+
shortenedEvaluation: "レポ出席平常",
139+
shortenedClassroom: "516",
140+
},
141+
{
142+
code: "51320",
143+
type: "総合",
144+
category: "A(思想・芸術)",
145+
semester: "A",
146+
dayPeriod: [
147+
{
148+
day: "mon",
149+
period: 2,
150+
},
151+
],
152+
classroom: "駒場12号館 1232教室",
153+
titleJp: "外国文学",
154+
lecturer: "Barnaby Ralph",
155+
titleEn: "Foreign Literature",
156+
lecturerEn: "Barnaby Ralph",
157+
ccCode: "CAS-GC1A17L1",
158+
credits: 2,
159+
detail:
160+
"Students who take this course will reinforce their knowledge of Western literature, history, and culture, whilst learning about how works can be connected thematically. They will be introduced to key critical terms and will also have opportunities for discussion and a chance to develop their academic writing skills. It is intended to offer information that can continue to be valuable for their future studies.",
161+
schedule:
162+
'Week One: The beginnings of Western Literature, including Homer and Greek tragedy\nWeek Two: Greece to Rome, including Horace\'s "Ars Poetica"\nWeek Three: The rise of English, including Anglo-Saxon poetry\nWeek Four: Middle English, Chaucer, and the battle over language\nWeek Five: The Elizabethan period and the plays of Shakespeare\nWeek Six: The short seventeenth century - war, plague, fire, and Milton\nWeek Seven: The long eighteenth century and the satires of Swift and Pope\nWeek Eight: The rise of Romanticism and Sensibility\nWeek Nine: British Imperialism and the nineteenth century\nWeek Ten: Literature in the New World, Manifest Destiny, and the American Dream\nWeek Eleven: Modernism and the search for meaning\nWeek Twelve: In-class test\nWeek Thirteen: Literature from the late twentieth century to today',
163+
methods:
164+
"This class shall be conducted using a lecture/discussion format. Handouts will be given each week and these shall form a kind of textbook on which the final examination will be based.",
165+
evaluation:
166+
"In-class work (including homework): 20%\nTest: 30%\nEssay: 50%",
167+
notes:
168+
"Each week, homework will be given. It is expected that this will be completed by the next class and this will be checked.",
169+
class: "1年 文科 理科 2年 文科 理科",
170+
guidance: "なし",
171+
guidanceDate: "",
172+
guidancePeriod: "",
173+
time: 90,
174+
timeCompensation:
175+
"The shortened class time wil be compensated for through homework assignments and set readings.",
176+
targetClass: [
177+
["l1_all", "l2_all", "l3_all", "s1_all", "s2_all", "s3_all"],
178+
["l1_all", "l2_all", "l3_all", "s1_all", "s2_all", "s3_all"],
179+
],
180+
importance: [[], []],
181+
shortenedCategory: "総合A",
182+
shortenedEvaluation: "レポ",
183+
shortenedClassroom: "1232",
184+
},
99185
];
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
"use client";
2+
import { ClassDataType } from "@/app/type";
3+
import TimetableFrame from "../../Timetable/timetableFrame";
4+
import { useState } from "react";
5+
import ClassModalComponent from "../../ClassModal";
6+
7+
/**
8+
* 時間割のサンプル
9+
* @returns 時間割のサンプルコンポーネント
10+
*/
11+
const TimetableComponentSample: React.FC = () => {
12+
return (
13+
<div className="m-5 w-5/6 h-[800px] bg-surface">
14+
<TimetableFrame
15+
hasSaturday={true} // 土曜日を表示
16+
classSlotElement={ClassSlotElement} // 講義スロット内のデザイン
17+
periodSlotElement={(p) => <div>{p}</div>}
18+
daySlotElement={(d) => <div>{d}</div>}
19+
/>
20+
</div>
21+
);
22+
};
23+
24+
/**
25+
* 講義スロット内のデザイン
26+
* Timetableコンポーネントが利用する関数で、classesはTimetableにより決定される
27+
* @param classes このスロットに表示する関数
28+
* @returns スロット内の要素
29+
*/
30+
function ClassSlotElement(classes: ClassDataType[]) {
31+
const [classForModal, setClassForModal] = useState<ClassDataType>();
32+
33+
return (
34+
<>
35+
{/* スロット内の要素 */}
36+
<div className="w-full h-full flex items-center justify-center">
37+
{classes.map((c, i) => {
38+
return (
39+
<div
40+
className="flex w-full h-full items-center justify-center min-w-0 m-1"
41+
key={i}
42+
onClick={() => setClassForModal(c)}
43+
>
44+
<div className="cursor-pointer bg-secondary/10 w-full h-5/6 max-w-40">
45+
<div className="m-2 text-sm font-bold truncate">
46+
{c.titleJp}
47+
</div>
48+
<div className="m-2 text-xs text-text-default/50 text-wrap">
49+
{c.classroom}
50+
</div>
51+
</div>
52+
</div>
53+
);
54+
})}
55+
</div>
56+
57+
{/* 講義がクリックされたとき、詳細を表示 */}
58+
{classForModal && (
59+
<ClassModalComponent
60+
isOpen={true}
61+
onCloseButtonClicked={() => setClassForModal(undefined)}
62+
classData={classForModal}
63+
/>
64+
)}
65+
</>
66+
);
67+
}
68+
69+
export default TimetableComponentSample;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ClassDataType, DayPeriod } from "@/app/type";
2+
import React from "react";
3+
import { SlotDiv, slotProps } from "./slot";
4+
5+
/**
6+
* 講義が表示されるスロット要素のプロパティ
7+
*/
8+
interface classProps extends slotProps {
9+
day_period: DayPeriod | "集中"; // 曜限
10+
hasSaturday: boolean; // 土曜日表示か否か
11+
classes: ClassDataType[]; // このスロットに表示したいクラス
12+
isIntensiveClass: boolean; // このスロットが集中講義か否か
13+
classSlotElement: React.FC<ClassDataType[]>; //講義スロット内に配置する要素
14+
}
15+
16+
/**
17+
* 講義を表示するスロット
18+
* @param props 講義スロットのプロパティ
19+
* @returns 講義を表示するスロット
20+
*/
21+
export const ClassSlot: React.FC<classProps> = (props: classProps) => {
22+
let col_span = "col-span-2"; // 通常講義ならグリッドの幅は2
23+
if (props.isIntensiveClass) {
24+
// 集中講義なら、土曜日表示の場合のグリッドの幅は12、土曜日非表示の場合のグリッドの幅は10
25+
col_span = props.hasSaturday ? "col-span-12" : "col-span-10";
26+
}
27+
28+
return (
29+
<SlotDiv className={`${col_span} row-span-2 ${props.className}`}>
30+
{props.classSlotElement(props.classes)}
31+
</SlotDiv>
32+
);
33+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Day } from "@/app/type";
2+
import { SlotDiv, slotProps } from "./slot";
3+
import React from "react";
4+
5+
/**
6+
* 曜日が表示されるスロット要素のプロパティ
7+
*/
8+
interface dayProps extends slotProps {
9+
day: Day;
10+
daySlotElement: React.FC<Day>;
11+
}
12+
13+
/**
14+
* 曜日スロット要素
15+
* @param props 曜日スロット要素のプロパティ
16+
* @returns 曜日スロット要素
17+
*/
18+
export const DaySlot: React.FC<dayProps> = (props: dayProps) => {
19+
return (
20+
<SlotDiv className="col-span-2 row-span-1">
21+
{props.daySlotElement(props.day)}
22+
</SlotDiv>
23+
);
24+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Period, SlotDiv, slotProps } from "./slot";
2+
3+
/**
4+
* 時限が表示されるスロット要素のプロパティ
5+
*/
6+
interface periodProps extends slotProps {
7+
period: Period | "集中";
8+
periodSlotElement: React.FC<Period | "集中">;
9+
}
10+
11+
/**
12+
* 時限スロット要素
13+
* @param props 時限スロット要素のプロパティ
14+
* @returns 時限スロット要素
15+
*/
16+
export const PeriodSlot: React.FC<periodProps> = (props: periodProps) => {
17+
return (
18+
<SlotDiv className="col-span-1 row-span-2">
19+
{props.periodSlotElement(props.period)}
20+
</SlotDiv>
21+
);
22+
};

0 commit comments

Comments
 (0)