Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankFang committed Aug 5, 2019
1 parent 7c8eae4 commit 4cb882d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 36 deletions.
12 changes: 11 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions public/db/events-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name: 2020全栈体系课阶段一开班
start: 2019-08-03T20:30:00.00+08:00
end: 2019-08-03T22:30:00.00+08:00
urls:
- name: 直播
url: xxxx
- name: 录播
url: yyy
creator: 方方
- id: 2
name: git入门 - 软件安装&文件相关命令行
Expand Down
65 changes: 33 additions & 32 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
<head>
<meta charset="utf-8"/>
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"/>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
<meta name="theme-color" content="#000000"/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"/>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>日程安排</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>日程安排</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
4 changes: 4 additions & 0 deletions src/App/App.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
.p
padding: 0 16px 8px 16px
color: #aaa
.footer
padding: 8px 16px
font-size: 10px
color: #999
5 changes: 4 additions & 1 deletion src/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ const App: React.FC = () => {
}, []);
return (
<div className={styles.wrapper}>
<h1 className={styles.h1}>课程表(建议收藏)</h1>
<h1 className={styles.h1}>课程表 - 建议收藏</h1>
<p className={styles.p}>小圆点表示有课程</p>
<Calendar events={events} value={date} onChange={setDate}/>
<EventList title={`${new Date2(date).toString('M月d日')}的安排`} events={selectedEvents()}/>
<footer className={styles.footer}>本页面使用 React 构建,源代码托管于 &nbsp;
<a href="https://github.com/FrankFang/gnomon" target="_blank">FrankFang/gnomon</a>
</footer>
</div>
);
};
Expand Down
5 changes: 3 additions & 2 deletions src/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface CalendarEvent {
name: string;
description: string;
creator: string;
url: string;
urls: { name: string; url: string; }[];
start: CalendarEventTime;
end: CalendarEventTime;
allDay: true;
Expand All @@ -31,8 +31,9 @@ const Calendar: React.FC<Props> = ({firstDayOfWeek = 1, events, value, onChange}
const [currentTime, setCurrentTime] = useState(new Date2(value));
const firstDayOfCurrentMonth = currentTime.day(1);
const weekday = firstDayOfCurrentMonth.weekday();
const mustBePositive = (n: number) => n >= 0 ? n : n + 7;
const firstDayOfCurrentView = firstDayOfCurrentMonth.day(
firstDayOfCurrentMonth.day() - (weekday - firstDayOfWeek));
firstDayOfCurrentMonth.day() - mustBePositive(weekday - firstDayOfWeek));
const eventsHappenedOn = (date: Date2) => {
return events.filter((e) =>
new Date2(e.start).isSameDayAs(date) ||
Expand Down
3 changes: 3 additions & 0 deletions src/EventList/EventList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const EventList: React.FC<Props> = ({events, title}) => {
<div className={styles.name}>
{e.name}
</div>
{e.urls && <div className={styles.url}>
{e.urls.map(item => item.name)}
</div>}
<div className={styles.details}>
<span className={styles.creator}>
{e.creator}
Expand Down
2 changes: 2 additions & 0 deletions src/global.sass
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ button
padding: 4px 8px
h1, h2, h3, h4, h5, h6
font-weight: normal
a
color: #FF6600

0 comments on commit 4cb882d

Please sign in to comment.