1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-25 11:42:30 +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; flex: 1;
`; `;
export function EmptyChannelList() {
return <Container></Container>;
}
function ChannelList() { function ChannelList() {
const app = useAppStore(); const app = useAppStore();
if (!app.activeGuild || !app.activeChannel) return null; if (!app.activeGuild || !app.activeChannel) return <Container />;
const { channels } = app.activeGuild; const { channels } = app.activeGuild;
const rowRenderer = ({ index, key, style }: ListRowProps) => { const rowRenderer = ({ index, key, style }: ListRowProps) => {

View File

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