2019-01-21 15:08:22 +01:00
|
|
|
<template>
|
2022-08-26 16:08:58 +02:00
|
|
|
<LinkOrRouterLink
|
|
|
|
:to="to"
|
|
|
|
:isInternal="isInternal"
|
2022-10-31 13:03:03 +01:00
|
|
|
class="mbz-card shrink-0 dark:bg-mbz-purple dark:text-white rounded-lg shadow-lg flex items-center flex-col"
|
2022-08-26 16:08:58 +02:00
|
|
|
:class="{
|
|
|
|
'sm:flex-row': mode === 'row',
|
2022-09-01 10:00:17 +02:00
|
|
|
'sm:max-w-xs sm:w-[18rem] shrink-0 flex flex-col': mode === 'column',
|
2021-11-06 10:08:20 +01:00
|
|
|
}"
|
|
|
|
>
|
2022-08-26 16:08:58 +02:00
|
|
|
<div class="flex-none p-2 md:p-4">
|
|
|
|
<figure class="" v-if="group.avatar">
|
|
|
|
<img
|
|
|
|
class="rounded-full"
|
|
|
|
:src="group.avatar.url"
|
|
|
|
alt=""
|
|
|
|
height="128"
|
|
|
|
width="128"
|
|
|
|
/>
|
|
|
|
</figure>
|
|
|
|
<AccountGroup v-else :size="128" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="py-2 px-2 md:px-4 flex flex-col h-full justify-between w-full"
|
|
|
|
:class="{ 'sm:flex-1': mode === 'row' }"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<div class="flex gap-1 mb-2">
|
2022-09-01 10:00:17 +02:00
|
|
|
<div class="overflow-hidden flex-auto">
|
2022-08-22 12:12:09 +02:00
|
|
|
<h3
|
|
|
|
class="text-2xl leading-5 line-clamp-3 font-bold text-violet-3 dark:text-white"
|
|
|
|
dir="auto"
|
|
|
|
>
|
2021-11-07 14:59:20 +01:00
|
|
|
{{ displayName(group) }}
|
|
|
|
</h3>
|
2022-08-22 13:47:10 +02:00
|
|
|
<span class="block truncate">
|
2021-11-06 10:08:20 +01:00
|
|
|
{{ `@${usernameWithDomain(group)}` }}
|
|
|
|
</span>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2022-08-22 12:12:09 +02:00
|
|
|
<div
|
|
|
|
class="mb-2 line-clamp-3"
|
|
|
|
dir="auto"
|
|
|
|
v-html="saneSummary"
|
|
|
|
v-if="showSummary"
|
|
|
|
/>
|
2022-03-24 14:41:49 +01:00
|
|
|
<div>
|
2021-11-06 11:15:16 +01:00
|
|
|
<inline-address
|
2022-04-21 11:53:42 +02:00
|
|
|
v-if="group.physicalAddress && addressFullName(group.physicalAddress)"
|
2021-11-06 11:15:16 +01:00
|
|
|
:physicalAddress="group.physicalAddress"
|
|
|
|
/>
|
2022-08-26 16:08:58 +02:00
|
|
|
<p
|
|
|
|
class="flex gap-1"
|
|
|
|
v-if="group?.members?.total && group?.followers?.total"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<Account />
|
2021-11-06 10:08:20 +01:00
|
|
|
{{
|
2022-07-12 10:55:28 +02:00
|
|
|
t(
|
2021-11-06 10:08:20 +01:00
|
|
|
"{count} members or followers",
|
|
|
|
{
|
|
|
|
count: group.members.total + group.followers.total,
|
2022-07-12 10:55:28 +02:00
|
|
|
},
|
|
|
|
group.members.total + group.followers.total
|
2021-11-06 10:08:20 +01:00
|
|
|
)
|
|
|
|
}}
|
2021-11-06 11:15:16 +01:00
|
|
|
</p>
|
2022-08-26 16:08:58 +02:00
|
|
|
<p
|
|
|
|
class="flex gap-1"
|
|
|
|
v-else-if="group?.membersCount || group?.followersCount"
|
|
|
|
>
|
|
|
|
<Account />
|
|
|
|
{{
|
|
|
|
t(
|
|
|
|
"{count} members or followers",
|
|
|
|
{
|
|
|
|
count: (group.membersCount ?? 0) + (group.followersCount ?? 0),
|
|
|
|
},
|
|
|
|
(group.membersCount ?? 0) + (group.followersCount ?? 0)
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</p>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-08-26 16:08:58 +02:00
|
|
|
</LinkOrRouterLink>
|
2019-01-21 15:08:22 +01:00
|
|
|
</template>
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
2021-11-06 10:08:20 +01:00
|
|
|
import { displayName, IGroup, usernameWithDomain } from "@/types/actor";
|
2020-02-18 08:57:00 +01:00
|
|
|
import RouteName from "../../router/name";
|
2021-11-06 11:15:16 +01:00
|
|
|
import InlineAddress from "@/components/Address/InlineAddress.vue";
|
2022-04-21 11:53:42 +02:00
|
|
|
import { addressFullName } from "@/types/address.model";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
import AccountGroup from "vue-material-design-icons/AccountGroup.vue";
|
|
|
|
import Account from "vue-material-design-icons/Account.vue";
|
2022-08-22 12:12:09 +02:00
|
|
|
import { htmlToText } from "@/utils/html";
|
|
|
|
import { computed } from "vue";
|
2022-08-26 16:08:58 +02:00
|
|
|
import LinkOrRouterLink from "../core/LinkOrRouterLink.vue";
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2022-08-22 12:12:09 +02:00
|
|
|
const props = withDefaults(
|
|
|
|
defineProps<{
|
|
|
|
group: IGroup;
|
2022-08-26 16:08:58 +02:00
|
|
|
showSummary?: boolean;
|
|
|
|
isRemoteGroup?: boolean;
|
|
|
|
isLoggedIn?: boolean;
|
|
|
|
mode?: "row" | "column";
|
2022-08-22 12:12:09 +02:00
|
|
|
}>(),
|
2022-08-26 16:08:58 +02:00
|
|
|
{ showSummary: true, isRemoteGroup: false, isLoggedIn: true, mode: "column" }
|
2022-08-22 12:12:09 +02:00
|
|
|
);
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { t } = useI18n({ useScope: "global" });
|
2022-08-22 12:12:09 +02:00
|
|
|
|
2022-08-26 16:08:58 +02:00
|
|
|
const saneSummary = computed(() => htmlToText(props.group.summary ?? ""));
|
|
|
|
|
|
|
|
const isInternal = computed(() => {
|
|
|
|
return props.isRemoteGroup && props.isLoggedIn === false;
|
|
|
|
});
|
|
|
|
|
|
|
|
const to = computed(() => {
|
|
|
|
if (props.isRemoteGroup) {
|
|
|
|
if (props.isLoggedIn === false) {
|
|
|
|
return props.group.url;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
name: RouteName.INTERACT,
|
|
|
|
query: { uri: encodeURI(props.group.url) },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
name: RouteName.GROUP,
|
|
|
|
params: { preferredUsername: usernameWithDomain(props.group) },
|
|
|
|
};
|
|
|
|
});
|
2019-01-21 15:08:22 +01:00
|
|
|
</script>
|