ALIVE! make it work and navigation now dynamic
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -5,7 +5,7 @@
|
|||||||
"@": "${workspaceRoot}/src"
|
"@": "${workspaceRoot}/src"
|
||||||
},
|
},
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": true
|
"source.fixAll.eslint": "explicit"
|
||||||
},
|
},
|
||||||
"editor.quickSuggestions": {
|
"editor.quickSuggestions": {
|
||||||
"strings": "on"
|
"strings": "on"
|
||||||
|
|||||||
11338
package-lock.json
generated
Normal file
11338
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -48,7 +48,7 @@
|
|||||||
"eslint": "latest",
|
"eslint": "latest",
|
||||||
"eslint-config-next": "latest",
|
"eslint-config-next": "latest",
|
||||||
"postcss": "latest",
|
"postcss": "latest",
|
||||||
"tailwindcss": "latest",
|
"tailwindcss": "^3.4.18",
|
||||||
"typescript": "latest"
|
"typescript": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export const groups: { [group: string]: [number, string] } = {
|
export const groups: { [group: string]: [number, string] } = {
|
||||||
ib4k: [138, 'ИБ-4к'],
|
ib4k: [138, 'ИБ-4к'],
|
||||||
ps7: [146, 'ПС-7'],
|
ib5: [144, 'ИБ-5'],
|
||||||
pks35k: [78, 'ПКС-35к']
|
ib6: [145, 'ИБ-6'],
|
||||||
|
ib7k: [172, 'ИБ-7к']
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,7 @@ export function getDayOfWeek(date: Date): 'monday' | 'tuesday' | 'wednesday' | '
|
|||||||
'saturday',
|
'saturday',
|
||||||
'sunday'
|
'sunday'
|
||||||
] as const
|
] 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]
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import { useRouter } from 'next/router'
|
|||||||
import { FaGithub } from 'react-icons/fa'
|
import { FaGithub } from 'react-icons/fa'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import { NavContext, NavContextProvider } from '@/shared/context/nav-context'
|
import { NavContext, NavContextProvider } from '@/shared/context/nav-context'
|
||||||
|
import { groups } from '@/shared/data/groups'
|
||||||
|
|
||||||
export function NavBar({ cacheAvailableFor }: {
|
export function NavBar({ cacheAvailableFor }: {
|
||||||
cacheAvailableFor: string[]
|
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">
|
<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}>
|
<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">
|
<ul className="flex gap-2">
|
||||||
<NavBarItem url="/ps7">ПС-7</NavBarItem>
|
{Object.entries(groups).map(([id, [, name]]) => (
|
||||||
<NavBarItem url="/pks35k">ПКС-35к</NavBarItem>
|
<NavBarItem key={id} url={`/${id}`}>{name}</NavBarItem>
|
||||||
|
))}
|
||||||
<AddGroupButton />
|
<AddGroupButton />
|
||||||
</ul>
|
</ul>
|
||||||
<div className='flex gap-1 min-[500px]:gap-2'>
|
<div className='flex gap-1 min-[500px]:gap-2'>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function Day({ day }: {
|
|||||||
'Пятница',
|
'Пятница',
|
||||||
'Суббота',
|
'Суббота',
|
||||||
'Воскресенье'
|
'Воскресенье'
|
||||||
][day.date.getDay()-1]
|
][(day.date.getDay() + 6) % 7]
|
||||||
|
|
||||||
const longNames = day.lessons
|
const longNames = day.lessons
|
||||||
.some(lesson => 'subject' in lesson && lesson.subject.length > 20)
|
.some(lesson => 'subject' in lesson && lesson.subject.length > 20)
|
||||||
|
|||||||
@@ -86,6 +86,11 @@ export function Lesson({ lesson, width = 350 }: {
|
|||||||
{lesson.time.start} - {lesson.time.end}{
|
{lesson.time.start} - {lesson.time.end}{
|
||||||
}{lesson.time.hint && <span className='font-bold'> ({lesson.time.hint})</span>}
|
}{lesson.time.hint && <span className='font-bold'> ({lesson.time.hint})</span>}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
|
{hasTeacher && lesson.teacher && (
|
||||||
|
<CardDescription className='text-sm font-medium'>
|
||||||
|
{lesson.teacher}
|
||||||
|
</CardDescription>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react-jsx",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
@@ -32,8 +32,10 @@
|
|||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
"**/*.tsx",
|
"**/*.tsx",
|
||||||
".next/types/**/*.ts"
|
".next/types/**/*.ts",
|
||||||
, "next-sitemap.config.js" ],
|
"next-sitemap.config.js",
|
||||||
|
".next/dev/types/**/*.ts"
|
||||||
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules"
|
"node_modules"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user