2019-09-11 09:59:01 +02:00
|
|
|
<template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<div class="p-6">
|
|
|
|
<header class="">
|
|
|
|
<h2 class="">{{ $t("Pick an identity") }}</h2>
|
2020-02-18 08:57:00 +01:00
|
|
|
</header>
|
2022-07-12 10:55:28 +02:00
|
|
|
<section class="">
|
2022-04-20 08:59:40 +02:00
|
|
|
<div class="list is-hoverable list-none">
|
2020-02-18 08:57:00 +01:00
|
|
|
<a
|
2022-07-12 10:55:28 +02:00
|
|
|
class="my-2 block dark:bg-violet-3 rounded-xl p-2"
|
2020-02-18 08:57:00 +01:00
|
|
|
v-for="identity in identities"
|
2020-08-31 12:40:30 +02:00
|
|
|
:key="identity.id"
|
2021-09-29 18:21:24 +02:00
|
|
|
:class="{
|
2022-07-12 10:55:28 +02:00
|
|
|
active: currentIdentity && identity.id === currentIdentity.id,
|
2021-09-29 18:21:24 +02:00
|
|
|
}"
|
2022-04-20 08:59:40 +02:00
|
|
|
@click="currentIdentity = identity"
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<div class="flex gap-2">
|
2020-02-18 08:57:00 +01:00
|
|
|
<img
|
2022-07-12 10:55:28 +02:00
|
|
|
class="rounded"
|
2020-02-18 08:57:00 +01:00
|
|
|
v-if="identity.avatar"
|
|
|
|
:src="identity.avatar.url"
|
|
|
|
alt=""
|
2022-07-12 10:55:28 +02:00
|
|
|
width="48"
|
|
|
|
height="48"
|
2020-02-18 08:57:00 +01:00
|
|
|
/>
|
2022-07-12 10:55:28 +02:00
|
|
|
<AccountCircle v-else :size="48" />
|
|
|
|
<div class="">
|
|
|
|
<p>@{{ identity.preferredUsername }}</p>
|
2020-02-18 08:57:00 +01:00
|
|
|
<small>{{ identity.name }}</small>
|
2019-09-11 09:59:01 +02:00
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<slot name="footer" />
|
|
|
|
</div>
|
2019-09-11 09:59:01 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { IPerson } from "@/types/actor";
|
|
|
|
import { useCurrentUserIdentities } from "@/composition/apollo/actor";
|
|
|
|
import { computed } from "vue";
|
|
|
|
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
import { useHead } from "@vueuse/head";
|
2019-09-11 09:59:01 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { identities } = useCurrentUserIdentities();
|
|
|
|
|
|
|
|
const { t } = useI18n({ useScope: "global" });
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
useHead({
|
|
|
|
title: computed(() => t("Identities")),
|
|
|
|
});
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
modelValue: IPerson;
|
|
|
|
}>();
|
2019-09-11 09:59:01 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const emit = defineEmits(["update:modelValue"]);
|
|
|
|
|
|
|
|
const currentIdentity = computed<IPerson>({
|
|
|
|
get(): IPerson {
|
|
|
|
return props.modelValue;
|
|
|
|
},
|
|
|
|
set(identity: IPerson) {
|
|
|
|
emit("update:modelValue", identity);
|
|
|
|
},
|
|
|
|
});
|
2020-02-18 08:57:00 +01:00
|
|
|
</script>
|