diff --git a/src/ic_panda_frontend/src/lib/components/icons/IconArrowLeftSLine.svelte b/src/ic_panda_frontend/src/lib/components/icons/IconArrowLeftSLine.svelte new file mode 100755 index 0000000..5da183f --- /dev/null +++ b/src/ic_panda_frontend/src/lib/components/icons/IconArrowLeftSLine.svelte @@ -0,0 +1,10 @@ + diff --git a/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte b/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte index c1229ff..8beb9cb 100644 --- a/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte +++ b/src/ic_panda_frontend/src/lib/components/messages/ChannelDetail.svelte @@ -2,6 +2,7 @@ import { goto } from '$app/navigation' import { type UserInfo } from '$lib/canisters/message' import { ChannelAPI } from '$lib/canisters/messagechannel' + import IconArrowLeftSLine from '$lib/components/icons/IconArrowLeftSLine.svelte' import IconClose from '$lib/components/icons/IconClose.svelte' import IconMoreFill from '$lib/components/icons/IconMoreFill.svelte' import IconPanda from '$lib/components/icons/IconPanda.svelte' @@ -13,7 +14,7 @@ } from '$src/lib/stores/message' import { sleep } from '$src/lib/utils/helper' import { Avatar, getToastStore } from '@skeletonlabs/skeleton' - import { onMount } from 'svelte' + import { getContext, onMount } from 'svelte' import { type Readable } from 'svelte/store' import ChannelMessages from './ChannelMessages.svelte' import ChannelSetting from './ChannelSetting.svelte' @@ -22,6 +23,7 @@ const toastStore = getToastStore() const { canister, id } = ChannelAPI.parseChannelParam(channelId) + const onChatBack = getContext('onChatBack') as () => void let myState: MyMessageState let myInfo: Readable @@ -44,27 +46,39 @@ } onMount(() => { - const { abort } = toastRun(async (signal: AbortSignal) => { - if (canister) { - myState = await myMessageStateAsync() - myInfo = myState.info as Readable - channelInfo = await myState.loadChannelInfo(canister, id) - openSettings = !$channelInfo._kek - } else { + const { abort, finally: onfinally } = toastRun( + async (signal: AbortSignal) => { + if (canister) { + myState = await myMessageStateAsync() + myInfo = myState.info as Readable + channelInfo = await myState.loadChannelInfo(canister, id) + openSettings = !$channelInfo._kek + return channelInfo + } + return null + }, + toastStore + ) + + onfinally((channel) => { + if (!channel) { goto('/_/messages') } - }, toastStore) + }) return abort }) -
+
+
+ +
{#if $channelInfo} -
+
-
+
-
+
Members {#if isManager} -
+
- {#key channelId} - {#if channelId} - - {:else} -
+
+ {#key channelId} + {#if channelId && channelId !== 'profile'} + + {:else} +
+ +
-
- {/if} - {/key} + {/if} + {/key} +
+ + diff --git a/src/ic_panda_frontend/src/lib/components/messages/MyChannelList.svelte b/src/ic_panda_frontend/src/lib/components/messages/MyChannelList.svelte index 1b98d3a..814fbf1 100644 --- a/src/ic_panda_frontend/src/lib/components/messages/MyChannelList.svelte +++ b/src/ic_panda_frontend/src/lib/components/messages/MyChannelList.svelte @@ -77,12 +77,12 @@ >
-
Channels
+
Channels
{#each channels as channel}