2022-07-07 14:17:47 +02:00
|
|
|
<template>
|
|
|
|
<span v-if="note.visibility !== 'public'" :class="$style.visibility">
|
2022-11-07 02:33:52 +01:00
|
|
|
<i v-if="note.visibility === 'home'" class="ph-house"></i>
|
|
|
|
<i v-else-if="note.visibility === 'followers'" class="ph-lock-simple-open"></i>
|
|
|
|
<i v-else-if="note.visibility === 'specified'" ref="specified" class="ph-envelope-simple-open"></i>
|
2022-07-07 14:17:47 +02:00
|
|
|
</span>
|
2022-11-07 02:33:52 +01:00
|
|
|
<span v-if="note.localOnly" :class="$style.localOnly"><i class="ph-hand-fist"></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';
|
|
|
|
|
|
|
|
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>
|