Compare commits
2 Commits
db9132de4d
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d4858bcbb | |||
| b2feaac3e1 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "anti-hvost",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
12
src/constructors/Component.tsx
Normal file
12
src/constructors/Component.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { FunctionComponent } from "preact";
|
||||
import { useEffect } from "preact/hooks";
|
||||
|
||||
export const withTitle = <P,>(title: string, WrappedComponent: FunctionComponent<P>): FunctionComponent<P> => {
|
||||
const ComponentWithTitle: FunctionComponent<P> = (props) => {
|
||||
useEffect(() => {
|
||||
document.title = title;
|
||||
}, []);
|
||||
return <WrappedComponent {...props} />;
|
||||
};
|
||||
return ComponentWithTitle;
|
||||
};
|
||||
@@ -1,15 +1,12 @@
|
||||
import Button from "@/components/ui/Button";
|
||||
import { withTitle } from "@/constructors/Component";
|
||||
import { UrlsTitle } from "@/enums/urls";
|
||||
import { FunctionComponent } from "preact";
|
||||
import { useLocation } from "preact-iso";
|
||||
import { useEffect } from "preact/hooks";
|
||||
import classes from "./404.module.scss";
|
||||
|
||||
const Page404: FunctionComponent = () => {
|
||||
const { route } = useLocation();
|
||||
useEffect(() => {
|
||||
document.title = UrlsTitle.PAGE404;
|
||||
}, []);
|
||||
return (
|
||||
<div id={classes.container}>
|
||||
<div id={classes.main_container}>
|
||||
@@ -27,4 +24,4 @@ const Page404: FunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Page404;
|
||||
export default withTitle(UrlsTitle.PAGE404, Page404);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { withTitle } from "@/constructors/Component";
|
||||
import { UrlsTitle } from "@/enums/urls";
|
||||
import { cn } from "@/utils/class-merge";
|
||||
import { FunctionComponent, h } from "preact";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { useState } from "preact/hooks";
|
||||
|
||||
type MarkedDateType = "event" | "holiday" | "important" | string;
|
||||
type MarkedDates = Record<string, MarkedDateType>;
|
||||
@@ -17,9 +18,6 @@ const BigCalendar: FunctionComponent<BigCalendarProps> = ({
|
||||
markedDates = {},
|
||||
className = "",
|
||||
}: BigCalendarProps) => {
|
||||
useEffect(() => {
|
||||
document.title = UrlsTitle.CALENDAR;
|
||||
}, []);
|
||||
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
||||
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
||||
|
||||
@@ -251,4 +249,4 @@ const BigCalendar: FunctionComponent<BigCalendarProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default BigCalendar;
|
||||
export default withTitle(UrlsTitle.CALENDAR, BigCalendar);
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import Button from "@/components/ui/Button";
|
||||
import Input from "@/components/ui/Input";
|
||||
import { withTitle } from "@/constructors/Component";
|
||||
import { UrlsTitle } from "@/enums/urls";
|
||||
import { useAppContext } from "@/providers/AuthProvider";
|
||||
import { FunctionComponent } from "preact";
|
||||
import { useLocation } from "preact-iso";
|
||||
import { useEffect } from "preact/hooks";
|
||||
import classes from "./login.module.scss";
|
||||
const LoginPage: FunctionComponent = () => {
|
||||
const { isLoggedIn } = useAppContext();
|
||||
const { route } = useLocation();
|
||||
useEffect(() => {
|
||||
document.title = UrlsTitle.LOGIN;
|
||||
}, []);
|
||||
return (
|
||||
<div class={classes.login_container}>
|
||||
<div class={classes.login_card}>
|
||||
@@ -33,4 +30,4 @@ const LoginPage: FunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default LoginPage;
|
||||
export default withTitle(UrlsTitle.LOGIN, LoginPage);
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import Button from "@/components/ui/Button";
|
||||
import { withTitle } from "@/constructors/Component";
|
||||
import { UrlsTitle } from "@/enums/urls";
|
||||
import { useAppContext } from "@/providers/AuthProvider";
|
||||
import { FunctionComponent } from "preact";
|
||||
import { useLocation } from "preact-iso";
|
||||
import { useEffect } from "preact/hooks";
|
||||
import classes from "./profile_settings.module.scss";
|
||||
|
||||
const ProfileSettings: FunctionComponent = () => {
|
||||
const { isLoggedIn } = useAppContext();
|
||||
const { route } = useLocation();
|
||||
useEffect(() => {
|
||||
document.title = UrlsTitle.PROFILE;
|
||||
}, []);
|
||||
return (
|
||||
<div class={classes.container}>
|
||||
<div id={classes.avatar}>Аватар</div>
|
||||
@@ -42,4 +39,4 @@ const ProfileSettings: FunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ProfileSettings;
|
||||
export default withTitle(UrlsTitle.PROFILE, ProfileSettings);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import Task from "@/components/task";
|
||||
import { withTitle } from "@/constructors/Component";
|
||||
import { UrlsTitle } from "@/enums/urls";
|
||||
import { FunctionComponent } from "preact";
|
||||
import { useEffect, useMemo } from "preact/hooks";
|
||||
import { useMemo } from "preact/hooks";
|
||||
import classes from "./profile_tasks.module.scss";
|
||||
|
||||
const example_tasks = ["Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6", "Test 7", "Test 8"];
|
||||
@@ -12,9 +13,6 @@ const ProfileTasks: FunctionComponent = () => {
|
||||
const formatter = new Intl.DateTimeFormat("ru-RU", { month: "long", day: "numeric" });
|
||||
return formatter.format(date);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
document.title = UrlsTitle.TASKS;
|
||||
}, []);
|
||||
return (
|
||||
<div class={classes.container}>
|
||||
<div class={classes.header}>Сегодня: {getDate}</div>
|
||||
@@ -27,4 +25,4 @@ const ProfileTasks: FunctionComponent = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default ProfileTasks;
|
||||
export default withTitle(UrlsTitle.TASKS, ProfileTasks);
|
||||
|
||||
Reference in New Issue
Block a user