chore(client): tweak ui

This commit is contained in:
syuilo 2022-07-01 15:06:17 +09:00 committed by Johann150
parent fecdd1f6ad
commit 22a0401bb2
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -13,10 +13,9 @@
<MkEmoji :normal="true" :no-style="true" emoji="🎉"/> <MkEmoji :normal="true" :no-style="true" emoji="🎉"/>
<MkEmoji :normal="true" :no-style="true" emoji="🍮"/> <MkEmoji :normal="true" :no-style="true" emoji="🍮"/>
</div> </div>
<div class="main _panel"> <div class="main">
<div class="bg"> <img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
<div class="fade"></div> <button class="_button _acrylic menu" @click="showMenu"><i class="fas fa-ellipsis-h"></i></button>
</div>
<div class="fg"> <div class="fg">
<h1> <h1>
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に --> <!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
@ -24,123 +23,107 @@
<span class="text">{{ instanceName }}</span> <span class="text">{{ instanceName }}</span>
</h1> </h1>
<div class="about"> <div class="about">
<div class="desc" v-html="meta.description || $ts.headlineMisskey"></div> <div class="desc" v-html="meta.description || i18n.ts.headlineMisskey"></div>
</div> </div>
<div class="action"> <div class="action">
<MkButton inline gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ $ts.signup }}</MkButton> <MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton>
<MkButton inline data-cy-signin @click="signin()">{{ $ts.login }}</MkButton> <MkButton inline rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton>
</div> </div>
<div v-if="onlineUsersCount && stats" class="status">
<div>
<I18n :src="$ts.nUsers" text-tag="span" class="users">
<template #n><b>{{ number(stats.originalUsersCount) }}</b></template>
</I18n>
<I18n :src="$ts.nNotes" text-tag="span" class="notes">
<template #n><b>{{ number(stats.originalNotesCount) }}</b></template>
</I18n>
</div> </div>
<I18n :src="$ts.onlineUsersCount" text-tag="span" class="online">
<template #n><b>{{ onlineUsersCount }}</b></template>
</I18n>
</div>
<button class="_button _acrylic menu" @click="showMenu"><i class="fas fa-ellipsis-h"></i></button>
</div> </div>
<div v-if="instances" class="federation">
<MarqueeText :duration="40">
<MkA v-for="instance in instances" :key="instance.id" :class="$style.federationInstance" :to="`/instance-info/${instance.host}`" behavior="window">
<!--<MkInstanceCardMini :instance="instance"/>-->
<img v-if="instance.iconUrl" class="icon" :src="instance.iconUrl" alt=""/>
<span class="name _monospace">{{ instance.host }}</span>
</MkA>
</MarqueeText>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue'; import { } from 'vue';
import { toUnicode } from 'punycode/'; import { toUnicode } from 'punycode/';
import MarqueeText from 'vue-marquee-text-component';
import XTimeline from './welcome.timeline.vue';
import XSigninDialog from '@/components/signin-dialog.vue'; import XSigninDialog from '@/components/signin-dialog.vue';
import XSignupDialog from '@/components/signup-dialog.vue'; import XSignupDialog from '@/components/signup-dialog.vue';
import MkButton from '@/components/ui/button.vue'; import MkButton from '@/components/ui/button.vue';
import XNote from '@/components/note.vue'; import XNote from '@/components/note.vue';
import MkFeaturedPhotos from '@/components/featured-photos.vue'; import MkFeaturedPhotos from '@/components/featured-photos.vue';
import XTimeline from './welcome.timeline.vue';
import { host, instanceName } from '@/config'; import { host, instanceName } from '@/config';
import * as os from '@/os'; import * as os from '@/os';
import number from '@/filters/number'; import number from '@/filters/number';
import { i18n } from '@/i18n';
export default defineComponent({ let meta = $ref();
components: { let stats = $ref();
MkButton, let tags = $ref();
XNote, let onlineUsersCount = $ref();
MkFeaturedPhotos, let instances = $ref();
XTimeline,
},
data() { os.api('meta', { detail: true }).then(_meta => {
return { meta = _meta;
host: toUnicode(host),
instanceName,
meta: null,
stats: null,
tags: [],
onlineUsersCount: null,
};
},
created() {
os.api('meta', { detail: true }).then(meta => {
this.meta = meta;
}); });
os.api('stats').then(stats => { os.api('stats').then(_stats => {
this.stats = stats; stats = _stats;
}); });
os.api('get-online-users-count').then(res => { os.api('get-online-users-count').then(res => {
this.onlineUsersCount = res.count; onlineUsersCount = res.count;
}); });
os.api('hashtags/list', { os.api('hashtags/list', {
sort: '+mentionedLocalUsers', sort: '+mentionedLocalUsers',
limit: 8 limit: 8,
}).then(tags => { }).then(_tags => {
this.tags = tags; tags = _tags;
}); });
},
methods: { os.api('federation/instances', {
signin() { sort: '+pubSub',
limit: 20,
}).then(_instances => {
instances = _instances;
});
function signin() {
os.popup(XSigninDialog, { os.popup(XSigninDialog, {
autoSet: true autoSet: true,
}, {}, 'closed'); }, {}, 'closed');
}, }
signup() { function signup() {
os.popup(XSignupDialog, { os.popup(XSignupDialog, {
autoSet: true autoSet: true,
}, {}, 'closed'); }, {}, 'closed');
}, }
showMenu(ev) { function showMenu(ev) {
os.popupMenu([{ os.popupMenu([{
text: this.$t('aboutX', { x: instanceName }), text: i18n.ts.instanceInfo,
icon: 'fas fa-info-circle', icon: 'fas fa-info-circle',
action: () => { action: () => {
os.pageWindow('/about'); os.pageWindow('/about');
} },
}, { }, {
text: this.$ts.aboutMisskey, text: i18n.ts.aboutMisskey,
icon: 'fas fa-info-circle', icon: 'fas fa-info-circle',
action: () => { action: () => {
os.pageWindow('/about-misskey'); os.pageWindow('/about-misskey');
} },
}, null, { }, null, {
text: this.$ts.help, text: i18n.ts.help,
icon: 'fas fa-question-circle', icon: 'fas fa-question-circle',
action: () => { action: () => {
window.open(`https://misskey-hub.net/help.md`, '_blank'); window.open('https://misskey-hub.net/help.md', '_blank');
}
}], ev.currentTarget ?? ev.target);
}, },
}], ev.currentTarget ?? ev.target);
number
} }
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -201,7 +184,7 @@ export default defineComponent({
position: absolute; position: absolute;
top: 42px; top: 42px;
left: 42px; left: 42px;
width: 160px; width: 140px;
@media (max-width: 450px) { @media (max-width: 450px) {
width: 130px; width: 130px;
@ -226,30 +209,29 @@ export default defineComponent({
position: relative; position: relative;
width: min(480px, 100%); width: min(480px, 100%);
margin: auto auto auto 128px; margin: auto auto auto 128px;
background: var(--panel);
border-radius: var(--radius);
box-shadow: 0 12px 32px rgb(0 0 0 / 25%); box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
@media (max-width: 1200px) { @media (max-width: 1200px) {
margin: auto; margin: auto;
} }
> .bg { > .icon {
position: absolute; width: 85px;
top: 0; margin-top: -47px;
left: 0; border-radius: 100%;
width: 100%; vertical-align: bottom;
height: 128px;
background-position: center;
background-size: cover;
opacity: 0.75;
> .fade {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 128px;
background: linear-gradient(0deg, var(--panel), var(--X15));
} }
> .menu {
position: absolute;
top: 16px;
right: 16px;
width: 32px;
height: 32px;
border-radius: 8px;
font-size: 18px;
} }
> .fg { > .fg {
@ -259,8 +241,8 @@ export default defineComponent({
> h1 { > h1 {
display: block; display: block;
margin: 0; margin: 0;
padding: 32px 32px 24px 32px; padding: 16px 32px 24px 32px;
font-size: 1.5em; font-size: 1.4em;
> .logo { > .logo {
vertical-align: bottom; vertical-align: bottom;
@ -280,41 +262,47 @@ export default defineComponent({
line-height: 28px; line-height: 28px;
} }
} }
> .status {
border-top: solid 0.5px var(--divider);
padding: 32px;
font-size: 90%;
> div {
> span:not(:last-child) {
padding-right: 1em;
margin-right: 1em;
border-right: solid 0.5px var(--divider);
} }
} }
> .online { > .federation {
::v-deep(b) {
color: #41b781;
}
::v-deep(span) {
opacity: 0.7;
}
}
}
> .menu {
position: absolute; position: absolute;
top: 16px; bottom: 16px;
right: 16px; left: 0;
width: 32px; right: 0;
height: 32px; margin: auto;
border-radius: 8px; background: var(--acrylicPanel);
} -webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
border-radius: 999px;
overflow: clip;
width: 800px;
padding: 8px 0;
@media (max-width: 900px) {
display: none;
} }
} }
} }
} }
</style> </style>
<style lang="scss" module>
.federationInstance {
display: inline-flex;
align-items: center;
vertical-align: bottom;
padding: 6px 12px 6px 6px;
margin: 0 10px 0 0;
background: var(--panel);
border-radius: 999px;
> :global(.icon) {
display: inline-block;
width: 20px;
height: 20px;
margin-right: 5px;
border-radius: 999px;
}
}
</style>