summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/views/pages/welcome.vue
blob: cac4007b40983192145e83b690e5b78ec6ae97b4 (plain)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<template>
<div class="mk-welcome">
	<img ref="pointer" class="pointer" src="/assets/pointer.png" alt="">
	<button @click="dark">
		<template v-if="$store.state.device.darkmode">%fa:moon%</template>
		<template v-else>%fa:R moon%</template>
	</button>
	<div class="body" :style="{ backgroundImage: `url('${ welcomeBgUrl }')` }">
		<div class="container">
			<div class="info">
				<span>%i18n:common.misskey% <b>{{ host }}</b></span>
				<span class="stats" v-if="stats">
					<span>%fa:user% {{ stats.originalUsersCount | number }}</span>
					<span>%fa:pencil-alt% {{ stats.originalNotesCount | number }}</span>
				</span>
			</div>
			<main>
				<div class="about">
					<h1 v-if="name">{{ name }}</h1>
					<h1 v-else><img :src="$store.state.device.darkmode ? 'assets/title.dark.svg' : 'assets/title.light.svg'" alt="Misskey"></h1>
					<p class="powerd-by" v-if="name">powerd by <b>Misskey</b></p>
					<p class="desc" v-html="description || '%i18n:common.about%'"></p>
					<a ref="signup" @click="signup">📦 %i18n:@signup%</a>
				</div>
				<div class="login">
					<mk-signin/>
				</div>
			</main>
			<div class="hashtags">
				<router-link v-for="tag in tags" :key="tag" :to="`/tags/${ tag }`" :title="tag">#{{ tag }}</router-link>
			</div>
			<mk-nav class="nav"/>
		</div>
		<mk-forkit class="forkit"/>
		<img src="assets/title.dark.svg" alt="Misskey">
	</div>
	<div class="tl">
		<mk-welcome-timeline :max="20"/>
	</div>
	<modal name="signup" width="500px" height="auto" scrollable>
		<header :class="$style.signupFormHeader">%i18n:@signup%</header>
		<mk-signup :class="$style.signupForm"/>
	</modal>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
import { host, name, description, copyright, welcomeBgUrl } from '../../../config';

export default Vue.extend({
	data() {
		return {
			stats: null,
			copyright,
			welcomeBgUrl,
			host,
			name,
			description,
			pointerInterval: null,
			tags: []
		};
	},
	created() {
		(this as any).api('stats').then(stats => {
			this.stats = stats;
		});

		(this as any).api('hashtags/trend').then(stats => {
			this.tags = stats.map(x => x.tag);
		});
	},
	mounted() {
		this.point();
		this.pointerInterval = setInterval(this.point, 100);
	},
	beforeDestroy() {
		clearInterval(this.pointerInterval);
	},
	methods: {
		point() {
			const x = this.$refs.signup.getBoundingClientRect();
			this.$refs.pointer.style.top = x.top + x.height + 'px';
			this.$refs.pointer.style.left = x.left + 'px';
		},
		signup() {
			this.$modal.show('signup');
		},
		signin() {
			this.$modal.show('signin');
		},
		dark() {
			this.$store.commit('device/set', {
				key: 'darkmode',
				value: !this.$store.state.device.darkmode
			});
		}
	}
});
</script>

<style>
#wait {
	right: auto;
	left: 15px;
}
</style>

<style lang="stylus" scoped>
@import '~const.styl'

root(isDark)
	display flex
	min-height 100vh

	> .pointer
		display block
		position absolute
		z-index 1
		top 0
		right 0
		width 180px
		margin 0 0 0 -180px
		transform rotateY(180deg) translateX(-10px) translateY(-48px)
		pointer-events none

	> button
		position fixed
		z-index 1
		top 0
		left 0
		padding 16px
		font-size 18px
		color #fff

		display none // TODO

	> .body
		flex 1
		padding 64px 0 0 0
		text-align center
		background #578394
		background-position center
		background-size cover

		&:before
			content ''
			display block
			position absolute
			top 0
			left 0
			right 0
			bottom 0
			background rgba(#000, 0.5)

		> .forkit
			position absolute
			top 0
			right 0

		> img
			position absolute
			bottom 16px
			right 16px
			width 150px

		> .container
			$aboutWidth = 380px
			$loginWidth = 340px
			$width = $aboutWidth + $loginWidth

			> .info
				margin 0 auto 16px auto
				width $width
				font-size 14px
				color #fff

				> .stats
					margin-left 16px
					padding-left 16px
					border-left solid 1px #fff

					> *
						margin-right 16px

			> main
				display flex
				margin auto
				width $width
				border-radius 8px
				overflow hidden
				box-shadow 0 2px 8px rgba(#000, 0.3)

				> .about
					width $aboutWidth
					color #444
					background #fff

					> h1
						margin 0 0 16px 0
						padding 32px 32px 0 32px
						color #444

						> img
							width 170px
							vertical-align bottom

					> .powerd-by
						margin 16px
						opacity 0.7

					> .desc
						margin 0
						padding 0 32px 16px 32px

					> a
						display inline-block
						margin 0 0 32px 0
						font-weight bold

				> .login
					width $loginWidth
					padding 16px 32px 32px 32px
					background isDark ? #2e3440 : #f5f5f5

			> .hashtags
				margin 16px auto
				width $width
				font-size 14px
				color #fff
				background rgba(#000, 0.3)
				border-radius 8px

				> *
					display inline-block
					margin 14px

			> .nav
				display block
				margin 16px 0
				font-size 14px
				color #fff

	> .tl
		margin 0
		width 410px
		height 100vh
		text-align left
		background isDark ? #313543 : #fff

		> *
			max-height 100%
			overflow auto

.mk-welcome[data-darkmode]
	root(true)

.mk-welcome:not([data-darkmode])
	root(false)

</style>

<style lang="stylus" module>
.signupForm
	padding 24px 48px 48px 48px

.signupFormHeader
	padding 48px 0 12px 0
	margin: 0 48px
	font-size 1.5em
	color #777
	border-bottom solid 1px #eee

.signinForm
	padding 24px 48px 48px 48px

.signinFormHeader
	padding 48px 0 12px 0
	margin: 0 48px
	font-size 1.5em
	color #777
	border-bottom solid 1px #eee

.nav
	a
		color #666
</style>