2021-06-20 12:31:53 -04:00
|
|
|
import styled from "styled-components";
|
|
|
|
import { useParams } from "react-router-dom";
|
|
|
|
import Header from "../../components/ui/Header";
|
|
|
|
import { useRenderState } from "../../lib/renderer/Singleton";
|
|
|
|
import { useChannel, useForceUpdate, useUsers } from "../../context/revoltjs/hooks";
|
|
|
|
import { MessageArea } from "./messaging/MessageArea";
|
2021-06-20 15:30:42 -04:00
|
|
|
import MessageBox from "../../components/common/messaging/MessageBox";
|
2021-06-20 12:31:53 -04:00
|
|
|
|
|
|
|
const ChannelMain = styled.div`
|
|
|
|
flex-grow: 1;
|
|
|
|
display: flex;
|
|
|
|
min-height: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
flex-direction: row;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const ChannelContent = styled.div`
|
|
|
|
flex-grow: 1;
|
|
|
|
display: flex;
|
|
|
|
overflow: hidden;
|
|
|
|
flex-direction: column;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default function Channel() {
|
|
|
|
const { channel: id } = useParams<{ channel: string }>();
|
|
|
|
|
|
|
|
const ctx = useForceUpdate();
|
|
|
|
const channel = useChannel(id, ctx);
|
|
|
|
|
|
|
|
if (!channel) return null;
|
|
|
|
// const view = useRenderState(id);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Header placement="primary">
|
|
|
|
Channel
|
|
|
|
</Header>
|
|
|
|
<ChannelMain>
|
|
|
|
<ChannelContent>
|
|
|
|
<MessageArea id={id} />
|
2021-06-20 15:30:42 -04:00
|
|
|
<MessageBox channel={channel} />
|
2021-06-20 12:31:53 -04:00
|
|
|
</ChannelContent>
|
|
|
|
</ChannelMain>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|