mirror of
https://github.com/spacebarchat/client.git
synced 2024-11-25 11:42:30 +01:00
destructure props in Chat.tsx
This commit is contained in:
parent
af454cfdf6
commit
b6a9f12d2b
@ -80,16 +80,17 @@ const Content = observer((props: Props2) => {
|
|||||||
function Chat() {
|
function Chat() {
|
||||||
const app = useAppStore();
|
const app = useAppStore();
|
||||||
const logger = useLogger("Messages");
|
const logger = useLogger("Messages");
|
||||||
|
const { activeChannel, activeGuild, activeChannelId, activeGuildId } = app;
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!app.activeChannel || !app.activeGuild || app.activeChannelId === "@me") return;
|
if (!activeChannel || !activeGuild || activeChannelId === "@me") return;
|
||||||
|
|
||||||
runInAction(() => {
|
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 (
|
return (
|
||||||
<WrapperTwo>
|
<WrapperTwo>
|
||||||
<span>Home Section Placeholder</span>
|
<span>Home Section Placeholder</span>
|
||||||
@ -97,7 +98,7 @@ function Chat() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!app.activeGuild || !app.activeChannel) {
|
if (!activeGuild || !activeChannel) {
|
||||||
return (
|
return (
|
||||||
<WrapperTwo>
|
<WrapperTwo>
|
||||||
<span
|
<span
|
||||||
@ -115,8 +116,8 @@ function Chat() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<WrapperTwo>
|
<WrapperTwo>
|
||||||
<ChatHeader channel={app.activeChannel} />
|
<ChatHeader channel={activeChannel} />
|
||||||
<Content channel={app.activeChannel} guild={app.activeGuild} />
|
<Content channel={activeChannel} guild={activeGuild} />
|
||||||
</WrapperTwo>
|
</WrapperTwo>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user