2022-07-07 14:17:47 +02:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<span v-if="note.visibility !== 'public'" :class="$style.visibility">
|
2023-05-04 19:02:53 +02:00
|
|
|
<i
|
2023-05-02 21:07:46 +02:00
|
|
|
v-if="note.visibility === 'home'"
|
|
|
|
v-tooltip="i18n.ts._visibility.home"
|
2023-09-02 01:27:33 +02:00
|
|
|
class="ph-house ph-bold ph-lg"
|
2023-05-02 21:07:46 +02:00
|
|
|
></i>
|
2023-04-08 02:01:42 +02:00
|
|
|
<i
|
|
|
|
v-else-if="note.visibility === 'followers'"
|
2023-05-02 21:07:46 +02:00
|
|
|
v-tooltip="i18n.ts._visibility.followers"
|
2023-09-02 01:27:33 +02:00
|
|
|
class="ph-lock ph-bold ph-lg"
|
2023-04-08 02:01:42 +02:00
|
|
|
></i>
|
|
|
|
<i
|
|
|
|
v-else-if="note.visibility === 'specified'"
|
|
|
|
ref="specified"
|
|
|
|
class="ph-envelope-simple-open ph-bold ph-lg"
|
|
|
|
></i>
|
|
|
|
</span>
|
|
|
|
<span v-if="note.localOnly" :class="$style.localOnly"
|
2023-05-04 19:02:53 +02:00
|
|
|
><i
|
2023-05-02 21:07:46 +02:00
|
|
|
v-tooltip="i18n.ts._visibility.localOnly"
|
2023-09-19 04:14:37 +02:00
|
|
|
class="ph-users ph-bold ph-lg"
|
2023-05-02 21:07:46 +02:00
|
|
|
></i
|
2023-04-08 02:01:42 +02:00
|
|
|
></span>
|
2022-07-07 14:17:47 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-08-12 02:44:46 +02:00
|
|
|
import { ref } from "vue";
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
import XDetails from "@/components/MkUsersTooltip.vue";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { useTooltip } from "@/scripts/use-tooltip";
|
2023-05-02 21:07:46 +02:00
|
|
|
import { i18n } from "@/i18n";
|
2022-07-07 14:17:47 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
note: {
|
|
|
|
visibility: string;
|
|
|
|
localOnly?: boolean;
|
|
|
|
visibleUserIds?: string[];
|
2023-04-08 02:01:42 +02:00
|
|
|
};
|
2022-07-07 14:17:47 +02:00
|
|
|
}>();
|
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const specified = ref<HTMLElement>();
|
2022-07-07 14:17:47 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
if (props.note.visibility === "specified") {
|
2023-08-12 02:44:46 +02:00
|
|
|
useTooltip(specified, async (showing) => {
|
2023-04-08 02:01:42 +02:00
|
|
|
const users = await os.api("users/show", {
|
2022-07-07 14:17:47 +02:00
|
|
|
userIds: props.note.visibleUserIds,
|
|
|
|
limit: 10,
|
|
|
|
});
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
os.popup(
|
|
|
|
XDetails,
|
|
|
|
{
|
|
|
|
showing,
|
|
|
|
users,
|
|
|
|
count: props.note.visibleUserIds.length,
|
2023-08-12 02:44:46 +02:00
|
|
|
targetElement: specified.value,
|
2023-04-08 02:01:42 +02:00
|
|
|
},
|
|
|
|
{},
|
2023-07-06 03:28:27 +02:00
|
|
|
"closed",
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2022-07-07 14:17:47 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
2023-04-08 02:01:42 +02:00
|
|
|
.visibility,
|
|
|
|
.localOnly {
|
2022-07-07 14:17:47 +02:00
|
|
|
margin-left: 0.5em;
|
|
|
|
}
|
|
|
|
</style>
|