1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 02:12:38 +01:00

fix empty list not rendering when no active channel

This commit is contained in:
Puyodead1 2024-03-05 15:28:52 -05:00
parent 95411d5158
commit ca96cb9bce
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
2 changed files with 3 additions and 10 deletions

View File

@ -10,14 +10,10 @@ const Container = styled.div`
flex: 1;
`;
export function EmptyChannelList() {
return <Container></Container>;
}
function ChannelList() {
const app = useAppStore();
if (!app.activeGuild || !app.activeChannel) return null;
if (!app.activeGuild || !app.activeChannel) return <Container />;
const { channels } = app.activeGuild;
const rowRenderer = ({ index, key, style }: ListRowProps) => {

View File

@ -1,8 +1,7 @@
import { observer } from "mobx-react-lite";
import styled from "styled-components";
import { useAppStore } from "../stores/AppStore";
import ChannelHeader from "./ChannelHeader";
import ChannelList, { EmptyChannelList } from "./ChannelList/ChannelList";
import ChannelList from "./ChannelList/ChannelList";
import Container from "./Container";
import UserPanel from "./UserPanel";
@ -18,13 +17,11 @@ const Wrapper = styled(Container)`
`;
function ChannelSidebar() {
const app = useAppStore();
return (
<Wrapper>
{/* TODO: replace with dm search if no guild */}
<ChannelHeader />
{app.activeGuild ? <ChannelList /> : <EmptyChannelList />}
<ChannelList />
<UserPanel />
</Wrapper>
);