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

destructure props in Chat.tsx

This commit is contained in:
Puyodead1 2023-12-18 11:59:56 -05:00
parent af454cfdf6
commit b6a9f12d2b
No known key found for this signature in database
GPG Key ID: BA5F91AAEF68E5CE

View File

@ -80,16 +80,17 @@ const Content = observer((props: Props2) => {
function Chat() {
const app = useAppStore();
const logger = useLogger("Messages");
const { activeChannel, activeGuild, activeChannelId, activeGuildId } = app;
React.useEffect(() => {
if (!app.activeChannel || !app.activeGuild || app.activeChannelId === "@me") return;
if (!activeChannel || !activeGuild || activeChannelId === "@me") return;
runInAction(() => {
app.gateway.onChannelOpen(app.activeGuildId!, app.activeChannelId!);
app.gateway.onChannelOpen(activeGuildId!, activeChannelId!);
});
}, [app.activeChannel, app.activeGuild]);
}, [activeChannel, activeGuild]);
if (app.activeGuildId && app.activeGuildId === "@me") {
if (activeGuildId && activeGuildId === "@me") {
return (
<WrapperTwo>
<span>Home Section Placeholder</span>
@ -97,7 +98,7 @@ function Chat() {
);
}
if (!app.activeGuild || !app.activeChannel) {
if (!activeGuild || !activeChannel) {
return (
<WrapperTwo>
<span
@ -115,8 +116,8 @@ function Chat() {
return (
<WrapperTwo>
<ChatHeader channel={app.activeChannel} />
<Content channel={app.activeChannel} guild={app.activeGuild} />
<ChatHeader channel={activeChannel} />
<Content channel={activeChannel} guild={activeGuild} />
</WrapperTwo>
);
}