feat: schedule of teachers (but one)

i think its many poop code and schedule currently now working properly
This commit is contained in:
kilyabin
2026-01-28 14:29:19 +04:00
parent 56a48b4552
commit a930dcfa4e
13 changed files with 1494 additions and 68 deletions

View File

@@ -12,9 +12,10 @@ import { NavContext, NavContextProvider } from '@/shared/context/nav-context'
import { GITHUB_REPO_URL } from '@/shared/constants/urls'
import { GroupsData } from '@/shared/data/groups-loader'
export function NavBar({ cacheAvailableFor, groups }: {
export function NavBar({ cacheAvailableFor, groups, isTeacherPage = false }: {
cacheAvailableFor: string[]
groups: GroupsData
isTeacherPage?: boolean
}) {
const { resolvedTheme } = useTheme()
// Используем состояние для предотвращения проблем с гидратацией
@@ -34,14 +35,14 @@ export function NavBar({ cacheAvailableFor, groups }: {
<div className="flex-1 min-w-0 overflow-x-auto scrollbar-hide">
<ul className="flex gap-2 flex-nowrap">
<li className="flex-shrink-0">
<Link href="/">
<Link href={isTeacherPage ? "/teachers" : "/"}>
<Button
variant="secondary"
className="min-h-[44px] whitespace-nowrap gap-2"
tabIndex={-1}
>
<ArrowLeft className="h-4 w-4" />
<span>К группам</span>
<span>{isTeacherPage ? "К преподавателям" : "К группам"}</span>
</Button>
</Link>
</li>

View File

@@ -4,8 +4,9 @@ import { getDayOfWeek } from '@/shared/utils'
import { Lesson } from '@/widgets/schedule/lesson'
import { cx } from 'class-variance-authority'
export function Day({ day }: {
export function Day({ day, hideTeacher = false }: {
day: DayType
hideTeacher?: boolean
}) {
const dayOfWeek = [
'Понедельник',
@@ -53,6 +54,7 @@ export function Day({ day }: {
width={longNames ? 450 : 350}
lesson={lesson}
animationDelay={i * 0.08}
hideTeacher={hideTeacher}
/>
))}
<div className='snap-start hidden md:block' style={{ flex: `0 0 calc(100vw - 4rem - ${longNames ? 450 : 350}px - 1rem)` }} />

View File

@@ -18,7 +18,8 @@ export function Schedule({
weekNavigationEnabled = true,
isFromCache,
cacheAge,
cacheInfo
cacheInfo,
hideTeacher = false
}: {
days: DayType[]
currentWk: number | null | undefined
@@ -30,6 +31,7 @@ export function Schedule({
size: number
entries: number
}
hideTeacher?: boolean
}) {
const group = useRouter().query['group']
const hasScrolledRef = React.useRef(false)
@@ -223,7 +225,7 @@ export function Schedule({
animationDelay: `${i * 0.1}s`,
} as React.CSSProperties}
>
<Day day={day} />
<Day day={day} hideTeacher={hideTeacher} />
</div>
))
)}

View File

@@ -22,10 +22,11 @@ import { BsFillGeoAltFill } from 'react-icons/bs'
import { RiGroup2Fill } from 'react-icons/ri'
import { ResourcesDialog } from '@/widgets/schedule/resources-dialog'
export function Lesson({ lesson, width = 350, animationDelay }: {
export function Lesson({ lesson, width = 350, animationDelay, hideTeacher = false }: {
lesson: LessonType
width: number
animationDelay?: number
hideTeacher?: boolean
}) {
const [resourcesDialogOpened, setResourcesDialogOpened] = React.useState(false)
@@ -73,7 +74,7 @@ export function Lesson({ lesson, width = 350, animationDelay }: {
{lesson.isChange && <div className='absolute top-0 left-0 w-full h-full bg-gradient-to-br from-[#ffc60026] to-[#95620026] pointer-events-none'></div>}
<CardHeader>
<div className='flex gap-2 md:gap-4'>
{hasTeacher ? (
{!hideTeacher && hasTeacher ? (
<Avatar className="flex-shrink-0">
<AvatarImage
src={getTeacherPhoto(teacherObj?.picture)!}
@@ -99,7 +100,7 @@ export function Lesson({ lesson, width = 350, animationDelay }: {
{lesson.time.start} - {lesson.time.end}{
}{lesson.time.hint && <span className='font-bold'>&nbsp;({lesson.time.hint})</span>}
</CardDescription>
{!isCancelled && hasTeacher && lesson.teacher && (
{!hideTeacher && !isCancelled && hasTeacher && lesson.teacher && (
<CardDescription className='text-xs md:text-sm font-medium break-words'>
{lesson.teacher}
</CardDescription>