2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2023-01-12 13:02:26 +01:00
|
|
|
<template>
|
2024-08-17 07:57:26 +02:00
|
|
|
<MkA :to="forModeration ? `/admin/roles/${role.id}` : `/roles/${role.id}`" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }">
|
|
|
|
<template v-if="forModeration">
|
|
|
|
<i v-if="role.isPublic" class="ti ti-world" :class="$style.icon" style="color: var(--success)"></i>
|
|
|
|
<i v-else class="ti ti-lock" :class="$style.icon" style="color: var(--warn)"></i>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div v-adaptive-bg class="_panel" :class="$style.body">
|
|
|
|
<div :class="$style.bodyTitle">
|
|
|
|
<span :class="$style.bodyIcon">
|
|
|
|
<template v-if="role.iconUrl">
|
|
|
|
<img :class="$style.bodyBadge" :src="role.iconUrl"/>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<i v-if="role.isAdministrator" class="ti ti-crown" style="color: var(--accent);"></i>
|
|
|
|
<i v-else-if="role.isModerator" class="ti ti-shield" style="color: var(--accent);"></i>
|
|
|
|
<i v-else class="ti ti-user" style="opacity: 0.7;"></i>
|
|
|
|
</template>
|
|
|
|
</span>
|
|
|
|
<span :class="$style.bodyName">{{ role.name }}</span>
|
|
|
|
<template v-if="detailed">
|
|
|
|
<span v-if="role.target === 'manual'" :class="$style.bodyUsers">{{ role.usersCount }} users</span>
|
|
|
|
<span v-else-if="role.target === 'conditional'" :class="$style.bodyUsers">({{ i18n.ts._role.conditional }})</span>
|
2023-02-22 06:43:18 +01:00
|
|
|
</template>
|
2024-08-17 07:57:26 +02:00
|
|
|
</div>
|
|
|
|
<div :class="$style.bodyDescription">{{ role.description }}</div>
|
2023-01-14 03:14:14 +01:00
|
|
|
</div>
|
2023-01-12 13:02:26 +01:00
|
|
|
</MkA>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-12-26 06:19:35 +01:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
2023-01-12 13:02:26 +01:00
|
|
|
|
2023-05-18 11:45:49 +02:00
|
|
|
const props = withDefaults(defineProps<{
|
2023-12-26 06:19:35 +01:00
|
|
|
role: Misskey.entities.Role;
|
2023-02-22 06:43:18 +01:00
|
|
|
forModeration: boolean;
|
2023-05-18 11:45:49 +02:00
|
|
|
detailed: boolean;
|
|
|
|
}>(), {
|
|
|
|
detailed: true,
|
|
|
|
});
|
2023-01-12 13:02:26 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2024-08-17 07:57:26 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
margin: 0 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.body {
|
2023-01-12 13:02:26 +01:00
|
|
|
display: block;
|
|
|
|
padding: 16px 20px;
|
2024-08-17 07:57:26 +02:00
|
|
|
flex: 1;
|
2023-01-12 13:02:26 +01:00
|
|
|
border-left: solid 6px var(--color);
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyTitle {
|
2023-01-14 03:14:14 +01:00
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyIcon {
|
2023-01-15 22:35:16 +01:00
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyBadge {
|
2023-02-22 06:43:18 +01:00
|
|
|
height: 1.3em;
|
|
|
|
vertical-align: -20%;
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyName {
|
2023-01-12 13:02:26 +01:00
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyUsers {
|
2023-01-14 03:14:14 +01:00
|
|
|
margin-left: auto;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
|
2024-08-17 07:57:26 +02:00
|
|
|
.bodyDescription {
|
2023-01-12 13:02:26 +01:00
|
|
|
opacity: 0.7;
|
2023-01-15 22:06:05 +01:00
|
|
|
font-size: 85%;
|
2023-01-12 13:02:26 +01:00
|
|
|
}
|
|
|
|
</style>
|