This repository has been archived by the owner on Jan 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,815 additions
and
14 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
@import url(//fonts.googleapis.com/earlyaccess/notosanskr.css); | ||
|
||
.timetable { | ||
padding: 0px; | ||
border-top-width: 0; | ||
table-layout: fixed; | ||
background-color: #ffffff; | ||
color: rgba(0, 0, 0, 0.4) !important; | ||
font-family: 'Noto Sans KR', sans-serif; | ||
font-size: 14px; | ||
|
||
td { | ||
width: 100px; | ||
height:20px; | ||
position: relative; | ||
} | ||
|
||
.label-date { | ||
border: none; | ||
text-align: center; | ||
font-weight: normal; | ||
height: 40px; | ||
} | ||
|
||
.label-hour { | ||
border: none; | ||
width: 45px; | ||
text-align: right; | ||
padding: 0 7px 0 0; | ||
} | ||
|
||
tbody tr:nth-child(odd) .td-body { | ||
border-top: 1px solid #ebeef2; | ||
} | ||
|
||
tbody tr:last-child .td-body { | ||
border-bottom: 1px solid #ebeef2; | ||
} | ||
|
||
tbody tr:nth-child(even) .td-body { | ||
border-top: 1px solid rgba(235, 238, 242, 0.3); //ebeef2 * 0.3 opacity | ||
} | ||
|
||
.td-body { | ||
height: 20px; | ||
border: none; | ||
} | ||
|
||
.blank-right { | ||
width: 15px; | ||
border: none !important | ||
} | ||
|
||
.dragged { | ||
background-color: red | ||
} | ||
|
||
.course-div { | ||
background-color: pink; | ||
height:100%; | ||
position: absolute; top: -1px; left: 0px; | ||
width:100%; | ||
border-radius: 0px; | ||
z-index: 1; | ||
padding: 0 2px; | ||
text-align: center; | ||
.title-box { | ||
position: relative; | ||
transform: translateY(-50%); | ||
top: 50%; | ||
font-size: 0.7em; | ||
line-height: 1em; | ||
} | ||
.title-box p { | ||
margin-bottom: 3px; | ||
} | ||
|
||
.tool-box-wrapper { | ||
visibility: hidden; | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: 0px; | ||
right: 0px; | ||
font-size: 20px; | ||
background-color: rgba(0, 0, 0, 0.65); | ||
} | ||
.tool-box { | ||
position: relative; | ||
transform: translateY(-50%); | ||
top: 50%; | ||
span { margin: 0 5px; } | ||
} | ||
&.hovered .tool-box-wrapper { | ||
visibility: visible; | ||
} | ||
} | ||
|
||
.preview { | ||
background-color: #D7DEE0 !important; | ||
color: gray !important; | ||
z-index: 2; | ||
opacity: 0.5; | ||
} | ||
|
||
.table-info { | ||
position: relative; | ||
font-size: 13px; | ||
} | ||
|
||
.add-button { | ||
float: left; | ||
border-radius: 17px; | ||
height: 34px; | ||
opacity: 0.8; | ||
border: 1px solid #b7c3ce; | ||
} | ||
|
||
.credit { | ||
float: right; | ||
font-size: 13px; | ||
} | ||
} | ||
#timetable-container { | ||
background-color: #ffffff; | ||
margin-bottom: 40px; | ||
} | ||
.table-info { | ||
|
||
padding: 0px 15px 15px 15px; | ||
overflow: hidden; | ||
vertical-align: middle; | ||
|
||
.add-button { | ||
margin-left: 30px; | ||
border-radius: 500px; | ||
border: solid 1px #d5dbe0; | ||
padding: 7px 17px; | ||
font-size: 13px; | ||
float: left; | ||
cursor: pointer; | ||
} | ||
|
||
.credit { | ||
float: right; | ||
padding: 7px 0px; | ||
font-size: 13px; | ||
} | ||
} | ||
|
||
.timetable { | ||
margin-bottom: 15px; | ||
} | ||
|
||
.timetable * { | ||
-webkit-touch-callout: none; /* iOS Safari */ | ||
-webkit-user-select: none; /* Chrome/Safari/Opera */ | ||
-khtml-user-select: none; /* Konqueror */ | ||
-moz-user-select: none; /* Firefox */ | ||
-ms-user-select: none; /* IE/Edge */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "Timetable.scss" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import Timetable from './timetable/Timetable.jsx'; | ||
|
||
const FullscreenTimetable = ({ timetable }) => { | ||
return ( | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, user-scalable=no" /> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" | ||
crossorigin="anonymous" /> | ||
<link rel="stylesheet" href="" /> | ||
</head> | ||
|
||
<body> | ||
<Timetable | ||
courses={timetable.lecture_list} | ||
/> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
export default FullscreenTimetable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
const DEFAULT_COLOR = { fg: '#1579C2', bg: '#94E6FE' }; | ||
|
||
const LectureBox = ({ length, course, classroom }) => { | ||
if (!course.color) { course.color = DEFAULT_COLOR; } | ||
const divStyle = { | ||
height: `${length * 20}px`, | ||
color: course.color.fg, | ||
backgroundColor: course.color.bg, | ||
}; | ||
return ( | ||
<div | ||
className={`course-div`} | ||
style={divStyle} | ||
> | ||
<div className="title-box"> | ||
<p>{course.course_title}</p> | ||
<p><strong>{classroom}</strong></p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LectureBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
const TableBody = ({ lectureBoxes, hasSunday }) => { | ||
const rows = []; | ||
const numDay = hasSunday ? 7 : 6; | ||
const numRows = lectureBoxes[0].length; | ||
for (let t = 0; t < numRows; t += 1) { // rows | ||
const cols = []; | ||
if (t % 2 === 0) { | ||
const hrIdx = t / 2; | ||
cols.push(<td className="label-hour" rowSpan="2" key={-1}>{hrIdx + 8}</td>); | ||
} | ||
for (let d = 0; d < numDay; d += 1) { // columns | ||
cols.push(( | ||
<td className="td-body" key={`${d}{t}`}> | ||
{lectureBoxes[d][t]} | ||
</td> | ||
)); | ||
} | ||
rows.push(<tr key={t}>{cols}</tr>); | ||
} | ||
return (<tbody>{rows}</tbody>); | ||
}; | ||
|
||
export default TableBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
|
||
const TableHeader = ({ hasSunday }) => { | ||
const days = ['월', '화', '수', '목', '금', '토']; | ||
if (hasSunday) days.push('일'); | ||
return ( | ||
<thead> | ||
<tr> | ||
<th className="label-hour" /> | ||
{days.map(v => (<th className="label-date" key={v}>{v}</th>))} | ||
<th className="label-date blank-right" /> | ||
</tr> | ||
</thead> | ||
); | ||
}; | ||
|
||
export default TableHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
|
||
import LectureBox from './LectureBox.jsx'; | ||
import TableHeader from './TableHeader.jsx'; | ||
import TableBody from './TableBody.jsx'; | ||
|
||
const NUM_SLOTS = 32; | ||
const NUM_DAY = 7; | ||
|
||
const Timetable = ({ courses }) => { | ||
const lectureBoxes = new Array(NUM_DAY).fill(0).map(() => new Array(NUM_SLOTS)); | ||
for (const course of courses) { | ||
for (const lecture of course.class_time_json) { | ||
const day = lecture.day; | ||
lectureBoxes[day][lecture.start * 2] = ( | ||
<LectureBox | ||
course={course} | ||
length={lecture.len * 2} | ||
classroom={lecture.place} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
let hasSunday = lectureBoxes[6].filter(v => Boolean(v)).length > 0; | ||
|
||
return ( | ||
<div id="container-fluid"> | ||
<table className="table timetable"> | ||
<TableHeader hasSunday={hasSunday} /> | ||
<TableBody | ||
hasSunday={hasSunday} | ||
lectureBoxes={lectureBoxes} | ||
/> | ||
</table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Timetable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters