ALIVE! make it work and navigation now dynamic

This commit is contained in:
kilyabin
2025-11-18 03:15:23 +04:00
parent 642649e240
commit 5feff78420
10 changed files with 11361 additions and 31 deletions

View File

@@ -5,7 +5,7 @@
"@": "${workspaceRoot}/src"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.quickSuggestions": {
"strings": "on"

11338
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@
"eslint": "latest",
"eslint-config-next": "latest",
"postcss": "latest",
"tailwindcss": "latest",
"tailwindcss": "^3.4.18",
"typescript": "latest"
}
}

View File

@@ -1,5 +1,6 @@
export const groups: { [group: string]: [number, string] } = {
ib4k: [138, 'ИБ-4к'],
ps7: [146, 'ПС-7'],
pks35k: [78, 'ПКС-35к']
ib5: [144, 'ИБ-5'],
ib6: [145, 'ИБ-6'],
ib7k: [172, 'ИБ-7к']
}

View File

@@ -15,5 +15,7 @@ export function getDayOfWeek(date: Date): 'monday' | 'tuesday' | 'wednesday' | '
'saturday',
'sunday'
] as const
return weekDays[date.getDay()]
// getDay() returns 0-6 (0=Sunday, 1=Monday, ...), but array starts with Monday
// Convert: Sunday (0) -> 6, Monday (1) -> 0, Tuesday (2) -> 1, etc.
return weekDays[(date.getDay() + 6) % 7]
}

View File

@@ -8,6 +8,7 @@ import { useRouter } from 'next/router'
import { FaGithub } from 'react-icons/fa'
import cx from 'classnames'
import { NavContext, NavContextProvider } from '@/shared/context/nav-context'
import { groups } from '@/shared/data/groups'
export function NavBar({ cacheAvailableFor }: {
cacheAvailableFor: string[]
@@ -44,8 +45,9 @@ export function NavBar({ cacheAvailableFor }: {
<header className="sticky top-0 w-full p-2 bg-background z-[1] pb-0 mb-2 shadow-header">
<nav className={cx('rounded-lg p-2 w-full flex justify-between', { 'bg-slate-200': theme === 'light', 'bg-slate-900': theme === 'dark' })} ref={navRef}>
<ul className="flex gap-2">
<NavBarItem url="/ps7">ПС-7</NavBarItem>
<NavBarItem url="/pks35k">ПКС-35к</NavBarItem>
{Object.entries(groups).map(([id, [, name]]) => (
<NavBarItem key={id} url={`/${id}`}>{name}</NavBarItem>
))}
<AddGroupButton />
</ul>
<div className='flex gap-1 min-[500px]:gap-2'>

View File

@@ -14,7 +14,7 @@ export function Day({ day }: {
'Пятница',
'Суббота',
'Воскресенье'
][day.date.getDay()-1]
][(day.date.getDay() + 6) % 7]
const longNames = day.lessons
.some(lesson => 'subject' in lesson && lesson.subject.length > 20)

View File

@@ -86,6 +86,11 @@ export function Lesson({ lesson, width = 350 }: {
{lesson.time.start} - {lesson.time.end}{
}{lesson.time.hint && <span className='font-bold'>&nbsp;({lesson.time.hint})</span>}
</CardDescription>
{hasTeacher && lesson.teacher && (
<CardDescription className='text-sm font-medium'>
{lesson.teacher}
</CardDescription>
)}
</div>
</div>
</CardHeader>

View File

@@ -1,20 +0,0 @@
import type { Config } from 'tailwindcss'
const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
'gradient-conic':
'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
},
},
},
plugins: [],
}
export default config

View File

@@ -15,7 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true,
"paths": {
"@/*": [
@@ -32,8 +32,10 @@
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
, "next-sitemap.config.js" ],
".next/types/**/*.ts",
"next-sitemap.config.js",
".next/dev/types/**/*.ts"
],
"exclude": [
"node_modules"
]