mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-10-25 18:54:52 +00:00
# Conflicts: # .github/workflows/api-misskey-js.yml # .github/workflows/changelog-check.yml # .github/workflows/check-misskey-js-autogen.yml # .github/workflows/get-api-diff.yml # .github/workflows/lint.yml # .github/workflows/locale.yml # .github/workflows/on-release-created.yml # .github/workflows/storybook.yml # .github/workflows/test-backend.yml # .github/workflows/test-federation.yml # .github/workflows/test-frontend.yml # .github/workflows/test-misskey-js.yml # .github/workflows/test-production.yml # .github/workflows/validate-api-json.yml # package.json # packages/backend/package.json # packages/backend/src/server/api/ApiCallService.ts # packages/backend/src/server/api/endpoints/drive/files/create.ts # packages/frontend-shared/js/url.ts # packages/frontend/package.json # packages/frontend/src/components/MkFileCaptionEditWindow.vue # packages/frontend/src/components/MkInfo.vue # packages/frontend/src/components/MkLink.vue # packages/frontend/src/components/MkNote.vue # packages/frontend/src/components/MkNotes.vue # packages/frontend/src/components/MkPageWindow.vue # packages/frontend/src/components/MkReactionsViewer.vue # packages/frontend/src/components/MkTimeline.vue # packages/frontend/src/components/MkUrlPreview.vue # packages/frontend/src/components/MkUserPopup.vue # packages/frontend/src/components/global/MkPageHeader.vue # packages/frontend/src/components/global/MkUrl.vue # packages/frontend/src/components/global/PageWithHeader.vue # packages/frontend/src/pages/about-misskey.vue # packages/frontend/src/pages/announcements.vue # packages/frontend/src/pages/antenna-timeline.vue # packages/frontend/src/pages/channel.vue # packages/frontend/src/pages/instance-info.vue # packages/frontend/src/pages/note.vue # packages/frontend/src/pages/page.vue # packages/frontend/src/pages/role.vue # packages/frontend/src/pages/tag.vue # packages/frontend/src/pages/timeline.vue # packages/frontend/src/pages/user-list-timeline.vue # packages/frontend/src/pages/user/followers.vue # packages/frontend/src/pages/user/following.vue # packages/frontend/src/pages/user/home.vue # packages/frontend/src/pages/user/index.vue # packages/frontend/src/ui/deck.vue # packages/misskey-js/generator/package.json # pnpm-lock.yaml # scripts/changelog-checker/package-lock.json # scripts/changelog-checker/package.json
119 lines
3 KiB
Vue
119 lines
3 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<PageWithHeader v-model:tab="tab" :displayBackButton="true" :tabs="headerTabs">
|
|
<div v-if="error != null" class="_spacer" style="--MI_SPACER-w: 1200px;">
|
|
<div :class="$style.root">
|
|
<img :class="$style.img" :src="serverErrorImageUrl" draggable="false"/>
|
|
<p :class="$style.text">
|
|
<i class="ti ti-alert-triangle"></i>
|
|
{{ error }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div v-else-if="tab === 'users'" class="_spacer" style="--MI_SPACER-w: 1200px;">
|
|
<div class="_gaps_s">
|
|
<div v-if="role">{{ role.description }}</div>
|
|
<MkUserList v-if="visible" :pagination="users" :extractor="(item) => item.user"/>
|
|
<div v-else-if="!visible" class="_fullinfo">
|
|
<img :src="infoImageUrl" draggable="false"/>
|
|
<div>{{ i18n.ts.nothing }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-else-if="tab === 'timeline'" class="_spacer" style="--MI_SPACER-w: 700px;">
|
|
<MkTimeline v-if="visible" ref="timeline" src="role" :role="props.roleId"/>
|
|
<div v-else-if="!visible" class="_fullinfo">
|
|
<img :src="infoImageUrl" draggable="false"/>
|
|
<div>{{ i18n.ts.nothing }}</div>
|
|
</div>
|
|
</div>
|
|
</PageWithHeader>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, watch, ref } from 'vue';
|
|
import * as Misskey from 'misskey-js';
|
|
import { instanceName } from '@@/js/config.js';
|
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
|
import MkUserList from '@/components/MkUserList.vue';
|
|
import { definePage } from '@/page.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import MkTimeline from '@/components/MkTimeline.vue';
|
|
import { serverErrorImageUrl, infoImageUrl } from '@/instance.js';
|
|
|
|
const props = withDefaults(defineProps<{
|
|
roleId: string;
|
|
initialTab?: string;
|
|
}>(), {
|
|
initialTab: 'users',
|
|
});
|
|
|
|
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
|
|
const tab = ref(props.initialTab);
|
|
const role = ref<Misskey.entities.Role | null>(null);
|
|
const error = ref<string | null>(null);
|
|
const visible = ref(false);
|
|
|
|
watch(() => props.roleId, () => {
|
|
misskeyApi('roles/show', {
|
|
roleId: props.roleId,
|
|
}).then(res => {
|
|
role.value = res;
|
|
error.value = null;
|
|
visible.value = res.isExplorable && res.isPublic;
|
|
}).catch((err) => {
|
|
if (err.code === 'NO_SUCH_ROLE') {
|
|
error.value = i18n.ts.noRole;
|
|
} else {
|
|
error.value = i18n.ts.somethingHappened;
|
|
}
|
|
});
|
|
}, { immediate: true });
|
|
|
|
const users = computed(() => ({
|
|
endpoint: 'roles/users' as const,
|
|
limit: 30,
|
|
params: {
|
|
roleId: props.roleId,
|
|
},
|
|
}));
|
|
|
|
const headerTabs = computed(() => [{
|
|
key: 'users',
|
|
icon: 'ti ti-users',
|
|
title: i18n.ts.users,
|
|
}, {
|
|
key: 'timeline',
|
|
icon: 'ti ti-pencil',
|
|
title: i18n.ts.timeline,
|
|
}]);
|
|
|
|
definePage(() => ({
|
|
title: role.value ? role.value.name : (error.value ?? i18n.ts.role),
|
|
icon: 'ti ti-badge',
|
|
}));
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
padding: 32px;
|
|
text-align: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.text {
|
|
margin: 0 0 8px 0;
|
|
}
|
|
|
|
.img {
|
|
vertical-align: bottom;
|
|
width: 128px;
|
|
height: 128px;
|
|
margin-bottom: 16px;
|
|
border-radius: var(--MI-radius-md);
|
|
}
|
|
</style>
|