Skip to content

Commit ab3bd48

Browse files
committed
Added: active lists in homepage
Modified action bar layout
1 parent da42385 commit ab3bd48

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

controller/frame.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
height: 100px;
1515
border-top: 1px solid rgba(0,0,0,.12);
1616

17+
padding: 0 40px;
18+
19+
display: flex;
20+
align-items: center;
21+
1722
background: white;
1823

1924
-webkit-user-select: none;
2025
}
2126

2227
.title {
23-
margin-left: 40px;
2428
font-size: 32px;
2529
height: 100%;
2630
line-height: 100px;
@@ -40,7 +44,6 @@
4044
}
4145

4246
.actions {
43-
margin-right: 40px;
4447
float: right;
4548

4649
height: 100%;
@@ -161,7 +164,7 @@
161164
.counter-group {
162165
display: inline-flex;
163166
align-items: center;
164-
margin-left: 20px;
167+
flex: 1;
165168
}
166169

167170
.counter-group .material-icons {

controller/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
:search-input="searchInput"
2929
:alt-hold="altHold"
3030
:authorized="authorized"
31+
:title="title"
3132

3233
@navigate="navigate"
3334

@@ -65,7 +66,6 @@
6566
<!-- So we are using one way binding -->
6667

6768
<div class="action-bar">
68-
<div class="title" @click="navigate('home')">{{ title }}</div>
6969
<div class="counter-group">
7070
<i class="material-icons">person</i>
7171
<div class="counter">
@@ -87,6 +87,9 @@
8787
</div>
8888
</div>
8989
<div class="actions">
90+
<div class="action" @click="navigate('home')">
91+
<i class="material-icons">home</i>
92+
</div>
9093
<div class="action" @click="navigate('seats')">
9194
<i class="material-icons">event_seat</i>
9295
</div>

controller/views/home/home.html

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,44 @@
11
<div class="view">
2-
<div class="view-title">主页</div>
2+
<div class="view-title">{{ title }}</div>
33
<div class="view-pagetitle clickable" @click="navigateTo('lists')">活跃发言名单</div>
44
<div class="list inline">
55
<div class="list-item clickable"
6-
v-for="list of lists"
7-
:class="{ bold: list.timerCurrent && list.timerCurrent.active }">
6+
v-for="list of lists | filterBy activeList"
7+
:class="{ bold: list.timerCurrent && list.timerCurrent.active }"
8+
@click="viewList(list)">
9+
<div class="list-item-indicator"></div>
10+
<div class="list-item-content list-row">
11+
<div class="list-name">
12+
{{ list.name }}
13+
</div>
14+
15+
<div class="list-speakers">
16+
<div class="list-speakers-current" v-if="list.ptr < list.seats.length">{{ list.seats[list.ptr].name }}</div>
17+
<div class="list-speakers-next" v-if="list.ptr < list.seats.length - 1">{{ list.seats[list.ptr + 1].name }}</div>
18+
</div>
19+
20+
<template v-if="list.timerCurrent">
21+
<div class="list-timer-icon">
22+
<i class="material-icons">person</i>
23+
</div>
24+
<div class="timer-value-wrapper list-timer">
25+
<timer class="timer-left" :time="list.timerCurrent.left"></timer>
26+
<span class="timer-value-separator">/</span>
27+
<timer class="timer-value" :time="list.timerCurrent.value"></timer>
28+
</div>
29+
</template>
30+
31+
<template v-if="list.timerTotal && list.timerTotal.value > 0">
32+
<div class="list-timer-icon">
33+
<i class="material-icons">access_time</i>
34+
</div>
35+
<div class="timer-value-wrapper list-timer">
36+
<timer class="timer-left" :time="list.timerTotal.left"></timer>
37+
<span class="timer-value-separator">/</span>
38+
<timer class="timer-value" :time="list.timerTotal.value"></timer>
39+
</div>
40+
</template>
41+
</div>
842
</div>
943
<div class="list-item empty-hint">无活跃发言名单</div>
1044
</div>

controller/views/home/home.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const fs = require('fs');
33

44
const HomeView = Vue.extend({
55
template: fs.readFileSync(`${__dirname}/home.html`).toString('utf-8'),
6-
props: ['timers', 'votes'],
6+
props: ['timers', 'votes', 'lists', 'title'],
77

88
methods: {
99
navigateTo(dest) {
@@ -14,6 +14,10 @@ const HomeView = Vue.extend({
1414
return (list.timerCurrent && list.timerCurrent.active) || list.ptr < list.seats.length;
1515
},
1616

17+
viewList(list) {
18+
this.$dispatch('view-list', list);
19+
},
20+
1721
activeStandaloneTimer(timer) {
1822
return timer.type === 'standalone' && timer.active;
1923
},

0 commit comments

Comments
 (0)