app/page/statsShow.jsView |
---|
11 | 11 | |
12 | 12 | exports.needs = nest({ |
13 | 13 | 'sbot.obs.connection': 'first', |
14 | 14 | 'history.sync.push': 'first', |
15 | | - 'message.html.markdown': 'first' |
| 15 | + 'message.html.markdown': 'first', |
| 16 | + 'translations.sync.strings': 'first' |
16 | 17 | }) |
17 | 18 | |
18 | 19 | const COMMENTS = 'comments' |
19 | 20 | const LIKES = 'likes' |
28 | 29 | exports.create = (api) => { |
29 | 30 | return nest('app.page.statsShow', statsShow) |
30 | 31 | |
31 | 32 | function statsShow (location) { |
| 33 | + const strings = api.translations.sync.strings() |
| 34 | + const t = strings.statsShow |
| 35 | + |
32 | 36 | var store = Struct({ |
33 | 37 | blogs: MutantArray([]), |
34 | 38 | comments: Dict(), |
35 | 39 | likes: Dict(), |
89 | 93 | |
90 | 94 | const page = h('Page -statsShow', [ |
91 | 95 | h('Scroller.content', [ |
92 | 96 | h('div.content', [ |
93 | | - h('h1', 'Stats'), |
| 97 | + h('h1', t.title), |
94 | 98 | h('section.totals', [COMMENTS, LIKES, SHARES].map(focus => { |
95 | 99 | return h('div', |
96 | 100 | { |
97 | 101 | classList: computed(context.focus, f => f === focus ? [focus, '-selected'] : [focus]), |
98 | 102 | 'ev-click': () => context.focus.set(focus) |
99 | 103 | }, [ |
100 | 104 | h('div.count', totalOnscreenData(focus)), |
101 | | - h('strong', focus), |
102 | | - '(30 days)' |
| 105 | + h('strong', strings[focus]), |
| 106 | + '(', |
| 107 | + t.thirtyDays, |
| 108 | + ')' |
103 | 109 | ]) |
104 | 110 | })), |
105 | 111 | h('section.graph', [ |
106 | 112 | canvas, |
107 | 113 | h('div.changeRange', [ |
108 | 114 | '< ', |
109 | | - h('a', { 'ev-click': () => howFarBack.set(howFarBack() + 1) }, 'Prev 30 days'), |
| 115 | + h('a', { 'ev-click': () => howFarBack.set(howFarBack() + 1) }, t.prevMonth), |
110 | 116 | ' | ', |
111 | 117 | when(howFarBack, |
112 | | - h('a', { 'ev-click': () => howFarBack.set(howFarBack() - 1) }, 'Next 30 days'), |
113 | | - h('span', 'Next 30 days') |
| 118 | + h('a', { 'ev-click': () => howFarBack.set(howFarBack() - 1) }, t.nextMonth), |
| 119 | + h('span', t.nextMonth) |
114 | 120 | ), |
115 | 121 | ' >' |
116 | 122 | ]) |
117 | 123 | ]), |
118 | 124 | h('table.blogs', [ |
119 | 125 | h('thead', [ |
120 | 126 | h('tr', [ |
121 | 127 | h('th.details'), |
122 | | - h('th.comments', 'Comments'), |
123 | | - h('th.likes', 'Likes'), |
124 | | - h('th.shares', 'Shares') |
| 128 | + h('th.comments', strings.comments), |
| 129 | + h('th.likes', strings.likes), |
| 130 | + h('th.shares', strings.shares) |
125 | 131 | ]) |
126 | 132 | ]), |
127 | 133 | h('tbody', map(store.blogs, BlogRow)) |
128 | 134 | ]) |