Unified Messaging: Move channel management to Messenger

This commit is contained in:
Crimekillz 2024-05-01 18:34:35 +02:00
parent 77a9a49ca1
commit 3b52022d9d
5 changed files with 37 additions and 84 deletions

View File

@ -79,11 +79,6 @@ export const navbarItemDef = reactive({
icon: "ph-film-strip ph-bold ph-lg", icon: "ph-film-strip ph-bold ph-lg",
to: "/gallery", to: "/gallery",
}, },
channels: {
title: "channel",
icon: "ph-television ph-bold ph-lg",
to: "/channels",
},
achievements: { achievements: {
title: "achievements", title: "achievements",
icon: "ph-medal-military ph-bold ph-lg", icon: "ph-medal-military ph-bold ph-lg",

View File

@ -1,7 +1,7 @@
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header <template #header
><MkPageHeader :actions="headerActions" :tabs="headerTabs" ><MkPageHeader :actions="headerActions" :tabs="headerTabs" :display-back-button="true"
/></template> /></template>
<MkSpacer :content-max="700"> <MkSpacer :content-max="700">
<div class="_formRoot"> <div class="_formRoot">

View File

@ -5,6 +5,7 @@
v-model:tab="tab" v-model:tab="tab"
:actions="headerActions" :actions="headerActions"
:tabs="headerTabs" :tabs="headerTabs"
:display-back-button="true"
/></template> /></template>
<MkSpacer :content-max="700"> <MkSpacer :content-max="700">
<MkInfo class="_gap" :warn="true">{{ <MkInfo class="_gap" :warn="true">{{
@ -66,39 +67,11 @@
</MkFoldableSection> </MkFoldableSection>
</div> </div>
</swiper-slide> </swiper-slide>
<swiper-slide>
<div class="_content grwlizim featured">
<!-- <MkPagination
v-slot="{ items }"
:pagination="featuredPagination"
:disable-auto-load="true"
>
<MkChannelPreview
v-for="channel in items"
:key="channel.id"
class="_gap"
:channel="channel"
/>
</MkPagination> -->
<MkChannelList
key="featured"
:pagination="featuredPagination"
/>
</div>
</swiper-slide>
<swiper-slide>
<div class="_content grwlizim following">
<MkChannelList
key="following"
:pagination="followingPagination"
/>
</div>
</swiper-slide>
<swiper-slide> <swiper-slide>
<div class="_content grwlizim owned"> <div class="_content grwlizim owned">
<MkButton class="new" @click="create()" <MkButton class="new" @click="create()"
><i class="ph-plus ph-bold ph-lg"></i ><i class="ph-plus ph-bold ph-lg"></i
></MkButton> >{{ i18n.ts._channel.create }}</MkButton>
<MkChannelList <MkChannelList
key="owned" key="owned"
:pagination="ownedPagination" :pagination="ownedPagination"
@ -132,7 +105,7 @@ import "swiper/scss/virtual";
const router = useRouter(); const router = useRouter();
const tabs = ["search", "featured", "following", "owned"]; const tabs = ["search", "owned"];
let tab = $ref(tabs[1]); let tab = $ref(tabs[1]);
watch($$(tab), () => syncSlide(tabs.indexOf(tab))); watch($$(tab), () => syncSlide(tabs.indexOf(tab)));
@ -149,15 +122,6 @@ onMounted(() => {
searchType = props.type ?? "nameAndDescription"; searchType = props.type ?? "nameAndDescription";
}); });
const featuredPagination = {
endpoint: "channels/featured" as const,
limit: 10,
noPaging: false,
};
const followingPagination = {
endpoint: "channels/followed" as const,
limit: 10,
};
const ownedPagination = { const ownedPagination = {
endpoint: "channels/owned" as const, endpoint: "channels/owned" as const,
limit: 10, limit: 10,
@ -196,16 +160,6 @@ const headerTabs = $computed(() => [
title: i18n.ts.search, title: i18n.ts.search,
icon: "ph-magnifying-glass ph-bold ph-lg", icon: "ph-magnifying-glass ph-bold ph-lg",
}, },
{
key: "featured",
title: i18n.ts._channel.featured,
icon: "ph-fire-simple ph-bold ph-lg",
},
{
key: "following",
title: i18n.ts._channel.following,
icon: "ph-heart ph-bold ph-lg",
},
{ {
key: "owned", key: "owned",
title: i18n.ts._channel.owned, title: i18n.ts._channel.owned,
@ -216,7 +170,7 @@ const headerTabs = $computed(() => [
definePageMetadata( definePageMetadata(
computed(() => ({ computed(() => ({
title: i18n.ts.channel, title: i18n.ts.channel,
icon: "ph-television ph-bold ph-lg", icon: "ph-megaphone-simple ph-bold ph-lg",
})), })),
); );

View File

@ -87,17 +87,25 @@
primary primary
class="start" class="start"
v-if="!isMobile" v-if="!isMobile"
@click="createChannel" @click="visitAnnouncements"
><i class="ph-plus ph-bold ph-lg"></i> ><i class="ph-megaphone-simple ph-bold ph-lg"></i>
{{ i18n.ts._channel.create }}</MkButton {{ i18n.ts.announcements }}</MkButton
> >
<MkButton <MkButton
primary primary
class="start" class="start"
v-if="!isMobile" v-if="!isMobile"
@click="visitAnnouncements" @click="manageChannel"
><i class="ph-megaphone-simple ph-bold ph-lg"></i> ><i class="ph-gear-fine ph-bold ph-lg"></i>
{{ i18n.ts.announcements }}</MkButton {{ i18n.ts._channel.owned }}</MkButton
>
<MkButton
primary
class="start"
v-if="!isMobile"
@click="createChannel"
><i class="ph-plus ph-bold ph-lg"></i>
{{ i18n.ts._channel.create }}</MkButton
> >
<MkChannelList <MkChannelList
key="owned" key="owned"
@ -236,28 +244,6 @@ function onRead(ids): void {
} }
} }
function startMenu(ev) {
os.popupMenu(
[
{
text: i18n.ts.messagingWithUser,
icon: "ph-user ph-bold ph-lg",
action: () => {
startUser();
},
},
{
text: i18n.ts.messagingWithGroup,
icon: "ph-users-three ph-bold ph-lg",
action: () => {
startGroup();
},
},
],
ev.currentTarget ?? ev.target,
);
}
async function startUser(): void { async function startUser(): void {
os.selectUser().then((user) => { os.selectUser().then((user) => {
router.push(`/my/messaging/${Acct.toString(user)}`); router.push(`/my/messaging/${Acct.toString(user)}`);
@ -290,6 +276,10 @@ function createChannel() {
router.push("/channels/new"); router.push("/channels/new");
} }
function manageChannel() {
router.push("/channels");
}
function visitAnnouncements() { function visitAnnouncements() {
router.push("/announcements"); router.push("/announcements");
} }

View File

@ -286,6 +286,13 @@ function messagingStart(ev) {
startGroup(); startGroup();
}, },
}, },
{
text: i18n.ts._channel.create,
icon: "ph-plus ph-bold ph-lg",
action: () => {
mainRouter.push("/channels/new");
},
},
{ {
text: i18n.ts.manageGroups, text: i18n.ts.manageGroups,
icon: "ph-user-circle-gear ph-bold ph-lg", icon: "ph-user-circle-gear ph-bold ph-lg",
@ -293,6 +300,13 @@ function messagingStart(ev) {
mainRouter.push("/my/groups"); mainRouter.push("/my/groups");
}, },
}, },
{
text: i18n.ts._channel.owned,
icon: "ph-gear-fine ph-bold ph-lg",
action: () => {
mainRouter.push("/channels");
},
},
], ],
ev.currentTarget ?? ev.target, ev.currentTarget ?? ev.target,
); );