misskey/packages/frontend/src/components/MkVisitorDashboard.vue

205 lines
4.9 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
2023-04-22 01:50:54 +00:00
<template>
<div v-if="instance" :class="$style.root">
2023-04-22 03:50:40 +00:00
<div :class="[$style.main, $style.panel]">
refactor: frontendのcomponentsの型エラーを改善 (#12926) * add: safeFloatParserを追加 * fix: 欠けていた型を追加 * refactor: pageBlockTypesをjson-schemaに移植 * refactor: components/global内の型エラーが出ている箇所を修正 * lint: fix null check style * refactor: fix type error * refactor: fix some type errors * fix: 翻訳が抜けていた箇所を修正 * refactor: getJsonSchemaで正しいスキーマが返されるように修正 * fix: MkChartの型エラーとbytesオプションが機能していない問題を修正 * fix(misskey-js): `drive`->`folderUpdated`のpayloadの型が間違っていたのを修正 * refactor: fix some type errors * change: Captcha読み込み中の文言をLoadingに変更 * refactor(backend/misskey-js): MainEventの型を改善 * refactor: chartjs-plugin-gradientが二重でpluginに登録されていたのを修正 * update: misskey-js.api.md * refactor: fix some type errors * fix: backendのtypecheckが落ちていたのを修正 * update: misskey-js.api.md * add: json-schemaのnoteにpollの型定義を追加 * refactor: noteのjson-schemaの型を改善 * refactor: MkPoll * refactor: fix some type errors * change: UserLiteにisLockedを持たせるように * fix: notificationスキーマにroleが含まれていないのを修正 * Revert "change: UserLiteにisLockedを持たせるように" This reverts commit 1bb0c8e7a9b19a4e9f21bf7381712b98f27672a5. * fix: フォロー通知から鍵垢へのフォローを行うと処理中のまま止まってしまう問題を修正 * refactor: noteスキーマのvisibilityにenumを追加 * change: deepCloneのCloneableTypeにundefinedを追加 * refactor: fix some type errors * refactor: `allowEmpty: false`を使用していた箇所を`minLength: 1`に置き換え * enhance: API 'retension' のresponseの型を追加 * fix: Chart関連のtooltipが正しい位置に表示されない問題を修正 * refactor: fix some type errors * fix: 型情報が不足していたのを修正 * enhance: announcementスキーマにenumを追加 * enhance: ロールポリシーの型定義をRoleServiceからjson-schemaに移植 * refactor: policiesを`ref: RolePolicies`に統一 * fix: API `meta` のレスポンスの型にpoliciesが含まれていないのを修正 * refactor: fix some type errors * fix: backendのlintが落ちているのを修正 * fix: MkFoldableSectionの開閉時のanimationが適用されていない問題を修正 * fix: backendのtypecheckが落ちているのを修正 * update: run build-misskey-js-with-types * fix: MkDialogのmount時に文字数制限の判定が行われない問題を修正 * update: CHANGELOG.md * refactor: MkUserSelectDialogの型を改善 * fix: deepCloneでundefinedはcloneしないように (#9207) * change: frontendのcloneをbackend側にも反映 * update: CHANGELOG.md * fix: RoleServiceからPackを通して型RolePoliciesに依存させないように * Update packages/frontend/src/scripts/get-note-summary.ts * revert RoleService.ts changes * change: optional chaining -> non-null assertion * remove: unused import * fix: propsで渡されたuserがUserLiteの場合に意図しない動作になってしまうのを修正 * change: fix null check style * refactor: fix type error * change: fix null check style * Update packages/frontend/src/components/MkDrive.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * refactor: css moduleでglobalを使わないように * refactor: roleのiconUrlは必ず存在するものとして扱うように * enhance: MenuButtonのactiveにcomputedを受け付けられるように * Update packages/frontend/src/components/MkNotePreview.vue * Update MkWindow.vue * refactor: notification.noteは必ず存在するものとして扱うように * Update packages/frontend/src/components/MkNotification.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * fix: MkSignupDialogでdoneのemit時にresを含んでいなかったのを修正 * Update packages/frontend/src/scripts/clone.ts Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * refactor: 不要な返り値の型を削除 * refactor: 不要なnullチェックを削除 * update: misskey-js-autogen * update: clone.ts * refactor * Update MkNotification.vue * Update MkNotification.vue * :v: * Update MkNotification.vue * Update MkNotification.vue * Update MkNotification.vue * Update MkNotifications.vue * Update MkUserSetupDialog.Profile.vue * Update MkUserCardMini.vue * :v: * Update MkMenu.vue --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2024-01-30 10:53:53 +00:00
<img :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.mainIcon"/>
2023-04-22 01:50:54 +00:00
<button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ti ti-dots"></i></button>
<div :class="$style.mainFg">
<h1 :class="$style.mainTitle">
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
<!-- <img class="logo" v-if="instance.logoImageUrl" :src="instance.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
2023-04-22 01:50:54 +00:00
<span>{{ instanceName }}</span>
</h1>
<div :class="$style.mainAbout">
<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="instance.description || i18n.ts.headlineMisskey"></div>
2023-04-22 01:50:54 +00:00
</div>
<div v-if="instance.disableRegistration" :class="$style.mainWarn">
<MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo>
</div>
<div class="_gaps_s" :class="$style.mainActions">
<MkButton :class="$style.mainAction" full rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.joinThisServer }}</MkButton>
<MkButton :class="$style.mainAction" full rounded link to="https://misskey-hub.net/servers/">{{ i18n.ts.exploreOtherServers }}</MkButton>
2023-04-22 01:50:54 +00:00
<MkButton :class="$style.mainAction" full rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton>
</div>
</div>
</div>
<div v-if="stats" :class="$style.stats">
2023-04-22 03:50:40 +00:00
<div :class="[$style.statsItem, $style.panel]">
2023-04-22 01:50:54 +00:00
<div :class="$style.statsItemLabel">{{ i18n.ts.users }}</div>
<div :class="$style.statsItemCount"><MkNumber :value="stats.originalUsersCount"/></div>
</div>
2023-04-22 03:50:40 +00:00
<div :class="[$style.statsItem, $style.panel]">
2023-04-22 01:50:54 +00:00
<div :class="$style.statsItemLabel">{{ i18n.ts.notes }}</div>
<div :class="$style.statsItemCount"><MkNumber :value="stats.originalNotesCount"/></div>
</div>
</div>
2023-04-22 03:50:40 +00:00
<div v-if="instance.policies.ltlAvailable" :class="[$style.tl, $style.panel]">
2023-04-22 01:50:54 +00:00
<div :class="$style.tlHeader">{{ i18n.ts.letsLookAtTimeline }}</div>
<div :class="$style.tlBody">
<MkTimeline src="local"/>
</div>
</div>
<div :class="$style.panel">
2023-04-22 03:50:40 +00:00
<XActiveUsersChart/>
</div>
2023-04-22 01:50:54 +00:00
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
2023-04-22 01:50:54 +00:00
import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkButton from '@/components/MkButton.vue';
import MkTimeline from '@/components/MkTimeline.vue';
import MkInfo from '@/components/MkInfo.vue';
import { instanceName } from '@@/js/config.js';
2023-09-19 07:37:43 +00:00
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
2023-09-19 07:37:43 +00:00
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
2023-04-22 01:50:54 +00:00
import MkNumber from '@/components/MkNumber.vue';
2023-04-22 03:50:40 +00:00
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
import { openInstanceMenu } from '@/ui/_common_/common.js';
import type { MenuItem } from '@/types/menu.js';
2023-04-22 01:50:54 +00:00
const stats = ref<Misskey.entities.StatsResponse | null>(null);
2023-04-22 01:50:54 +00:00
misskeyApi('stats', {}).then((res) => {
stats.value = res;
2023-04-22 01:50:54 +00:00
});
function signin() {
const { dispose } = os.popup(XSigninDialog, {
2023-04-22 01:50:54 +00:00
autoSet: true,
}, {
closed: () => dispose(),
});
2023-04-22 01:50:54 +00:00
}
function signup() {
const { dispose } = os.popup(XSignupDialog, {
2023-04-22 01:50:54 +00:00
autoSet: true,
}, {
closed: () => dispose(),
});
2023-04-22 01:50:54 +00:00
}
function showMenu(ev: MouseEvent) {
2024-05-01 05:12:36 +00:00
openInstanceMenu(ev);
2023-04-22 01:50:54 +00:00
}
</script>
<style lang="scss" module>
.root {
position: relative;
display: flex;
flex-direction: column;
gap: 16px;
padding: 32px 0 0 0;
}
2023-04-22 03:50:40 +00:00
.panel {
2023-04-22 01:50:54 +00:00
position: relative;
background: var(--MI_THEME-panel);
2023-04-22 01:50:54 +00:00
border-radius: var(--radius);
box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
2023-04-22 03:50:40 +00:00
}
.main {
2023-04-22 01:50:54 +00:00
text-align: center;
}
.mainIcon {
width: 85px;
margin-top: -47px;
vertical-align: bottom;
2023-04-22 08:11:13 +00:00
filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
2023-04-22 01:50:54 +00:00
}
.mainMenu {
position: absolute;
top: 16px;
right: 16px;
width: 32px;
height: 32px;
border-radius: 8px;
font-size: 18px;
}
.mainFg {
position: relative;
z-index: 1;
}
.mainTitle {
display: block;
margin: 0;
padding: 16px 32px 24px 32px;
font-size: 1.4em;
}
.mainLogo {
vertical-align: bottom;
max-height: 120px;
max-width: min(100%, 300px);
}
.mainAbout {
padding: 0 32px;
}
.mainWarn {
padding: 32px 32px 0 32px;
}
.mainActions {
padding: 32px;
}
.mainAction {
line-height: 28px;
}
.stats {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 16px;
}
.statsItem {
overflow: clip;
2023-04-22 03:19:49 +00:00
padding: 16px 20px;
2023-04-22 01:50:54 +00:00
}
.statsItemLabel {
color: var(--MI_THEME-fgTransparentWeak);
2023-04-22 01:50:54 +00:00
font-size: 0.9em;
}
.statsItemCount {
font-weight: bold;
font-size: 1.2em;
color: var(--MI_THEME-accent);
2023-04-22 01:50:54 +00:00
}
.tl {
overflow: clip;
}
.tlHeader {
padding: 12px 16px;
border-bottom: solid 1px var(--MI_THEME-divider);
2023-04-22 01:50:54 +00:00
}
.tlBody {
height: 350px;
overflow: auto;
}
</style>