2021-07-05 11:23:23 +01:00
|
|
|
import { Home as HomeIcon } from "@styled-icons/boxicons-solid";
|
2021-06-19 20:24:11 +01:00
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
2021-07-05 11:23:23 +01:00
|
|
|
import styles from "./Home.module.scss";
|
2021-06-19 20:24:11 +01:00
|
|
|
import { Text } from "preact-i18n";
|
2021-07-05 11:23:23 +01:00
|
|
|
|
|
|
|
import wideSVG from "../../assets/wide.svg";
|
2021-08-17 13:52:02 +01:00
|
|
|
import Emoji from "../../components/common/Emoji";
|
2021-07-25 14:37:19 +01:00
|
|
|
import Tooltip from "../../components/common/Tooltip";
|
2021-06-19 20:24:11 +01:00
|
|
|
import Header from "../../components/ui/Header";
|
2021-08-17 13:52:02 +01:00
|
|
|
import CategoryButton from "../../components/ui/fluent/CategoryButton";
|
2021-09-07 10:51:46 -04:00
|
|
|
import { dispatch, getState } from "../../redux";
|
|
|
|
import { useState } from "preact/hooks";
|
|
|
|
import styled from "styled-components";
|
|
|
|
|
|
|
|
const CHANNELS_SIDEBAR_KEY = "sidebar_channels";
|
|
|
|
|
|
|
|
const IconConainer = styled.div`
|
|
|
|
cursor: pointer;
|
|
|
|
color: var(--secondary-foreground);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--foreground);
|
|
|
|
}
|
|
|
|
`
|
2021-06-20 11:05:12 +01:00
|
|
|
|
2021-06-19 12:34:53 +01:00
|
|
|
export default function Home() {
|
2021-09-07 10:51:46 -04:00
|
|
|
const [showChannels, setChannels] = useState(
|
|
|
|
getState().sectionToggle[CHANNELS_SIDEBAR_KEY] ?? true,
|
|
|
|
);
|
|
|
|
|
|
|
|
const toggleChannelSidebar = () => {
|
|
|
|
setChannels(!showChannels);
|
|
|
|
|
|
|
|
if (showChannels) {
|
|
|
|
dispatch({
|
|
|
|
type: "SECTION_TOGGLE_SET",
|
|
|
|
id: CHANNELS_SIDEBAR_KEY,
|
|
|
|
state: false,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
dispatch({
|
|
|
|
type: "SECTION_TOGGLE_UNSET",
|
|
|
|
id: CHANNELS_SIDEBAR_KEY,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
return (
|
|
|
|
<div className={styles.home}>
|
|
|
|
<Header placement="primary">
|
2021-09-07 10:51:46 -04:00
|
|
|
<IconConainer onClick={toggleChannelSidebar} ><HomeIcon size={24} /></IconConainer>
|
2021-07-05 11:25:20 +01:00
|
|
|
<Text id="app.navigation.tabs.home" />
|
|
|
|
</Header>
|
|
|
|
<h3>
|
2021-08-02 22:03:59 +01:00
|
|
|
<Text id="app.special.modals.onboarding.welcome" />
|
|
|
|
<br />
|
2021-07-05 11:25:20 +01:00
|
|
|
<img src={wideSVG} />
|
|
|
|
</h3>
|
2021-07-09 16:23:06 +01:00
|
|
|
<div className={styles.actions}>
|
|
|
|
<Link to="/invite/Testers">
|
2021-08-17 13:52:02 +01:00
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Emoji emoji="😁" size={32} />}>
|
2021-07-09 16:23:06 +01:00
|
|
|
Join testers server
|
2021-08-17 13:52:02 +01:00
|
|
|
</CategoryButton>
|
2021-07-09 16:23:06 +01:00
|
|
|
</Link>
|
2021-08-02 22:03:59 +01:00
|
|
|
<a
|
|
|
|
href="https://insrt.uk/donate"
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer">
|
2021-08-17 13:52:02 +01:00
|
|
|
<CategoryButton
|
|
|
|
action="external"
|
|
|
|
icon={<Emoji emoji="💷" size={32} />}>
|
2021-08-02 22:03:59 +01:00
|
|
|
Donate to Revolt
|
2021-08-17 13:52:02 +01:00
|
|
|
</CategoryButton>
|
2021-08-02 22:03:59 +01:00
|
|
|
</a>
|
2021-07-09 16:23:06 +01:00
|
|
|
<Link to="/settings/feedback">
|
2021-08-17 13:52:02 +01:00
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Emoji emoji="🎉" size={32} />}>
|
|
|
|
Give feedback
|
|
|
|
</CategoryButton>
|
2021-07-25 14:37:19 +01:00
|
|
|
</Link>
|
2021-08-17 13:52:02 +01:00
|
|
|
<Tooltip content="You can also right-click the user icon in the top left, or left click it if you're already home.">
|
|
|
|
<Link to="/settings">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Emoji emoji="🔧" size={32} />}>
|
|
|
|
Settings
|
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
|
|
|
</Tooltip>
|
2021-07-09 16:23:06 +01:00
|
|
|
</div>
|
2021-07-05 11:25:20 +01:00
|
|
|
</div>
|
|
|
|
);
|
2021-06-19 12:34:53 +01:00
|
|
|
}
|