forked from lichess-org/lichobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
related.ts
43 lines (35 loc) · 877 Bytes
/
related.ts
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
import h from 'mithril/hyperscript'
import { safeStringToNum } from '../../../utils'
import * as helper from '../../helper'
import layout from '../../layout'
import { dropShadowHeader, backButton } from '../../shared/common'
import RelatedCtrl from './RelatedCtrl'
import { renderBody } from './relatedView'
import i18n from '../../../i18n'
interface Attrs {
id: string
tab?: string
username?: string
title?: string
}
interface State {
ctrl: RelatedCtrl
}
export default {
oncreate: helper.viewFadeIn,
oninit(vnode) {
this.ctrl = new RelatedCtrl(
vnode.attrs.id,
safeStringToNum(vnode.attrs.tab)
)
},
view() {
const name = h('div.title', [
h('span', i18n('friends'))
])
return layout.free(
dropShadowHeader(null, backButton(name)),
renderBody(this.ctrl)
)
}
} as Mithril.Component<Attrs, State>