tweak MkRolePreview

This commit is contained in:
syuilo 2023-01-14 11:14:14 +09:00
parent 027ef1ea4a
commit 2bedc084a3
2 changed files with 16 additions and 1 deletions

View File

@ -62,6 +62,7 @@ export class RoleEntityService {
isModerator: role.isModerator, isModerator: role.isModerator,
canEditMembersByModerator: role.canEditMembersByModerator, canEditMembersByModerator: role.canEditMembersByModerator,
options: roleOptions, options: roleOptions,
usersCount: assigns.length,
...(opts.detail ? { ...(opts.detail ? {
users: this.userEntityService.packMany(assigns.map(x => x.userId), me), users: this.userEntityService.packMany(assigns.map(x => x.userId), me),
} : {}), } : {}),

View File

@ -1,6 +1,10 @@
<template> <template>
<MkA v-adaptive-bg :to="`/admin/roles/${role.id}`" class="_panel" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }"> <MkA v-adaptive-bg :to="`/admin/roles/${role.id}`" class="_panel" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }">
<div :class="$style.title">{{ role.name }}</div> <div :class="$style.title">
<span :class="$style.name">{{ role.name }}</span>
<span v-if="role.target === 'manual'" :class="$style.users">{{ role.usersCount }} users</span>
<span v-else-if="role.target === 'conditional'" :class="$style.users">({{ i18n.ts._role.conditional }})</span>
</div>
<div :class="$style.description">{{ role.description }}</div> <div :class="$style.description">{{ role.description }}</div>
</MkA> </MkA>
</template> </template>
@ -9,6 +13,7 @@
import { } from 'vue'; import { } from 'vue';
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
import * as os from '@/os'; import * as os from '@/os';
import { i18n } from '@/i18n';
const props = defineProps<{ const props = defineProps<{
role: any; role: any;
@ -23,9 +28,18 @@ const props = defineProps<{
} }
.title { .title {
display: flex;
}
.name {
font-weight: bold; font-weight: bold;
} }
.users {
margin-left: auto;
opacity: 0.7;
}
.description { .description {
opacity: 0.7; opacity: 0.7;
} }