mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
feat(header): add chevron / unified sidebar collapse
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { At, Hash } from "@styled-icons/boxicons-regular";
|
||||
import {
|
||||
At,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
Hash,
|
||||
} from "@styled-icons/boxicons-regular";
|
||||
import { Notepad, Group } from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Channel } from "revolt.js/dist/maps/Channels";
|
||||
@@ -8,14 +13,17 @@ import styled, { css } from "styled-components";
|
||||
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
||||
|
||||
import { useApplicationState } from "../../mobx/State";
|
||||
import { SIDEBAR_MEMBERS } from "../../mobx/stores/Layout";
|
||||
import { SIDEBAR_CHANNELS, SIDEBAR_MEMBERS } from "../../mobx/stores/Layout";
|
||||
|
||||
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
||||
import { getChannelName } from "../../context/revoltjs/util";
|
||||
|
||||
import { useStatusColour } from "../../components/common/user/UserIcon";
|
||||
import UserStatus from "../../components/common/user/UserStatus";
|
||||
import Header, { HamburgerAction } from "../../components/ui/Header";
|
||||
import Header, {
|
||||
HamburgerAction,
|
||||
PageHeader,
|
||||
} from "../../components/ui/Header";
|
||||
|
||||
import Markdown from "../../components/markdown/Markdown";
|
||||
import HeaderActions from "./actions/HeaderActions";
|
||||
@@ -68,25 +76,6 @@ const Info = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const IconConainer = styled.div`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
color: var(--secondary-foreground);
|
||||
margin-right: 5px;
|
||||
|
||||
> svg {
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
${!isTouchscreenDevice &&
|
||||
css`
|
||||
&:hover {
|
||||
color: var(--foreground);
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
export default observer(({ channel }: ChannelHeaderProps) => {
|
||||
const { openScreen } = useIntermediate();
|
||||
const layout = useApplicationState().layout;
|
||||
@@ -110,15 +99,7 @@ export default observer(({ channel }: ChannelHeaderProps) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Header placement="primary">
|
||||
<HamburgerAction />
|
||||
<IconConainer
|
||||
onClick={() =>
|
||||
layout.toggleSectionState(SIDEBAR_MEMBERS, true)
|
||||
}>
|
||||
{/*isTouchscreenDevice && <ChevronLeft size={18} /> FIXME: requires mobx merge */}
|
||||
{icon}
|
||||
</IconConainer>
|
||||
<PageHeader icon={icon}>
|
||||
<Info>
|
||||
<span className="name">{name}</span>
|
||||
{isTouchscreenDevice &&
|
||||
@@ -162,6 +143,6 @@ export default observer(({ channel }: ChannelHeaderProps) => {
|
||||
)}
|
||||
</Info>
|
||||
<HeaderActions channel={channel} />
|
||||
</Header>
|
||||
</PageHeader>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { TextReact } from "../../lib/i18n";
|
||||
|
||||
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
||||
|
||||
import Header from "../../components/ui/Header";
|
||||
import Header, { PageHeader } from "../../components/ui/Header";
|
||||
|
||||
export default function Developer() {
|
||||
// const voice = useContext(VoiceContext);
|
||||
@@ -27,10 +27,7 @@ export default function Developer() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Header placement="primary">
|
||||
<Wrench size="24" />
|
||||
Developer Tab
|
||||
</Header>
|
||||
<PageHeader icon={<Wrench size="24" />}>Developer Tab</PageHeader>
|
||||
<div style={{ padding: "16px" }}>
|
||||
<PaintCounter always />
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ import { useClient } from "../../context/revoltjs/RevoltClient";
|
||||
import CollapsibleSection from "../../components/common/CollapsibleSection";
|
||||
import Tooltip from "../../components/common/Tooltip";
|
||||
import UserIcon from "../../components/common/user/UserIcon";
|
||||
import Header from "../../components/ui/Header";
|
||||
import Header, { PageHeader } from "../../components/ui/Header";
|
||||
import IconButton from "../../components/ui/IconButton";
|
||||
|
||||
import { Children } from "../../types/Preact";
|
||||
@@ -72,8 +72,7 @@ export default observer(() => {
|
||||
const isEmpty = lists.reduce((p: number, n) => p + n.length, 0) === 0;
|
||||
return (
|
||||
<>
|
||||
<Header placement="primary">
|
||||
{!isTouchscreenDevice && <UserDetail size={24} />}
|
||||
<PageHeader icon={<UserDetail size={24} />} noBurger>
|
||||
<div className={styles.title}>
|
||||
<Text id="app.navigation.tabs.friends" />
|
||||
</div>
|
||||
@@ -115,7 +114,7 @@ export default observer(() => {
|
||||
</Tooltip>
|
||||
*/}
|
||||
</div>
|
||||
</Header>
|
||||
</PageHeader>
|
||||
<div
|
||||
className={styles.list}
|
||||
data-empty={isEmpty}
|
||||
|
||||
@@ -17,30 +17,15 @@ import "./snow.scss";
|
||||
import { Text } from "preact-i18n";
|
||||
import { useContext, useMemo } from "preact/hooks";
|
||||
|
||||
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
||||
|
||||
import { useApplicationState } from "../../mobx/State";
|
||||
import { SIDEBAR_CHANNELS } from "../../mobx/stores/Layout";
|
||||
|
||||
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
||||
|
||||
import wideSVG from "../../../public/assets/wide.svg";
|
||||
import Tooltip from "../../components/common/Tooltip";
|
||||
import Header from "../../components/ui/Header";
|
||||
import { PageHeader } from "../../components/ui/Header";
|
||||
import CategoryButton from "../../components/ui/fluent/CategoryButton";
|
||||
|
||||
const IconConainer = styled.div`
|
||||
cursor: pointer;
|
||||
color: var(--secondary-foreground);
|
||||
|
||||
${!isTouchscreenDevice &&
|
||||
css`
|
||||
&:hover {
|
||||
color: var(--foreground);
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
const Overlay = styled.div`
|
||||
display: grid;
|
||||
height: 100%;
|
||||
@@ -58,14 +43,6 @@ export default observer(() => {
|
||||
const client = useContext(AppContext);
|
||||
const state = useApplicationState();
|
||||
|
||||
const toggleChannelSidebar = () => {
|
||||
if (isTouchscreenDevice) {
|
||||
return;
|
||||
}
|
||||
|
||||
state.layout.toggleSectionState(SIDEBAR_CHANNELS, true);
|
||||
};
|
||||
|
||||
const toggleSeasonalTheme = () =>
|
||||
state.settings.set(
|
||||
"appearance:seasonal",
|
||||
@@ -107,12 +84,9 @@ export default observer(() => {
|
||||
</div>
|
||||
)}
|
||||
<div className="content">
|
||||
<Header placement="primary">
|
||||
<IconConainer onClick={toggleChannelSidebar}>
|
||||
<HomeIcon size={24} />
|
||||
</IconConainer>
|
||||
<PageHeader icon={<HomeIcon size={24} />}>
|
||||
<Text id="app.navigation.tabs.home" />
|
||||
</Header>
|
||||
</PageHeader>
|
||||
<div className={styles.homeScreen}>
|
||||
<h3>
|
||||
<Text id="app.special.modals.onboarding.welcome" />
|
||||
|
||||
Reference in New Issue
Block a user