frontend: fix behavior when no channels are present
This commit is contained in:
parent
34dc98af95
commit
6cfac8a6aa
2 changed files with 5 additions and 3 deletions
|
@ -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>
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
Loading…
Reference in a new issue