2022-07-07 14:17:47 +02:00
|
|
|
<template>
|
2022-12-08 06:57:23 +01:00
|
|
|
<span v-if="note.visibility !== 'public'" :class="$style.visibility" :title="i18n.ts._visibility[note.visibility]">
|
2022-07-07 14:17:47 +02:00
|
|
|
<i v-if="note.visibility === 'home'" class="fas fa-home"></i>
|
|
|
|
<i v-else-if="note.visibility === 'followers'" class="fas fa-unlock"></i>
|
|
|
|
<i v-else-if="note.visibility === 'specified'" ref="specified" class="fas fa-envelope"></i>
|
|
|
|
</span>
|
2022-12-08 06:57:23 +01:00
|
|
|
<span v-if="note.localOnly" :class="$style.localOnly" :title="i18n.ts._visibility['localOnly']"><i class="fas fa-biohazard"></i></span>
|
2022-07-07 14:17:47 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
2022-08-30 17:24:33 +02:00
|
|
|
import XDetails from '@/components/MkUsersTooltip.vue';
|
2022-07-07 14:17:47 +02:00
|
|
|
import * as os from '@/os';
|
|
|
|
import { useTooltip } from '@/scripts/use-tooltip';
|
2022-12-08 06:57:23 +01:00
|
|
|
import { i18n } from '@/i18n';
|
2022-07-07 14:17:47 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
note: {
|
|
|
|
visibility: string;
|
|
|
|
localOnly?: boolean;
|
|
|
|
visibleUserIds?: string[];
|
|
|
|
},
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const specified = $ref<HTMLElement>();
|
|
|
|
|
|
|
|
if (props.note.visibility === 'specified') {
|
|
|
|
useTooltip($$(specified), async (showing) => {
|
|
|
|
const users = await os.api('users/show', {
|
|
|
|
userIds: props.note.visibleUserIds,
|
|
|
|
limit: 10,
|
|
|
|
});
|
|
|
|
|
|
|
|
os.popup(XDetails, {
|
|
|
|
showing,
|
|
|
|
users,
|
|
|
|
count: props.note.visibleUserIds.length,
|
|
|
|
targetElement: specified,
|
|
|
|
}, {}, 'closed');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.visibility, .localOnly {
|
|
|
|
margin-left: 0.5em;
|
|
|
|
}
|
|
|
|
</style>
|