enhance(frontend): サーバー情報ページでサーバールールを見れるように

This commit is contained in:
syuilo 2023-04-20 17:23:35 +09:00
parent 795cb1ecf4
commit 3af99d075e

View File

@ -3,10 +3,10 @@
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer v-if="tab === 'overview'" :content-max="600" :margin-min="20"> <MkSpacer v-if="tab === 'overview'" :content-max="600" :margin-min="20">
<div class="_gaps_m"> <div class="_gaps_m">
<div class="fwhjspax" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }"> <div :class="$style.banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }">
<div class="content"> <div style="overflow: clip;">
<img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.bannerIcon"/>
<div class="name"> <div :class="$style.bannerName">
<b>{{ instance.name ?? host }}</b> <b>{{ instance.name ?? host }}</b>
</div> </div>
</div> </div>
@ -41,6 +41,13 @@
<template #value>{{ instance.maintainerEmail }}</template> <template #value>{{ instance.maintainerEmail }}</template>
</MkKeyValue> </MkKeyValue>
</FormSplit> </FormSplit>
<MkFolder v-if="instance.serverRules.length > 0">
<template #label>{{ i18n.ts.serverRules }}</template>
<ol class="_gaps_s" :class="$style.rules">
<li v-for="item in instance.serverRules" :class="$style.rule"><div :class="$style.ruleText" v-html="item"></div></li>
</ol>
</MkFolder>
<FormLink v-if="instance.tosUrl" :to="instance.tosUrl" external>{{ i18n.ts.termsOfService }}</FormLink> <FormLink v-if="instance.tosUrl" :to="instance.tosUrl" external>{{ i18n.ts.termsOfService }}</FormLink>
</div> </div>
</FormSection> </FormSection>
@ -94,6 +101,7 @@ import FormLink from '@/components/form/link.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
import FormSuspense from '@/components/form/suspense.vue'; import FormSuspense from '@/components/form/suspense.vue';
import FormSplit from '@/components/form/split.vue'; import FormSplit from '@/components/form/split.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkKeyValue from '@/components/MkKeyValue.vue'; import MkKeyValue from '@/components/MkKeyValue.vue';
import MkInstanceStats from '@/components/MkInstanceStats.vue'; import MkInstanceStats from '@/components/MkInstanceStats.vue';
import * as os from '@/os'; import * as os from '@/os';
@ -148,31 +156,63 @@ definePageMetadata(computed(() => ({
}))); })));
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.fwhjspax { .banner {
text-align: center; text-align: center;
border-radius: 10px; border-radius: 10px;
overflow: clip; overflow: clip;
background-size: cover; background-size: cover;
background-position: center center; background-position: center center;
}
> .content { .bannerIcon {
overflow: hidden;
> .icon {
display: block; display: block;
margin: 16px auto 0 auto; margin: 16px auto 0 auto;
height: 64px; height: 64px;
border-radius: 8px; border-radius: 8px;
} }
> .name { .bannerName {
display: block; display: block;
padding: 16px; padding: 16px;
color: #fff; color: #fff;
text-shadow: 0 0 8px #000; text-shadow: 0 0 8px #000;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
} }
.rules {
counter-reset: item;
list-style: none;
padding: 0;
margin: 0;
}
.rule {
display: flex;
gap: 8px;
word-break: break-word;
&::before {
flex-shrink: 0;
display: flex;
position: sticky;
top: calc(var(--stickyTop, 0px) + 8px);
counter-increment: item;
content: counter(item);
width: 32px;
height: 32px;
line-height: 32px;
background-color: var(--accentedBg);
color: var(--accent);
font-size: 13px;
font-weight: bold;
align-items: center;
justify-content: center;
border-radius: 999px;
} }
} }
.ruleText {
padding-top: 6px;
}
</style> </style>