Skip to content

Commit f76867f

Browse files
committed
Merge branch 'master' into develop
2 parents 10e0f20 + ad31242 commit f76867f

File tree

3 files changed

+70
-31
lines changed

3 files changed

+70
-31
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[submodule "feeds/public/feeds"]
2-
path = feeds/public/feeds
3-
url = git@github.com:wasedatime/feeds.git
4-
branch = main
51
[submodule "apps/feeds/public/feeds"]
62
path = apps/feeds/public/feeds
73
url = https://github.com/wasedatime/feeds.git

apps/syllabus/src/components/timetable/TimeRowItem.tsx

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import React from "react";
22

33
import styled from "styled-components";
4+
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons";
5+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6+
import getSchoolIconPath from "@app/utils/get-school-icon-path";
47

58
const StyledListItem = styled("li")`
69
display: flex;
@@ -13,29 +16,61 @@ const StyledListItem = styled("li")`
1316
border-right-style: solid;
1417
`;
1518

16-
const StyledSpan = styled("span")`
17-
font-size: 1.5em;
18-
font-weight: 600;
19-
`;
19+
type OtherPeriod = {
20+
school: string;
21+
s: string | number;
22+
e: string | number;
23+
}
2024

21-
const StyledTime = styled("time")`
22-
font-size: 0.8em;
23-
`;
25+
type Period = {
26+
s: string | number;
27+
p: string | number;
28+
e: string | number;
29+
o?: OtherPeriod[]
30+
}
2431

2532
type Props = {
26-
period: {
27-
s: string | number;
28-
p: string | number;
29-
e: string | number;
30-
};
33+
period: Period;
3134
};
3235

36+
const schoolIconImage = (school: string) => (
37+
<img
38+
src={getSchoolIconPath(school, "en")}
39+
width="24px"
40+
height="24px"
41+
alt={school}
42+
className="inline"
43+
/>
44+
);
45+
46+
const OtherPeriod = ({ periods }: { periods: OtherPeriod[] }) => (
47+
<div className="pt-2">
48+
{
49+
periods.map(period => <p className="mb-2">{schoolIconImage(period.school)} {period.s} ~ {period.e}</p>)
50+
}
51+
</div>
52+
);
53+
3354
const TimeRowItem = ({ period }: Props) => {
3455
return (
3556
<StyledListItem className="text-light-text2 border-r-gray-100 dark:text-dark-text2 dark:border-r-dark-text3">
36-
<StyledTime>{period.s}</StyledTime>
37-
<StyledSpan>{period.p}</StyledSpan>
38-
<StyledTime>{period.e}</StyledTime>
57+
<time className="text-lg">{period.s}</time>
58+
{
59+
period.o ? (
60+
<div className="group relative flex justify-center">
61+
<span className="text-3xl font-semibold">{period.p}</span>
62+
<span className="text-sm font-semibold"><FontAwesomeIcon icon={faInfoCircle} size="1x" /></span>
63+
<span className="absolute left-10 bottom-0 scale-0 w-48 rounded bg-gray-500 p-2 text-2xs text-white group-hover:scale-100">
64+
<OtherPeriod periods={period.o} />
65+
</span>
66+
</div>
67+
) : (
68+
<span className="text-3xl font-semibold">
69+
{period.p}
70+
</span>
71+
)
72+
}
73+
<time className="text-lg">{period.e}</time>
3974
</StyledListItem>
4075
);
4176
};

apps/syllabus/src/components/timetable/TimeRowList.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,47 @@ const TimeRowList = ({ largestPeriod }: Props) => {
2727

2828
const periods = [
2929
{
30-
s: "0900",
30+
s: "0850",
3131
e: "1030",
3232
p: 1,
3333
},
3434
{
3535
s: "1040",
36-
e: "1210",
36+
e: "1220",
3737
p: 2,
3838
},
3939
{
40-
s: "1300",
41-
e: "1430",
40+
s: "1310",
41+
e: "1450",
4242
p: 3,
4343
},
4444
{
45-
s: "1445",
46-
e: "1615",
45+
s: "1505",
46+
e: "1645",
4747
p: 4,
4848
},
4949
{
50-
s: "1630",
51-
e: "1800",
50+
s: "1700",
51+
e: "1840",
5252
p: 5,
5353
},
5454
{
55-
s: "1815",
56-
e: "1945",
55+
s: "1855",
56+
e: "2035",
5757
p: 6,
58+
o: [
59+
{ school: "G_WBS", s: "1830", e: "2010" },
60+
{ school: "ART", s: "1810", e: "1950" },
61+
]
5862
},
5963
{
60-
s: "1955",
61-
e: "2125",
64+
s: "2045",
65+
e: "2135",
6266
p: 7,
67+
o: [
68+
{ school: "G_WBS", s: "2020", e: "2200" },
69+
{ school: "ART", s: "1955", e: "2135" },
70+
]
6371
},
6472
];
6573
const timeRows = periods

0 commit comments

Comments
 (0)