forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 12
/
welcome.vue
517 lines (430 loc) · 10.6 KB
/
welcome.vue
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<template>
<div class="mk-welcome">
<div class="banner" :style="{ backgroundImage: banner ? `url(${banner})` : null }"></div>
<button @click="dark">
<template v-if="$store.state.device.darkmode"><fa icon="moon"/></template>
<template v-else><fa :icon="['far', 'moon']"/></template>
</button>
<main>
<div class="body">
<div class="main block">
<div>
<h1 v-if="name != 'Misskey'">{{ name }}</h1>
<h1 v-else><img svg-inline src="../../../../assets/title.svg" :alt="name"></h1>
<div class="info">
<span><b>{{ host }}</b> - <span v-html="$t('powered-by-misskey')"></span></span>
<span class="stats" v-if="stats">
<span><fa icon="user"/> {{ stats.originalUsersCount | number }}</span>
<span><fa icon="pencil-alt"/> {{ stats.originalNotesCount | number }}</span>
</span>
</div>
<div class="desc" style="padding-right: 120px">
<span class="desc" v-html="description || $t('@.about')"></span>
</div>
<p class="sign">
<span class="signup" @click="signup">{{ $t('@.signup') }}</span>
<span class="divider">|</span>
<span class="signin" @click="signin">{{ $t('@.signin') }}</span>
<span class="divider">|</span>
<span class="explore" onclick="window.location.href='/explore'">Explore</span>
</p>
<img v-if="meta && meta.mascotImageUrl" :src="meta.mascotImageUrl" alt="" title="藍" class="char">
</div>
</div>
<div class="announcements block">
<header><fa icon="broadcast-tower"/> {{ $t('announcements') }}</header>
<div v-if="announcements && announcements.length > 0">
<div v-for="(announcement, i) in announcements" :key="i">
<h1 v-html="announcement.title"></h1>
<div v-html="announcement.text"></div>
</div>
</div>
</div>
<div class="photos block">
<header><fa :icon="['far', 'images']"/> {{ $t('photos') }}</header>
<div>
<div v-for="(photo, i) in photos" :key="i" :style="`background-image: url(${photo.thumbnailUrl})`"></div>
</div>
</div>
<div class="tag-cloud block">
<div>
<mk-tag-cloud/>
</div>
</div>
<div class="nav block">
<div>
<mk-nav class="nav"/>
</div>
</div>
<div class="side">
<div class="trends block">
<div>
<mk-trends/>
</div>
</div>
<div class="tl block">
<header><fa :icon="['far', 'comment-alt']"/> {{ $t('@.featured-notes') }}</header>
<div>
<mk-welcome-timeline class="tl" :max="20"/>
</div>
</div>
<div class="info block">
<header><fa icon="info-circle"/> {{ $t('info') }}</header>
<div>
<div v-if="meta" class="body">
<p>Version: <b>{{ meta.version }}</b></p>
<p>Maintainer: <b><a :href="'mailto:' + meta.maintainer.email" target="_blank">{{ meta.maintainer.name }}</a></b></p>
</div>
</div>
</div>
</div>
</div>
</main>
<modal name="about" class="about modal" width="800px" height="auto" scrollable>
<article class="fpdezooorhntlzyeszemrsqdlgbysvxq">
<h1>{{ $t('@.intro.title') }}</h1>
<p v-html="this.$t('@.intro.about')"></p>
<section>
<h2>{{ $t('@.intro.features') }}</h2>
<section>
<div class="body">
<h3>{{ $t('@.intro.rich-contents') }}</h3>
<p v-html="this.$t('@.intro.rich-contents-desc')"></p>
</div>
<div class="image"><img src="/assets/about/post.png" alt=""></div>
</section>
<section>
<div class="body">
<h3>{{ $t('@.intro.reaction') }}</h3>
<p v-html="this.$t('@.intro.reaction-desc')"></p>
</div>
<div class="image"><img src="/assets/about/reaction.png" alt=""></div>
</section>
<section>
<div class="body">
<h3>{{ $t('@.intro.ui') }}</h3>
<p v-html="this.$t('@.intro.ui-desc')"></p>
</div>
<div class="image"><img src="/assets/about/ui.png" alt=""></div>
</section>
<section>
<div class="body">
<h3>{{ $t('@.intro.drive') }}</h3>
<p v-html="this.$t('@.intro.drive-desc')"></p>
</div>
<div class="image"><img src="/assets/about/drive.png" alt=""></div>
</section>
</section>
<p v-html="this.$t('@.intro.outro')"></p>
</article>
</modal>
<modal name="signup" class="modal" width="450px" height="auto" scrollable>
<header class="formHeader">{{ $t('@.signup') }}</header>
<mk-signup class="form"/>
</modal>
<modal name="signin" class="modal" width="450px" height="auto" scrollable>
<header class="formHeader">{{ $t('@.signin') }}</header>
<mk-signin class="form" @reminder="reminder" />
</modal>
<modal name="reminder" class="modal" width="450px" height="auto" scrollable>
<header class="formHeader">{{ $t('@.reminder') }}</header>
<mk-reminder class="form" @done="doneReminder" />
</modal>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { host, constants } from '../../../config';
import { concat } from '../../../../../prelude/array';
import { toUnicode } from 'punycode/';
export default Vue.extend({
i18n: i18n('desktop/views/pages/welcome.vue'),
data() {
return {
meta: null,
stats: null,
banner: null,
copyright: constants.copyright,
host: toUnicode(host),
name: 'Misskey',
description: '',
announcements: [],
photos: []
};
},
created() {
this.$root.getMeta().then((meta: any) => {
this.meta = meta;
this.name = meta.name;
this.description = meta.description;
this.announcements = meta.announcements;
this.banner = meta.bannerUrl;
});
this.$root.api('stats', {}, false, true).then((stats: any) => {
this.stats = stats;
});
const image = ['image/jpeg','image/png','image/apng','image/gif','image/webp', 'image/avif'];
this.$root.api('notes/featured', {
fileType: image,
limit: 6,
days: 1,
excludeNsfw: true,
}, false, false).then((notes: any[]) => {
notes.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
const files = concat(notes.map((n: any): any[] => n.files));
this.photos = files.filter(f => image.includes(f.type)).slice(0, 6);
});
},
methods: {
about() {
this.$modal.show('about');
},
signup() {
this.$modal.show('signup');
},
signin() {
this.$modal.show('signin');
},
reminder() {
this.$modal.hide('signin');
this.$modal.show('reminder');
},
doneReminder() {
this.$modal.hide('reminder');
},
dark() {
this.$store.commit('device/set', {
key: 'darkmode',
value: !this.$store.state.device.darkmode
});
}
}
});
</script>
<style lang="stylus">
#wait
right auto
left 15px
.v--modal-overlay
background rgba(0, 0, 0, 0.6)
.modal
.form
padding 24px 48px 48px 48px
.formHeader
text-align center
padding 48px 0 12px 0
margin 0 48px
font-size 1.5em
.v--modal-box
background var(--bg)
color var(--text)
.formHeader
border-bottom solid 1px rgba(#000, 0.2)
.v--modal-overlay.about
.v--modal-box.v--modal
margin 32px 0
.fpdezooorhntlzyeszemrsqdlgbysvxq
padding 64px
> p:last-child
margin-bottom 0
> h1
margin-top 0
> section
> h2
border-bottom 1px solid var(--faceDivider)
> section
display grid
grid-template-rows 1fr
grid-template-columns 180px 1fr
gap 32px
margin-bottom 32px
padding-bottom 32px
border-bottom 1px solid var(--faceDivider)
&:nth-child(odd)
grid-template-columns 1fr 180px
> .body
grid-column 1
> .image
grid-column 2
> .body
grid-row 1
grid-column 2
> .image
grid-row 1
grid-column 1
> img
display block
width 100%
height 100%
object-fit cover
</style>
<style lang="stylus" scoped>
.mk-welcome
display flex
min-height 100vh
> .banner
position absolute
top 0
left 0
width 100%
height 400px
background-position center
background-size cover
opacity 0.7
&:after
content ""
display block
position absolute
bottom 0
left 0
width 100%
height 100px
background linear-gradient(transparent, var(--bg))
> button
position fixed
z-index 1
bottom 16px
left 16px
padding 16px
font-size 18px
color var(--text)
> main
margin 0 auto
padding 32px 64px
width 100%
max-width 1200px
.block
color var(--text)
background var(--face)
overflow auto
> header
z-index 1
padding 0 16px
line-height 48px
background var(--faceHeader)
& + div
max-height calc(100% - 48px)
> div
overflow auto
> .body
display grid
grid-template-rows 390px 1fr 256px 64px
grid-template-columns 1fr 1fr 350px
gap 16px
height 1150px
> .main
grid-row 1
grid-column 1 / 3
border-radius 6px
> div
padding 32px
min-height 100%
> h1
margin 0
> svg
margin -8px 0 0 -16px
width 280px
height 100px
fill currentColor
> .info
margin 0 auto 16px auto
width $width
font-size 14px
> .stats
margin-left 16px
padding-left 16px
border-left solid 1px var(--faceDivider)
> *
margin-right 16px
> .sign
font-size 120%
margin-bottom 0
> .divider
margin 0 16px
> .signin
> .signup
> .explore
cursor pointer
&:hover
color var(--primary)
> .char
display block
position absolute
right 16px
bottom 0
height 320px
opacity 0.7
> *:not(.char)
z-index 1
> .announcements
grid-row 2
grid-column 1
border-radius 6px
> div
padding 32px
> div
padding 0 0 16px 0
margin 0 0 16px 0
border-bottom 1px solid var(--faceDivider)
> h1
margin 0
font-size 1.25em
> .photos
grid-row 2
grid-column 2
border-radius 6px
> div
display grid
grid-template-rows 1fr 1fr 1fr
grid-template-columns 1fr 1fr
gap 8px
height 100%
padding 16px
> div
//border-radius 4px
background-position center center
background-size cover
> .tag-cloud
grid-row 3
grid-column 1 / 3
border-radius 6px
> div
height 256px
padding 32px
> .nav
display flex
justify-content center
align-items center
grid-row 4
grid-column 1 / 3
font-size 14px
border-radius 6px
> .side
display grid
grid-row 1 / 5
grid-column 3
grid-template-rows 1fr 350px
grid-template-columns 1fr
gap 16px
> .tl
grid-row 1
grid-column 1
overflow auto
border-radius 6px
> .trends
grid-row 2
grid-column 1
padding 8px
border-radius 6px
> .info
grid-row 3
grid-column 1
border-radius 6px
> div
padding 16px
> .body
> p
display block
margin 0
</style>