feat: page titles
This commit is contained in:
@@ -6,7 +6,12 @@ interface TaskProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Task: FunctionComponent<TaskProps> = ({ name }: TaskProps) => {
|
const Task: FunctionComponent<TaskProps> = ({ name }: TaskProps) => {
|
||||||
return <div class={classes.task}>{name}</div>;
|
return (
|
||||||
|
// Временное действие для тестирования
|
||||||
|
<button onClick={() => alert(name)}>
|
||||||
|
<div class={classes.task}>{name}</div>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Task;
|
export default Task;
|
||||||
|
|||||||
7
src/enums/urls.ts
Normal file
7
src/enums/urls.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export enum UrlsTitle {
|
||||||
|
LOGIN = "Авторизация",
|
||||||
|
PROFILE = "Профиль",
|
||||||
|
TASKS = "Задачи",
|
||||||
|
CALENDAR = "Календарь",
|
||||||
|
PAGE404 = "404",
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import { UrlsTitle } from "@/enums/urls";
|
||||||
import { cn } from "@/utils/class-merge";
|
import { cn } from "@/utils/class-merge";
|
||||||
import { FunctionComponent, h } from "preact";
|
import { FunctionComponent, h } from "preact";
|
||||||
import { useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
|
|
||||||
type MarkedDateType = "event" | "holiday" | "important" | string;
|
type MarkedDateType = "event" | "holiday" | "important" | string;
|
||||||
type MarkedDates = Record<string, MarkedDateType>;
|
type MarkedDates = Record<string, MarkedDateType>;
|
||||||
@@ -16,6 +17,9 @@ const BigCalendar: FunctionComponent<BigCalendarProps> = ({
|
|||||||
markedDates = {},
|
markedDates = {},
|
||||||
className = "",
|
className = "",
|
||||||
}: BigCalendarProps) => {
|
}: BigCalendarProps) => {
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = UrlsTitle.CALENDAR;
|
||||||
|
}, []);
|
||||||
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
||||||
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import Button from "@/components/ui/Button";
|
import Button from "@/components/ui/Button";
|
||||||
import Input from "@/components/ui/Input";
|
import Input from "@/components/ui/Input";
|
||||||
|
import { UrlsTitle } from "@/enums/urls";
|
||||||
import { useAppContext } from "@/providers/AuthProvider";
|
import { useAppContext } from "@/providers/AuthProvider";
|
||||||
import { FunctionComponent } from "preact";
|
import { FunctionComponent } from "preact";
|
||||||
import { useLocation } from "preact-iso";
|
import { useLocation } from "preact-iso";
|
||||||
|
import { useEffect } from "preact/hooks";
|
||||||
import classes from "./login.module.scss";
|
import classes from "./login.module.scss";
|
||||||
const LoginPage: FunctionComponent = () => {
|
const LoginPage: FunctionComponent = () => {
|
||||||
const { isLoggedIn } = useAppContext();
|
const { isLoggedIn } = useAppContext();
|
||||||
const { route } = useLocation();
|
const { route } = useLocation();
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = UrlsTitle.LOGIN;
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div class={classes.login_container}>
|
<div class={classes.login_container}>
|
||||||
<div class={classes.login_card}>
|
<div class={classes.login_card}>
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import Button from "@/components/ui/Button";
|
import Button from "@/components/ui/Button";
|
||||||
|
import { UrlsTitle } from "@/enums/urls";
|
||||||
import { useAppContext } from "@/providers/AuthProvider";
|
import { useAppContext } from "@/providers/AuthProvider";
|
||||||
import { FunctionComponent } from "preact";
|
import { FunctionComponent } from "preact";
|
||||||
import { useLocation } from "preact-iso";
|
import { useLocation } from "preact-iso";
|
||||||
|
import { useEffect } from "preact/hooks";
|
||||||
import classes from "./profile_settings.module.scss";
|
import classes from "./profile_settings.module.scss";
|
||||||
|
|
||||||
const ProfileSettings: FunctionComponent = () => {
|
const ProfileSettings: FunctionComponent = () => {
|
||||||
const { isLoggedIn } = useAppContext();
|
const { isLoggedIn } = useAppContext();
|
||||||
const { route } = useLocation();
|
const { route } = useLocation();
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = UrlsTitle.PROFILE;
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div class={classes.container}>
|
<div class={classes.container}>
|
||||||
<div id={classes.avatar}>Аватар</div>
|
<div id={classes.avatar}>Аватар</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Task from "@/components/task";
|
import Task from "@/components/task";
|
||||||
|
import { UrlsTitle } from "@/enums/urls";
|
||||||
import { FunctionComponent } from "preact";
|
import { FunctionComponent } from "preact";
|
||||||
import { useMemo } from "preact/hooks";
|
import { useEffect, useMemo } from "preact/hooks";
|
||||||
import classes from "./profile_tasks.module.scss";
|
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"];
|
const example_tasks = ["Test 1", "Test 2", "Test 3", "Test 4", "Test 5", "Test 6", "Test 7", "Test 8"];
|
||||||
@@ -11,6 +12,9 @@ const ProfileTasks: FunctionComponent = () => {
|
|||||||
const formatter = new Intl.DateTimeFormat("ru-RU", { month: "long", day: "numeric" });
|
const formatter = new Intl.DateTimeFormat("ru-RU", { month: "long", day: "numeric" });
|
||||||
return formatter.format(date);
|
return formatter.format(date);
|
||||||
}, []);
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
document.title = UrlsTitle.TASKS;
|
||||||
|
}, []);
|
||||||
return (
|
return (
|
||||||
<div class={classes.container}>
|
<div class={classes.container}>
|
||||||
<div class={classes.header}>Сегодня: {getDate}</div>
|
<div class={classes.header}>Сегодня: {getDate}</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user