frontend: fix behavior when no channels are present

This commit is contained in:
hippoz 2022-04-27 23:41:50 +03:00
parent 34dc98af95
commit 6cfac8a6aa
Signed by: hippoz
GPG key ID: 7C52899193467641
2 changed files with 5 additions and 3 deletions

View file

@ -26,10 +26,10 @@
{/if} {/if}
<div class="flex-container"> <div class="flex-container">
{#if $showSidebar} {#if $showSidebar || $selectedChannel.id === -1}
<Sidebar /> <Sidebar />
{/if} {/if}
{#if !($smallViewport && $showSidebar) && $showChannelView} {#if !($smallViewport && $showSidebar) && $showChannelView && $selectedChannel.id !== -1}
<ChannelView channel={$selectedChannel} /> <ChannelView channel={$selectedChannel} />
{/if} {/if}
</div> </div>

View file

@ -36,7 +36,9 @@ class ChannelsStore extends Store {
gateway.subscribe(GatewayEventType.Ready, ({ channels }) => { gateway.subscribe(GatewayEventType.Ready, ({ channels }) => {
this.value = channels; this.value = channels;
selectedChannel.set(channels.length ? channels[0] : null); if (channels.length >= 1) {
selectedChannel.set(channels[0]);
}
this.updated(); this.updated();
}); });
gateway.subscribe(GatewayEventType.ChannelCreate, (channel) => { gateway.subscribe(GatewayEventType.ChannelCreate, (channel) => {