Merge branch 'main' of github.com:Central-University-IT-prod/PROD-Animulichki-SkillHub
This commit is contained in:
@@ -47,7 +47,12 @@ const router = createBrowserRouter([
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "admin",
|
path: "admin",
|
||||||
element: <AdminPage />
|
element: <AdminPage />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "*",
|
||||||
|
element: <AdminPage />
|
||||||
|
}],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "skill-tree",
|
path: "skill-tree",
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const Main = () => {
|
|||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
<Button variant="link" asChild>
|
<Button variant="link" asChild>
|
||||||
<Link to={"/dash/admin"}>{t("iorganizer")}</Link>
|
<Link to={"/dash/skill-tree"}>{t("iorganizer")}</Link>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className={less["general-right"] + " shadow"}></div>
|
<div className={less["general-right"] + " shadow"}></div>
|
||||||
|
|||||||
@@ -7,5 +7,9 @@
|
|||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
.right{
|
.right{
|
||||||
|
width: 50%;
|
||||||
|
|
||||||
|
}
|
||||||
|
.card{
|
||||||
|
margin: 10px;
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,48 @@
|
|||||||
import { Input } from "../../ui/input";
|
import { Input } from "../../ui/input";
|
||||||
import VacancyCard from "../../entities/VacancyCard/VacancyCard";
|
|
||||||
import { Textarea } from "../../shared/ui/textarea";
|
import { Textarea } from "../../shared/ui/textarea";
|
||||||
import { Label } from "../../shared/ui/label";
|
import { Label } from "../../shared/ui/label";
|
||||||
import { Button } from "../../shared/ui/button";
|
import { Button } from "../../shared/ui/button";
|
||||||
|
|
||||||
import less from "./SkillTree.module.less";
|
import less from "./SkillTree.module.less";
|
||||||
import { Switch } from "../../shared/ui/switch";
|
import { Switch } from "../../shared/ui/switch";
|
||||||
import { addEvent } from "../../widgets/Header/AuthAPI";
|
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { ToastAction } from "../../shared/ui/toast"
|
import { ToastAction } from "../../shared/ui/toast";
|
||||||
import { useToast } from "../../shared/ui/use-toast"
|
import { useToast } from "../../shared/ui/use-toast";
|
||||||
|
|
||||||
import { buttonVariants } from "../../ui/button";
|
import { buttonVariants } from "../../ui/button";
|
||||||
|
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";
|
||||||
|
|
||||||
const SkillTree = () => {
|
const SkillTree = () => {
|
||||||
const { toast } = useToast()
|
const { toast } = useToast();
|
||||||
|
const [events, setEvents] = useState<Event[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
eventList()
|
||||||
|
.then((data) => {
|
||||||
|
setEvents(data);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Возникла ошибка с получением:", error);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`${less["general"]} container`}>
|
<div className={`${less["general"]} container`}>
|
||||||
@@ -75,8 +104,32 @@ const SkillTree = () => {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div className={less["right"]}>
|
<div className={less["right"]}>
|
||||||
<VacancyCard></VacancyCard>
|
{events.map((event) => (
|
||||||
<VacancyCard></VacancyCard>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export const addEvent = (e: FormEvent<HTMLFormElement>) => {
|
|||||||
console.log(response.status);
|
console.log(response.status);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log('Создан:', response.headers.get('Location'));
|
console.log('Создан:', response.headers.get('Location'));
|
||||||
|
window.location.reload();
|
||||||
return response.json();
|
return response.json();
|
||||||
} else {
|
} else {
|
||||||
return response.text().then(errorMessage => {
|
return response.text().then(errorMessage => {
|
||||||
|
|||||||
Reference in New Issue
Block a user