diff --git a/src/components/ChannelHeader.tsx b/src/components/ChannelHeader.tsx index e09c3d5..456a444 100644 --- a/src/components/ChannelHeader.tsx +++ b/src/components/ChannelHeader.tsx @@ -26,9 +26,10 @@ const HeaderText = styled.header` interface Props { guild?: Guild; + guildId?: string; } -function ChannelHeader({ guild }: Props) { +function ChannelHeader({ guild, guildId }: Props) { const app = useAppStore(); const contextMenu = React.useContext(ContextMenuContext); const { openModal } = useModals(); @@ -85,15 +86,25 @@ function ChannelHeader({ guild }: Props) { }); } + if (guildId === "@me") { + return ( + + Direct Messages + + ); + } + if (!guild) return null; + return ( - - {guild?.name - ? guild.name.length > 18 - ? guild.name.substring(0, 18) + "..." - : guild.name - : "Unknown Guild"} - + {guild.name.length > 18 ? guild.name.substring(0, 18) + "..." : guild.name} ); diff --git a/src/components/ChannelList.tsx b/src/components/ChannelList.tsx index ba65d22..d2df5bf 100644 --- a/src/components/ChannelList.tsx +++ b/src/components/ChannelList.tsx @@ -15,11 +15,7 @@ const List = styled.div` `; function EmptyChannelList() { - return ( - - skeleton - - ); + return ; } interface Props { @@ -27,7 +23,7 @@ interface Props { guild?: Guild; } -function ChannelList({ guild, channelId }: Props) { +function ChannelList({ channelId, guild }: Props) { const app = useAppStore(); if (!guild) return ; diff --git a/src/components/ChannelSidebar.tsx b/src/components/ChannelSidebar.tsx index 1e28538..7ebaae2 100644 --- a/src/components/ChannelSidebar.tsx +++ b/src/components/ChannelSidebar.tsx @@ -25,11 +25,11 @@ interface Props { channelId?: string; } -function ChannelSidebar({ guild, channelId }: Props) { +function ChannelSidebar({ guild, channelId, guildId }: Props) { return ( {/* TODO: replace with dm search if no guild */} - + diff --git a/src/components/messaging/Chat.tsx b/src/components/messaging/Chat.tsx index 21c85a3..26f8a43 100644 --- a/src/components/messaging/Chat.tsx +++ b/src/components/messaging/Chat.tsx @@ -4,11 +4,24 @@ import useLogger from "../../hooks/useLogger"; import { useAppStore } from "../../stores/AppStore"; import Channel from "../../stores/objects/Channel"; import Guild from "../../stores/objects/Guild"; +import MemberList from "../MemberList"; import ChatHeader from "./ChatHeader"; import MessageInput from "./MessageInput"; import MessageList from "./MessageList"; -const Wrapper = styled.div` +/** + * Wrapps chat and member list into a row + */ +const WrapperOne = styled.div` + display: flex; + flex-direction: row; + flex: 1 1 100%; +`; + +/** + * Wraps the message list, header, and input into a column + */ +const WrapperTwo = styled.div` display: flex; flex-direction: column; flex: 1 1 100%; @@ -26,12 +39,14 @@ const Container = styled.div` interface Props { channel?: Channel; guild?: Guild; + channelId?: string; + guildId?: string; } /** * Main component for rendering channel messages */ -function Chat({ channel, guild }: Props) { +function Chat({ channel, guild, guildId }: Props) { const app = useAppStore(); const logger = useLogger("Messages"); @@ -43,23 +58,41 @@ function Chat({ channel, guild }: Props) { // }); // }, [channel, guild]); + if (guildId && guildId === "@me") { + return ( + + Home Section Placeholder + + ); + } + if (!guild || !channel) { return ( - - - {!guild ? "Unknown Guild" : "Unknown Channel"} - + + + Unknown Guild or Channel + + ); } return ( - - - - - - - + + + + + + + + + + ); } diff --git a/src/components/messaging/MessageList.tsx b/src/components/messaging/MessageList.tsx index 6d8da8c..8d0ceb9 100644 --- a/src/components/messaging/MessageList.tsx +++ b/src/components/messaging/MessageList.tsx @@ -37,7 +37,7 @@ function MessageList({ guild, channel }: Props) { const [hasMore, setHasMore] = React.useState(true); const [canView, setCanView] = React.useState(false); - // handles the initial permission check + // handles the permission check React.useEffect(() => { const permission = Permissions.getPermission(app.account!.id, guild, channel); setCanView(permission.has("READ_MESSAGE_HISTORY")); diff --git a/src/pages/subpages/ChannelPage.tsx b/src/pages/subpages/ChannelPage.tsx index e779288..ab2e695 100644 --- a/src/pages/subpages/ChannelPage.tsx +++ b/src/pages/subpages/ChannelPage.tsx @@ -6,7 +6,6 @@ import ChannelSidebar from "../../components/ChannelSidebar"; import Container from "../../components/Container"; import ContextMenu from "../../components/ContextMenu"; import GuildSidebar from "../../components/GuildSidebar"; -import MemberList from "../../components/MemberList"; import Chat from "../../components/messaging/Chat"; import { ContextMenuContext } from "../../contexts/ContextMenuContext"; import { useAppStore } from "../../stores/AppStore"; @@ -32,8 +31,7 @@ function ChannelPage() { {contextMenu.visible && } - - + ); }