Skip to content

Commit 5f99ab0

Browse files
authored
Merge pull request #11 from 4geru/refactor-event-list
Refactor event list
2 parents 6ee7c29 + 3e8b791 commit 5f99ab0

File tree

1 file changed

+45
-103
lines changed

1 file changed

+45
-103
lines changed

components/EventList.tsx

Lines changed: 45 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,6 @@
11
/** @format */
22
import detailsStyle from '../styles/details.module.css'
33

4-
export type EventType = {
5-
title: string
6-
detail: string
7-
date?: 'Day 1' | 'Day 2' | 'Day 3'
8-
id: string
9-
}
10-
11-
// TODO: detailの日時・場所をのフォーマット統一させる
12-
export const Events: EventType[] = [
13-
{
14-
title: '立命合宿 2019',
15-
date: 'Day 1',
16-
detail: '3/5 - 3/7 立命館大学 BKC にて合宿を開催.',
17-
id: 'rupc2019'
18-
},
19-
{
20-
title: '会津合宿 2018',
21-
date: 'Day 1',
22-
detail: '会津大学 9/19 - 9/21 に行われた合宿に参加しました.',
23-
id: 'acpc2018'
24-
},
25-
{
26-
title: '立命合宿 2018',
27-
date: 'Day 1',
28-
detail: '3/26 - 3/28 立命館大学 BKC にて合宿を開催.',
29-
id: 'rupc2018'
30-
},
31-
{
32-
title: '会津合宿 2017',
33-
date: 'Day 1',
34-
detail: '会津大学にて 9/18 - 9/20 に行われた合宿に参加しました.',
35-
id: 'acpc2017'
36-
},
37-
{
38-
title: '立命合宿 2017',
39-
date: 'Day 1',
40-
detail: '3/22 - 3/24 立命館大学 BKC にて合宿を開催しました.',
41-
id: 'rupc2017'
42-
},
43-
{
44-
title: '会津合宿 2016',
45-
date: 'Day 1',
46-
detail: '会津大学にて 9/17 - 9/19 に行われた合宿に参加しました.',
47-
id: 'acpc2016'
48-
},
49-
{
50-
title: '立命合宿 2016',
51-
date: 'Day 1',
52-
detail: '3/6 - 3/8 立命館大学 BKC にて合宿を開催しました.',
53-
id: 'rupc2016'
54-
},
55-
{
56-
title: '会津合宿 2015',
57-
date: 'Day 1',
58-
detail: '会津大学にて 9/21 - 9/23 に行われた合宿に参加しました.',
59-
id: 'acpc2015'
60-
},
61-
{
62-
title: '立命合宿 2015',
63-
date: 'Day 1',
64-
detail: '3/14 - 3/16 立命館大学 BKC にて合宿を開催しました.',
65-
id: 'rupc2015'
66-
},
67-
{
68-
title: '立命合宿 2013',
69-
date: 'Day 3',
70-
detail: '3/11 - 3/13 立命館大学 BKC にて合宿を開催しました.',
71-
id: 'rupc2013'
72-
},
73-
{
74-
title: '会津合宿 2012',
75-
date: 'Day 1',
76-
detail: '会津大学にて9/3 - 9/5に行われた合宿に参加しました.',
77-
id: 'acpc2012'
78-
},
79-
{
80-
title: '立命合宿 2012',
81-
date: 'Day 3',
82-
detail: '3/13 - 3/15 立命館大学 BKC にて合宿を開催しました.',
83-
id: 'rupc2012'
84-
},
85-
{
86-
title: '立命館プログラミングコンテスト2011',
87-
detail: '10/15 立命館大学 BKC にてコンテストを開催しました.',
88-
id: 'rupc2011'
89-
}
90-
]
91-
924
type problemSetType = {
935
college: string
946
link: string
@@ -119,7 +31,7 @@ export type EventDetailType = {
11931
judge?: string
12032
iodata?: JSX.Element
12133
schedule?: JSX.Element
122-
place?: string
34+
place: string
12335
otherContent?: otherContentType[]
12436
}
12537

@@ -158,7 +70,8 @@ export const EventDetails: EventDetailsType = {
15870
{ title: 'E: LISum', link: 'E.pdf' },
15971
{ title: 'F: Absum', link: 'F.pdf' },
16072
{ title: 'G: イルミネーション', link: 'G.pdf' }
161-
]
73+
],
74+
place: '立命館大学 BKC'
16275
},
16376
acpc2018: {
16477
title: '会津合宿 2018',
@@ -192,7 +105,8 @@ export const EventDetails: EventDetailsType = {
192105
{ title: 'F: Swap', link: 'F.pdf' },
193106
{ title: 'G: 式の切り取り', link: 'G.pdf' },
194107
{ title: 'H: 板', link: 'H.pdf' }
195-
]
108+
],
109+
place: '会津大学'
196110
},
197111
rupc2018: {
198112
title: '立命合宿 2018',
@@ -225,7 +139,8 @@ export const EventDetails: EventDetailsType = {
225139
{ title: 'E: いたずらされたグラフ', link: 'E.pdf' },
226140
{ title: 'F: ごちうさ数', link: 'F.pdf' },
227141
{ title: 'G: エレベータ', link: 'G.pdf' }
228-
]
142+
],
143+
place: '立命館大学 BKC'
229144
},
230145
acpc2017: {
231146
title: '会津合宿 2017',
@@ -248,7 +163,8 @@ export const EventDetails: EventDetailsType = {
248163
{ title: 'E: 敵襲から守れ', link: 'E.pdf' },
249164
{ title: 'F: 階段', link: 'F.pdf' },
250165
{ title: 'G: 鍵', link: 'G.pdf' }
251-
]
166+
],
167+
place: '会津大学'
252168
},
253169
rupc2017: {
254170
title: '立命合宿 2017',
@@ -276,7 +192,8 @@ export const EventDetails: EventDetailsType = {
276192
{ title: 'I: Islands Survival', link: 'I.pdf' },
277193
{ title: 'J: エナジードリンク', link: 'J.pdf' },
278194
{ title: 'K: AORイカちゃんの成績', link: 'K.pdf' }
279-
]
195+
],
196+
place: '立命館大学 BKC'
280197
},
281198
acpc2016: {
282199
title: '会津合宿 2016',
@@ -300,7 +217,8 @@ export const EventDetails: EventDetailsType = {
300217
{ title: 'E: 札', link: 'E.pdf' },
301218
{ title: 'F: 紙の折りたたみ', link: 'F.pdf' },
302219
{ title: 'G: DAGトリオ(Hard)', link: 'G.pdf' }
303-
]
220+
],
221+
place: '会津大学'
304222
},
305223
rupc2016: {
306224
title: '立命合宿 2016',
@@ -323,7 +241,8 @@ export const EventDetails: EventDetailsType = {
323241
{ title: 'F: リレー', link: 'F.pdf' },
324242
{ title: '別解', link: 'F_tm.pdf' },
325243
{ title: 'G: 塗るだけ', link: 'G.pdf' }
326-
]
244+
],
245+
place: '立命館大学 BKC'
327246
},
328247
acpc2015: {
329248
title: '会津合宿 2015',
@@ -332,7 +251,6 @@ export const EventDetails: EventDetailsType = {
332251
begin: '2015/9/21',
333252
end: '2015/9/23'
334253
},
335-
detailURL: '',
336254
problemSet: [
337255
{ college: 'Day1(立命館大学)', link: '' },
338256
{ college: 'Day2(会津大学)', link: '' },
@@ -345,7 +263,8 @@ export const EventDetails: EventDetailsType = {
345263
{ title: 'D: 市松模様', link: 'D.pdf' },
346264
{ title: 'E: 台風', link: 'E.pdf' },
347265
{ title: 'F: 卵', link: 'F.pdf' }
348-
]
266+
],
267+
place: '会津大学'
349268
},
350269
rupc2015: {
351270
title: '立命合宿 2015',
@@ -372,7 +291,7 @@ export const EventDetails: EventDetailsType = {
372291
],
373292
picture: 'rupc2015.png',
374293
judge: 'http://judge.u-aizu.ac.jp/onlinejudge/index.jsp',
375-
place: '立命館大学BKC',
294+
place: '立命館大学 BKC',
376295
schedule: (
377296
<table className={detailsStyle.table}>
378297
<thead>
@@ -451,7 +370,6 @@ export const EventDetails: EventDetailsType = {
451370
begin: '2013/3/11',
452371
end: '2013/3/13'
453372
},
454-
detailURL: 'http://kokucheese.com/event/index/72089',
455373
problemSet: [
456374
{ college: 'Day1(会津大学)', link: '' },
457375
{ college: 'Day2(大阪大学)', link: '' },
@@ -467,7 +385,7 @@ export const EventDetails: EventDetailsType = {
467385
{ title: 'G: Computer Onesan', link: '' }
468386
],
469387
judge: 'http://judge.u-aizu.ac.jp/onlinejudge/index.jsp',
470-
place: '立命館大学',
388+
place: '立命館大学 BKC',
471389
schedule: (
472390
<table className={detailsStyle.table}>
473391
<thead>
@@ -555,7 +473,8 @@ export const EventDetails: EventDetailsType = {
555473
{ title: 'E: マークアップ言語は衰退しました', link: 'E.pdf' },
556474
{ title: 'F: 透明な麻雀牌', link: 'F.pdf' },
557475
{ title: 'G: コードアートオンライン', link: 'G.pdf' }
558-
]
476+
],
477+
place: '会津大学'
559478
},
560479
rupc2012: {
561480
title: '立命合宿 2012',
@@ -578,7 +497,8 @@ export const EventDetails: EventDetailsType = {
578497
{ title: 'E: Elevator', link: 'D.pdf' },
579498
{ title: 'F: Icy Composer', link: 'E.pdf' },
580499
{ title: 'G: Satan Attacks', link: 'F.pdf' }
581-
]
500+
],
501+
place: '立命館大学 BKC'
582502
},
583503
rupc2011: {
584504
title: '立命館プログラミングコンテスト2011',
@@ -604,6 +524,7 @@ export const EventDetails: EventDetailsType = {
604524
{ title: '問題H: Oh, My Goat!', link: 'H.pdf' },
605525
{ title: '問題I: カスタムペイント職人', link: 'I.pdf' }
606526
],
527+
place: '立命館大学 BKC',
607528
iodata: (
608529
<a href="dataset.zip" download>
609530
データセット
@@ -612,3 +533,24 @@ export const EventDetails: EventDetailsType = {
612533
writer: ['shirokurostone', 'kioa341', 'slip0110', 'epee_noir', 'Respect2D', '_shnyh']
613534
}
614535
}
536+
537+
export type EventType = {
538+
title: string
539+
detail: string
540+
date?: 'Day 1' | 'Day 2' | 'Day 3'
541+
id: string
542+
}
543+
544+
export const Events: EventType[] = Object.keys(EventDetails).map((id) => {
545+
const event: EventDetailType = EventDetails[id]
546+
const date = event.date?.begin && event.date?.end ? `${event.date.begin} - ${event.date.end}` : event.date?.begin
547+
const detail = event.place.includes('立命')
548+
? `${event.place} にて ${date} 合宿を開催しました.`
549+
: `${event.place} にて ${date} 合宿に参加しました.`
550+
return {
551+
title: event.title,
552+
detail: detail,
553+
date: event.day,
554+
id: id
555+
}
556+
})

0 commit comments

Comments
 (0)