create admin dashboard
This commit is contained in:
@@ -47,7 +47,12 @@ const router = createBrowserRouter([
|
||||
},
|
||||
{
|
||||
path: "admin",
|
||||
element: <AdminPage />
|
||||
element: <AdminPage />,
|
||||
children: [
|
||||
{
|
||||
path: "*",
|
||||
element: <AdminPage />
|
||||
}],
|
||||
},
|
||||
{
|
||||
path: "skill-tree",
|
||||
|
||||
@@ -85,7 +85,7 @@ const Main = () => {
|
||||
</Card>
|
||||
))}
|
||||
<Button variant="link" asChild>
|
||||
<Link to={"/dash/admin"}>{t("iorganizer")}</Link>
|
||||
<Link to={"/dash/skill-tree"}>{t("iorganizer")}</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className={less["general-right"] + " shadow"}></div>
|
||||
|
||||
@@ -7,5 +7,9 @@
|
||||
width: 50%;
|
||||
}
|
||||
.right{
|
||||
width: 50%;
|
||||
|
||||
}
|
||||
.card{
|
||||
margin: 10px;
|
||||
}
|
||||
@@ -3,14 +3,42 @@ import VacancyCard from "../../entities/VacancyCard/VacancyCard";
|
||||
import { Textarea } from "../../shared/ui/textarea";
|
||||
import { Button } from "../../shared/ui/button";
|
||||
import less from "./SkillTree.module.less"
|
||||
import { t } from "i18next";
|
||||
import { Switch } from "../../shared/ui/switch";
|
||||
import { addEvent } from "../../widgets/Header/AuthAPI";
|
||||
|
||||
import { addEvent, submitRegister } from "../../widgets/Header/AuthAPI";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "../../ui/card";
|
||||
import { TrashIcon } from "lucide-react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "../../shared/ui/dialog";
|
||||
import { t } from "i18next";
|
||||
import { useEffect, useState } from "react";
|
||||
import { eventList } from "../AdminEventPage/AdminEventAPI";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const SkillTree = () => {
|
||||
|
||||
const [events, setEvents] = useState<Event[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
eventList()
|
||||
.then((data) => {
|
||||
setEvents(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Возникла ошибка с получением:", error);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={less["general"]}>
|
||||
@@ -26,8 +54,26 @@ const SkillTree = () => {
|
||||
</form>
|
||||
</div>
|
||||
<div className={less["right"]}>
|
||||
<VacancyCard ></VacancyCard>
|
||||
<VacancyCard ></VacancyCard>
|
||||
{events.map((event) => (
|
||||
<Card className={`${less["card"]} flex flex-row `}>
|
||||
<div className="flex flex-col">
|
||||
<CardHeader className={less["header"]}>
|
||||
<div className={less["up"]}>
|
||||
<CardTitle className="p-0">{event.title}</CardTitle>
|
||||
<CardDescription>Дата начала: {event.start_date}</CardDescription>
|
||||
</div>
|
||||
{false && (
|
||||
<Button size="icon" variant="ghost" ><TrashIcon /></Button>
|
||||
)}
|
||||
</CardHeader>
|
||||
<CardContent className="p-0 mt-4" >
|
||||
<p>{event.description}</p>
|
||||
</CardContent>
|
||||
<Button> <Link to={`../admin/${event.id}`}>Event Management</Link></Button>
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -90,6 +90,7 @@ export const addEvent = (e: FormEvent<HTMLFormElement>) => {
|
||||
console.log(response.status);
|
||||
if (response.ok) {
|
||||
console.log('Создан:', response.headers.get('Location'));
|
||||
window.location.reload();
|
||||
return response.json();
|
||||
} else {
|
||||
return response.text().then(errorMessage => {
|
||||
|
||||
Reference in New Issue
Block a user