git ssb

2+

mixmix / ticktack



Tree: aae76c66fea3fd35f5110467b6f2b7ea69dd5a8e

Files: aae76c66fea3fd35f5110467b6f2b7ea69dd5a8e / ftu / app.js

1859 bytesRaw
1const { h, Value } = require('mutant')
2const nest = require('depnest')
3const path = require('path')
4const { remote } = require('electron')
5const insertCss = require('insert-css')
6const values = require('lodash/values')
7const electron = require('electron')
8
9
10exports.gives = nest('ftu.app')
11
12exports.needs = nest({
13 'styles.css': 'reduce',
14 'translations.sync.strings': 'first'
15})
16
17exports.create = (api) => {
18 return nest({
19 'ftu.app': function app() {
20
21 const css = values(api.styles.css()).join('\n')
22 insertCss(css)
23
24 var app = h('App', [
25 h('Header', [
26 windowControls()
27 ]),
28 h('Page -ftu', [
29 h('div.content', [
30 h('h1', 'Welcome to Ticktack'),
31 h('p', 'Do you want to create a new identity or import one?'),
32 h('section', [
33 h('div.left', h('Button', 'Import identity')),
34 h('div.right', h('Button', { 'ev-click': () => actionCreateNewOne() }, 'Create a new one'))
35 ])
36 ])
37 ])
38 ])
39
40 return app
41 }
42
43 })
44
45}
46
47function actionCreateNewOne() {
48 electron.ipcRenderer.send('create-new-identity')
49}
50
51function windowControls() {
52 if (process.platform === 'darwin') return
53
54 const window = remote.getCurrentWindow()
55 const minimize = () => window.minimize()
56 const maximize = () => {
57 if (!window.isMaximized()) window.maximize()
58 else window.unmaximize()
59 }
60 const close = () => window.close()
61
62 return h('div.window-controls', [
63 h('img.min', {
64 src: assetPath('minimize.png'),
65 'ev-click': minimize
66 }),
67 h('img.max', {
68 src: assetPath('maximize.png'),
69 'ev-click': maximize
70 }),
71 h('img.close', {
72 src: assetPath('close.png'),
73 'ev-click': close
74 })
75 ])
76}
77
78
79function assetPath(name) {
80 return path.join(__dirname, '../assets', name)
81}
82

Built with git-ssb-web