diff --git a/package-lock.json b/package-lock.json index fedf51a..73f617d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "mobx-react-lite": "^4.1.0", "npm": "^10.9.2", "react": "^19.0.0", - "react-day-picker": "^9.7.0", + "react-day-picker": "^8.10.1", "react-dom": "^19.0.0", "react-hook-form": "^7.56.4", "react-hot-toast": "^2.5.2", @@ -67,12 +67,6 @@ "vite-tsconfig-paths": "^5.1.4" } }, - "node_modules/@date-fns/tz": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@date-fns/tz/-/tz-1.2.0.tgz", - "integrity": "sha512-LBrd7MiJZ9McsOgxqWX7AaxrDjcFVjWH/tIKJd7pnR7McaslGYOP1QmmiBXdJH/H/yLCT+rcQ7FaPBUxRGUtrg==", - "license": "MIT" - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.25.2", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz", @@ -80,6 +74,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -96,6 +91,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -112,6 +108,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -128,6 +125,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -144,6 +142,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -160,6 +159,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -176,6 +176,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -192,6 +193,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -208,6 +210,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -224,6 +227,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -240,6 +244,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -256,6 +261,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -272,6 +278,7 @@ "cpu": [ "mips64el" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -288,6 +295,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -304,6 +312,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -320,6 +329,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -336,6 +346,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -352,6 +363,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -368,6 +380,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -384,6 +397,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -400,6 +414,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -416,6 +431,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -432,6 +448,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -448,6 +465,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -464,6 +482,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2105,6 +2124,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2118,6 +2138,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2131,6 +2152,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2144,6 +2166,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2157,6 +2180,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2170,6 +2194,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2183,6 +2208,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2196,6 +2222,7 @@ "cpu": [ "arm" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2209,6 +2236,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2222,6 +2250,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2235,6 +2264,7 @@ "cpu": [ "loong64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2248,6 +2278,7 @@ "cpu": [ "ppc64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2261,6 +2292,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2274,6 +2306,7 @@ "cpu": [ "riscv64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2287,6 +2320,7 @@ "cpu": [ "s390x" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2300,6 +2334,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2313,6 +2348,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2326,6 +2362,7 @@ "cpu": [ "arm64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2339,6 +2376,7 @@ "cpu": [ "ia32" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2352,6 +2390,7 @@ "cpu": [ "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ @@ -2904,6 +2943,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true, "license": "MIT" }, "node_modules/@types/json-schema": { @@ -2924,7 +2964,7 @@ "version": "22.15.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "undici-types": "~6.21.0" @@ -2934,7 +2974,7 @@ "version": "19.1.0", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz", "integrity": "sha512-UaicktuQI+9UKyA4njtDOGBD/67t8YEBt2xdfqu8+gP9hqPUPsiXlNPcpS2gVdjmis5GKPG3fCxbQLVgxsQZ8w==", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "csstype": "^3.0.2" @@ -2944,7 +2984,7 @@ "version": "19.1.1", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.1.tgz", "integrity": "sha512-jFf/woGTVTjUJsl2O7hcopJ1r0upqoq/vIOoCj0yLh3RIXxWcljlpuZ+vEBRXsymD1jhfeJrlyTy/S1UW+4y1w==", - "devOptional": true, + "dev": true, "license": "MIT", "peerDependencies": { "@types/react": "^19.0.0" @@ -3761,12 +3801,6 @@ "url": "https://github.com/sponsors/kossnocorp" } }, - "node_modules/date-fns-jalali": { - "version": "4.1.0-0", - "resolved": "https://registry.npmjs.org/date-fns-jalali/-/date-fns-jalali-4.1.0-0.tgz", - "integrity": "sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg==", - "license": "MIT" - }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", @@ -4086,6 +4120,7 @@ "version": "0.25.2", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.2.tgz", "integrity": "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==", + "dev": true, "hasInstallScript": true, "license": "MIT", "bin": { @@ -4770,6 +4805,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -6171,6 +6207,7 @@ "version": "3.3.11", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, "funding": [ { "type": "github", @@ -8992,6 +9029,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -9090,6 +9128,7 @@ "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", + "dev": true, "funding": [ { "type": "opencollective", @@ -9212,24 +9251,17 @@ } }, "node_modules/react-day-picker": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-9.7.0.tgz", - "integrity": "sha512-urlK4C9XJZVpQ81tmVgd2O7lZ0VQldZeHzNejbwLWZSkzHH498KnArT0EHNfKBOWwKc935iMLGZdxXPRISzUxQ==", + "version": "8.10.1", + "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-8.10.1.tgz", + "integrity": "sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==", "license": "MIT", - "dependencies": { - "@date-fns/tz": "1.2.0", - "date-fns": "4.1.0", - "date-fns-jalali": "4.1.0-0" - }, - "engines": { - "node": ">=18" - }, "funding": { "type": "individual", "url": "https://github.com/sponsors/gpbl" }, "peerDependencies": { - "react": ">=16.8.0" + "date-fns": "^2.28.0 || ^3.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, "node_modules/react-dom": { @@ -9483,6 +9515,7 @@ "version": "4.39.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.39.0.tgz", "integrity": "sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g==", + "dev": true, "license": "MIT", "dependencies": { "@types/estree": "1.0.7" @@ -9790,6 +9823,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -10263,7 +10297,7 @@ "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/universalify": { @@ -10342,6 +10376,7 @@ "version": "6.2.4", "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.4.tgz", "integrity": "sha512-veHMSew8CcRzhL5o8ONjy8gkfmFJAd5Ac16oxBUjlwgX3Gq2Wqr+qNC3TjPIpy7TPV/KporLga5GT9HqdrCizw==", + "dev": true, "license": "MIT", "dependencies": { "esbuild": "^0.25.0", diff --git a/package.json b/package.json index 20bd7e4..9a861b1 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "mobx-react-lite": "^4.1.0", "npm": "^10.9.2", "react": "^19.0.0", - "react-day-picker": "^9.7.0", + "react-day-picker": "^8.10.1", "react-dom": "^19.0.0", "react-hook-form": "^7.56.4", "react-hot-toast": "^2.5.2", diff --git a/src/entities/Groups/api/getGroup.ts b/src/entities/Groups/api/getGroup.ts index e0d8e3b..bb7612e 100644 --- a/src/entities/Groups/api/getGroup.ts +++ b/src/entities/Groups/api/getGroup.ts @@ -4,6 +4,5 @@ import { api } from '@/shared/api'; export const getGroups = async (): Promise => { const { data } = await api.get(`/api/groups/get`, {}); - return data; }; diff --git a/src/features/GroupsCRUD/ui/GroupItem/GroupItem.tsx b/src/features/GroupsCRUD/ui/GroupItem/GroupItem.tsx index b247157..622a334 100644 --- a/src/features/GroupsCRUD/ui/GroupItem/GroupItem.tsx +++ b/src/features/GroupsCRUD/ui/GroupItem/GroupItem.tsx @@ -68,7 +68,7 @@ export const GroupItem = ({ Поток: {streamInfo?.streamNumber || 'Неизвестно'} ( {streamInfo?.year || 'N/A'}) • Студентов:{' '} - {group.students.length} + {group.students?.length ?? 0} {headMan && ( <> {' '} @@ -128,7 +128,7 @@ export const GroupItem = ({ - {group.students.length === 0 ? ( + {!group.students || group.students.length === 0 ? (

В группе пока нет студентов

diff --git a/src/features/GroupsCRUD/ui/GroupsList/GroupsList.tsx b/src/features/GroupsCRUD/ui/GroupsList/GroupsList.tsx index d76db9f..0f1ac2f 100644 --- a/src/features/GroupsCRUD/ui/GroupsList/GroupsList.tsx +++ b/src/features/GroupsCRUD/ui/GroupsList/GroupsList.tsx @@ -72,7 +72,7 @@ export const GroupsList = () => { groups.map((group) => { const streamInfo = getStreamInfo(group.streamId); const isExpanded = expandedGroups.has(group.id); - const headMan = group.students.find((s) => s.isHeadMan); + const headMan = group.students?.find((s) => s.isHeadMan); return ( => { - const { data } = await api.get(`${BASE_URL_NO_API}/semester`, { + const { data } = await api.get(`/semester`, { params: { isArchive, }, @@ -19,21 +18,21 @@ export const getSemesters = async (isArchive: boolean): Promise => { export const createSemester = async ( payload: CreateSemesterDto, ): Promise => { - await api.post(`${BASE_URL_NO_API}/semester`, payload); + await api.post(`/semester`, payload); }; export const updateSemester = async ( semesterId: string, payload: UpdateSemesterDto, ): Promise => { - await api.put(`${BASE_URL_NO_API}/semester/${semesterId}`, payload); + await api.put(`/semester/${semesterId}`, payload); }; export const deleteOrArchiveSemester = async ( semesterId: string, isArchive: boolean, ): Promise => { - await api.delete(`${BASE_URL_NO_API}/semester/${semesterId}`, { + await api.delete(`/semester/${semesterId}`, { params: { isArchive }, }); }; diff --git a/src/features/SemesterCRUD/ui/SemesterList/SemesterList.tsx b/src/features/SemesterCRUD/ui/SemesterList/SemesterList.tsx index d1a0f13..acd6201 100644 --- a/src/features/SemesterCRUD/ui/SemesterList/SemesterList.tsx +++ b/src/features/SemesterCRUD/ui/SemesterList/SemesterList.tsx @@ -30,7 +30,6 @@ import { export const SemesterList = () => { const { mutateAsync: deleteOrArchive } = useDeleteOrArchiveSemester(); const [showArchived, setShowArchived] = useState(false); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { data: semesters = [] } = useSemesters(showArchived); const [isDialogOpen, setIsDialogOpen] = useState(false); const [currentSemester, setCurrentSemester] = useState(null); diff --git a/src/features/StreamsCRUD/model/types.ts b/src/features/StreamsCRUD/model/types.ts index b10f15c..ed34b66 100644 --- a/src/features/StreamsCRUD/model/types.ts +++ b/src/features/StreamsCRUD/model/types.ts @@ -50,7 +50,7 @@ export interface Group { id: string; groupNumber: number; streamId: string; - students: Student[]; + students: Student[] | null; } export interface StreamSemester { diff --git a/src/shared/ui/calendar.tsx b/src/shared/ui/calendar.tsx index 444f48e..06fa9e7 100644 --- a/src/shared/ui/calendar.tsx +++ b/src/shared/ui/calendar.tsx @@ -1,72 +1,73 @@ -import * as React from 'react'; -import { DayPicker } from 'react-day-picker'; +import * as React from "react" +import { ChevronLeft, ChevronRight } from "lucide-react" +import { DayPicker } from "react-day-picker" -import { cn } from '@/shared/lib/utils'; -import { buttonVariants } from '@/shared/ui/button'; +import { cn } from "@/shared/lib/utils" +import { buttonVariants } from "@/shared/ui/button" -const Calendar = ({ +function Calendar({ className, classNames, showOutsideDays = true, ...props -}: React.ComponentProps) => { +}: React.ComponentProps) { return ( .day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md' - : '[&:has([aria-selected])]:rounded-md', + "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md", + props.mode === "range" + ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" + : "[&:has([aria-selected])]:rounded-md" ), day: cn( - buttonVariants({ variant: 'ghost' }), - 'size-8 p-0 font-normal aria-selected:opacity-100', + buttonVariants({ variant: "ghost" }), + "size-8 p-0 font-normal aria-selected:opacity-100" ), day_range_start: - 'day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground', + "day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground", day_range_end: - 'day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground', + "day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground", day_selected: - 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground', - day_today: 'bg-accent text-accent-foreground', + "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground", + day_today: "bg-accent text-accent-foreground", day_outside: - 'day-outside text-muted-foreground aria-selected:text-muted-foreground', - day_disabled: 'text-muted-foreground opacity-50', + "day-outside text-muted-foreground aria-selected:text-muted-foreground", + day_disabled: "text-muted-foreground opacity-50", day_range_middle: - 'aria-selected:bg-accent aria-selected:text-accent-foreground', - day_hidden: 'invisible', + "aria-selected:bg-accent aria-selected:text-accent-foreground", + day_hidden: "invisible", ...classNames, }} - // components={{ - // IconLeft: ({ className, ...props }) => ( - // - // ), - // IconRight: ({ className, ...props }) => ( - // - // ), - // }} + components={{ + IconLeft: ({ className, ...props }) => ( + + ), + IconRight: ({ className, ...props }) => ( + + ), + }} {...props} /> - ); -}; + ) +} -export { Calendar }; +export { Calendar } diff --git a/src/shared/ui/popover.tsx b/src/shared/ui/popover.tsx index fc514f9..534c1fd 100644 --- a/src/shared/ui/popover.tsx +++ b/src/shared/ui/popover.tsx @@ -22,8 +22,7 @@ function PopoverContent({ ...props }: React.ComponentProps) { return ( - - - ) }