Skip to content

Commit db0ab69

Browse files
committed
裏面実装
1 parent 9a576df commit db0ab69

File tree

3 files changed

+30
-73
lines changed

3 files changed

+30
-73
lines changed

web/app/home/components/PersonDetailedMenu.tsx

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ import { useState } from "react";
44
import { MdClose } from "react-icons/md";
55
import { MdOpenInNew } from "react-icons/md";
66
import { MdArrowBack } from "react-icons/md";
7+
import NonEditableCoursesTable from "~/components/course/NonEditableCoursesTable";
78

89
type Props = {
910
onClose: () => void;
1011
displayedUser: UserWithCoursesAndSubjects;
12+
currentUser: UserWithCoursesAndSubjects;
1113
};
1214

13-
export default function PersonDetailedMenu({ onClose, displayedUser }: Props) {
15+
export default function PersonDetailedMenu({
16+
onClose,
17+
displayedUser,
18+
currentUser,
19+
}: Props) {
1420
const [menuStatus, setMenuStatus] = useState<"detailedInfo" | "coursesTable">(
1521
"detailedInfo",
1622
);
@@ -110,19 +116,23 @@ export default function PersonDetailedMenu({ onClose, displayedUser }: Props) {
110116
</div>
111117
</div>
112118
) : (
113-
<div>
114-
<p>
115-
courses table
116-
{/* TODO: */}
117-
</p>
118-
<button
119-
type="button"
120-
className="btn btn-xs font-normal text-primary"
121-
onClick={() => setMenuStatus("detailedInfo")}
122-
>
123-
<MdArrowBack className="mr-[-4px]" />
124-
詳細情報に戻る
125-
</button>
119+
<div className="flex h-[80vh] flex-col">
120+
<div className="flex justify-end pr-2">
121+
<button
122+
type="button"
123+
className="btn btn-xs font-normal text-primary"
124+
onClick={() => setMenuStatus("detailedInfo")}
125+
>
126+
<MdArrowBack className="mr-[-4px]" />
127+
詳細情報に戻る
128+
</button>
129+
</div>
130+
<div className="flex-1 p-2 pb-6">
131+
<NonEditableCoursesTable
132+
userId={displayedUser.id}
133+
comparisonUserId={currentUser.id}
134+
/>
135+
</div>
126136
</div>
127137
)}
128138
</div>

web/app/home/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export default function Home() {
134134
setOpenDetailedMenu(false);
135135
}}
136136
displayedUser={displayedUser}
137+
currentUser={currentUser}
137138
/>
138139
)}
139140
</>

web/components/course/components/CoursesTableCore/index.tsx

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ACTIVE_DAYS, DAY_TO_JAPANESE_MAP } from "common/consts";
22
import type { Course, Day } from "common/types";
33
import { useCallback, useEffect, useState } from "react";
44
import { truncateStr } from "./lib";
5-
import styles from "./styles.module.css";
65

76
type Props =
87
| {
@@ -140,39 +139,6 @@ export default function CoursesTableCore(props: Props) {
140139
)}
141140
</div>
142141
</div>
143-
{/* <table className={styles.table}>
144-
<thead>
145-
<tr>
146-
<th />
147-
{ACTIVE_DAYS.map((activeDay) => (
148-
<th align="center" key={`header-${activeDay}`}>
149-
{DAY_TO_JAPANESE_MAP.get(activeDay as Day)}
150-
</th>
151-
))}
152-
</tr>
153-
</thead>
154-
<tbody>
155-
{rows.map((row, rowIndex) => (
156-
<tr key={`period-${rowIndex + 1}`}>
157-
<th key={`header-period-${rowIndex + 1}`}>{rowIndex + 1}</th>
158-
{ACTIVE_DAYS.map((day) => (
159-
<Cell
160-
key={`cell-${day}-${rowIndex.toString()}`}
161-
courseName={row[day]?.name ?? null}
162-
teacherName={row[day]?.teacher ?? null}
163-
isOverlapping={row[day]?.isOverlapping}
164-
isButton={props.isButton}
165-
onClick={
166-
props.isButton
167-
? () => props.onCellClick(rowIndex, day, row[day] ?? null)
168-
: undefined
169-
}
170-
/>
171-
))}
172-
</tr>
173-
))}
174-
</tbody>
175-
</table> */}
176142
</div>
177143
);
178144
}
@@ -211,8 +177,8 @@ function Cell({
211177
overflow: "hidden",
212178
display: "-webkit-box",
213179
WebkitBoxOrient: "vertical",
214-
WebkitLineClamp: 2,
215-
lineClamp: 2,
180+
WebkitLineClamp: 1,
181+
lineClamp: 1,
216182
textOverflow: "ellipsis",
217183
}}
218184
>
@@ -223,7 +189,7 @@ function Cell({
223189

224190
return (
225191
<span
226-
className={`inline-flex flex-1 items-center justify-center rounded-sm text-xs ${
192+
className={`inline-flex flex-1 items-center justify-center rounded-sm p-0.5 text-xs ${
227193
!courseName
228194
? "bg-transparent"
229195
: isOverlapping
@@ -232,31 +198,11 @@ function Cell({
232198
}`}
233199
>
234200
{isButton ? (
235-
<button
236-
type="button"
237-
className={
238-
isOverlapping
239-
? styles.overlapped
240-
: courseName
241-
? styles.enrolled
242-
: ""
243-
}
244-
onClick={onClick}
245-
>
201+
<button type="button" onClick={onClick}>
246202
{content}
247203
</button>
248204
) : (
249-
<span
250-
className={
251-
isOverlapping
252-
? styles.overlapped
253-
: courseName
254-
? styles.enrolled
255-
: ""
256-
}
257-
>
258-
{content}
259-
</span>
205+
<span className="inline-flex flex-col justify-between">{content}</span>
260206
)}
261207
</span>
262208
);

0 commit comments

Comments
 (0)