-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
130 lines (121 loc) · 3.26 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const choo = require('choo')
const html = require('choo/html')
const config = require('./config.json')
const ToolbarController = require('./controllers/toolbar.js')
const MonthlyController = require('./controllers/monthly.js')
const WeeklyController = require('./controllers/weekly.js')
const DailyController = require('./controllers/daily.js')
const EventController = require('./controllers/event.js')
const DateChangeController = require('./controllers/date-changed.js')
const FeedsController = require('./controllers/feeds.js')
const TouchController = require('./controllers/touch.js')
const MonthlyView = require('./views/monthly.js')
const WeeklyView = require('./views/weekly.js')
const DailyView = require('./views/daily.js')
const EventView = require('./views/event.js')
const app = choo()
app.use((state, emitter) => {
state.allEvents = []
})
app.use(ToolbarController)
app.use(MonthlyController)
app.use(WeeklyController)
app.use(DailyController)
app.use(EventController)
app.use(DateChangeController)
app.use(FeedsController(config))
app.use(TouchController)
app.route('/', renderApp(MonthlyView))
app.route('/weekly', renderApp(WeeklyView))
app.route('/daily', renderApp(DailyView))
app.route('/event', renderApp(EventView))
app.route('/404', notFound)
app.route('/*', notFound)
function renderApp (View) {
return function (state, emit) {
// TODO hardcoded colors for now -> should use theme
return html`<body>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
svg {
fill: grey;
}
svg:hover {
fill: white;
}
body {
border: 0px solid green;
min-height: 100vh;
overflow: hidden;
font-family: monospace;
background: black;
color: white;
}
a {
text-decoration: none;
}
table {
display: flex;
position: absolute;
top: 50px;
bottom: 0;
left: 0;
right: 0;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 10px;
}
tbody {
width: 100%;
display: flex;
flex-direction: column;
/* Firefox */
scrollbar-width: thin;
scrollbar-color: grey black;
}
/* Chrome, Edge, and Safari */
tbody::-webkit-scrollbar {
width: 3px;
}
/* Chrome, Edge, and Safari */
tbody::-webkit-scrollbar-track {
background: black;
}
/* Chrome, Edge, and Safari */
tbody::-webkit-scrollbar-thumb {
background-color: grey;
border-radius: 20px;
}
th {
border-right: 1px dashed grey;
border-bottom: 1px dashed grey;
}
th:last-child, td:last-child {
border-right: 0px;
}
td {
border-right: 1px dashed grey;
border-bottom: 1px dashed grey;
}
tr:last-child td {
border-bottom: 0px;
}
</style>
${View(state, emit)}
</body>`
}
}
app.mount(document.body)
function notFound () {
return html`
<body>
<a href="/">
Route not found. Navigate back.
</a>
</body>
`
}