2021-12-23 18:21:42 +01:00
|
|
|
import { Money } from "@styled-icons/boxicons-regular";
|
|
|
|
import {
|
|
|
|
Home as HomeIcon,
|
|
|
|
PlusCircle,
|
|
|
|
Compass,
|
|
|
|
Megaphone,
|
|
|
|
Group,
|
|
|
|
Cog,
|
|
|
|
RightArrowCircle,
|
|
|
|
} from "@styled-icons/boxicons-solid";
|
2021-12-24 12:41:07 +00:00
|
|
|
import { observer } from "mobx-react-lite";
|
2021-06-19 20:24:11 +01:00
|
|
|
import { Link } from "react-router-dom";
|
2021-09-15 14:53:40 +01:00
|
|
|
import styled, { css } from "styled-components";
|
2021-06-19 20:24:11 +01:00
|
|
|
|
2021-07-05 11:23:23 +01:00
|
|
|
import styles from "./Home.module.scss";
|
2021-12-23 13:16:43 +00:00
|
|
|
import "./snow.scss";
|
2021-06-19 20:24:11 +01:00
|
|
|
import { Text } from "preact-i18n";
|
2021-12-24 11:45:49 +00:00
|
|
|
import { useContext, useMemo } from "preact/hooks";
|
2021-09-15 14:53:40 +01:00
|
|
|
|
2021-12-24 17:15:39 +00:00
|
|
|
import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
|
|
|
|
|
2021-12-23 21:43:11 +00:00
|
|
|
import { useApplicationState } from "../../mobx/State";
|
2021-07-05 11:23:23 +01:00
|
|
|
|
2021-10-31 22:42:40 +00:00
|
|
|
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
|
|
|
|
2021-10-23 16:57:07 +01:00
|
|
|
import wideSVG from "../../../public/assets/wide.svg";
|
2021-07-25 14:37:19 +01:00
|
|
|
import Tooltip from "../../components/common/Tooltip";
|
2021-12-24 13:02:49 +00:00
|
|
|
import { PageHeader } 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
|
|
|
|
2021-12-23 13:16:43 +00:00
|
|
|
const Overlay = styled.div`
|
|
|
|
display: grid;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
> * {
|
|
|
|
grid-area: 1 / 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-12-24 12:41:07 +00:00
|
|
|
export default observer(() => {
|
2021-10-31 22:42:40 +00:00
|
|
|
const client = useContext(AppContext);
|
2021-12-24 12:41:07 +00:00
|
|
|
const state = useApplicationState();
|
2021-09-07 10:51:46 -04:00
|
|
|
|
2021-12-24 12:41:07 +00:00
|
|
|
const toggleSeasonalTheme = () =>
|
|
|
|
state.settings.set(
|
|
|
|
"appearance:seasonal",
|
|
|
|
!state.settings.get("appearance:seasonal"),
|
|
|
|
);
|
|
|
|
|
|
|
|
const seasonalTheme = state.settings.get("appearance:seasonal") ?? true;
|
2021-12-24 17:15:39 +00:00
|
|
|
const isDecember = !isTouchscreenDevice && new Date().getMonth() === 11;
|
2021-12-23 13:16:43 +00:00
|
|
|
const snowflakes = useMemo(() => {
|
|
|
|
const flakes = [];
|
|
|
|
|
|
|
|
// Disable outside of December
|
2021-12-24 12:41:07 +00:00
|
|
|
if (!isDecember) return [];
|
2021-12-23 13:16:43 +00:00
|
|
|
|
|
|
|
for (let i = 0; i < 15; i++) {
|
|
|
|
flakes.push("❄️");
|
|
|
|
flakes.push("❄");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (let i = 0; i < 2; i++) {
|
|
|
|
flakes.push("🎄");
|
|
|
|
flakes.push("☃️");
|
|
|
|
flakes.push("⛄");
|
|
|
|
}
|
|
|
|
|
|
|
|
return flakes;
|
|
|
|
}, []);
|
|
|
|
|
2021-07-05 11:25:20 +01:00
|
|
|
return (
|
|
|
|
<div className={styles.home}>
|
2021-12-23 13:16:43 +00:00
|
|
|
<Overlay>
|
2021-12-24 12:41:07 +00:00
|
|
|
{seasonalTheme && (
|
|
|
|
<div class="snowfall">
|
|
|
|
{snowflakes.map((emoji, index) => (
|
|
|
|
<div key={index} class="snowflake">
|
|
|
|
{emoji}
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)}
|
2021-12-23 18:21:42 +01:00
|
|
|
<div className="content">
|
2021-12-24 13:02:49 +00:00
|
|
|
<PageHeader icon={<HomeIcon size={24} />}>
|
2021-12-23 13:16:43 +00:00
|
|
|
<Text id="app.navigation.tabs.home" />
|
2021-12-24 13:02:49 +00:00
|
|
|
</PageHeader>
|
2021-12-23 18:21:42 +01:00
|
|
|
<div className={styles.homeScreen}>
|
|
|
|
<h3>
|
|
|
|
<Text id="app.special.modals.onboarding.welcome" />
|
|
|
|
<br />
|
|
|
|
<img src={wideSVG} />
|
|
|
|
</h3>
|
|
|
|
<div className={styles.actions}>
|
2021-12-23 13:16:43 +00:00
|
|
|
<Link to="/settings">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
2021-12-23 18:21:42 +01:00
|
|
|
icon={<PlusCircle size={32} />}
|
|
|
|
description={
|
|
|
|
"Invite all of your friends, some cool bots, and throw a big party."
|
|
|
|
}>
|
|
|
|
Create a group
|
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
|
|
|
<a
|
|
|
|
href="https://revolt.social"
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer">
|
|
|
|
<CategoryButton
|
|
|
|
action="external"
|
|
|
|
icon={<Compass size={32} />}
|
|
|
|
description={
|
|
|
|
"Find a community based on your hobbies or interests."
|
|
|
|
}>
|
|
|
|
Join a community
|
|
|
|
</CategoryButton>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
{client.servers.get(
|
|
|
|
"01F7ZSBSFHQ8TA81725KQCSDDP",
|
|
|
|
) ? (
|
|
|
|
<Link to="/server/01F7ZSBSFHQ8TA81725KQCSDDP">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<RightArrowCircle size={32} />}
|
|
|
|
description={
|
|
|
|
"You can report issues and discuss improvements with us directly here."
|
|
|
|
}>
|
|
|
|
<Text id="app.home.goto-testers" />
|
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
|
|
|
) : (
|
|
|
|
<Link to="/invite/Testers">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Group size={32} />}
|
|
|
|
description={
|
|
|
|
"You can report issues and discuss improvements with us directly here."
|
|
|
|
}>
|
|
|
|
<Text id="app.home.join-testers" />
|
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Link to="/settings/feedback">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Megaphone size={32} />}
|
|
|
|
description={
|
|
|
|
"Let us know how we can improve our app by giving us feedback."
|
|
|
|
}>
|
|
|
|
<Text id="app.home.feedback" />
|
2021-12-23 13:16:43 +00:00
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
2021-12-23 18:21:42 +01:00
|
|
|
<a
|
|
|
|
href="https://insrt.uk/donate"
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer">
|
|
|
|
<CategoryButton
|
|
|
|
action="external"
|
|
|
|
icon={<Money size={32} />}>
|
|
|
|
<Text id="app.home.donate" />
|
|
|
|
</CategoryButton>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<Tooltip
|
|
|
|
content={
|
|
|
|
<Text id="app.home.settings-tooltip" />
|
|
|
|
}>
|
|
|
|
<Link to="/settings">
|
|
|
|
<CategoryButton
|
|
|
|
action="chevron"
|
|
|
|
icon={<Cog size={32} />}>
|
|
|
|
<Text id="app.home.settings" />
|
|
|
|
</CategoryButton>
|
|
|
|
</Link>
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
2021-12-24 12:41:07 +00:00
|
|
|
{isDecember && (
|
|
|
|
<a href="#" onClick={toggleSeasonalTheme}>
|
|
|
|
Turn {seasonalTheme ? "off" : "on"} homescreen
|
|
|
|
effects
|
|
|
|
</a>
|
|
|
|
)}
|
2021-12-23 13:16:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-23 18:21:42 +01:00
|
|
|
</Overlay>{" "}
|
2021-07-05 11:25:20 +01:00
|
|
|
</div>
|
|
|
|
);
|
2021-12-24 12:41:07 +00:00
|
|
|
});
|