fix(ui): pin desktop calendar sidebar

This commit is contained in:
lizerk 2026-04-14 23:56:37 +03:00
parent c8683349c4
commit 14d21fb297
2 changed files with 9 additions and 2 deletions

View File

@ -469,6 +469,7 @@ export function AppShell({ children }: AppShellProps) {
setEventsRefreshTrigger={cal.handleSetEventsRefreshTrigger}
setSidebarEvents={cal.handleSetSidebarEvents}
onCalendarChange={cal.handleCalendarChange}
fixedDesktop={!isMessageDialogPage}
/>
</div>

View File

@ -15,16 +15,22 @@ interface CalendarSidebarProps {
setEventsRefreshTrigger: (value: number | ((prev: number) => number)) => void;
setSidebarEvents: (events: CalendarEvent[]) => void;
onCalendarChange: (calendarId: number | null) => void;
fixedDesktop?: boolean;
}
/**
* Обертка для календаря в правом сайдбаре (десктоп)
*/
export const CalendarSidebar = memo(function CalendarSidebar(props: CalendarSidebarProps) {
const { fixedDesktop = false, ...calendarProps } = props;
return (
<aside className="hidden w-72 flex-shrink-0 space-y-4 lg:block">
<div className="sticky top-8 space-y-4 lg:pb-2 max-h-[calc(100vh-7.5rem)] overflow-y-auto">
<CalendarCard {...props} />
<div
className={`space-y-4 lg:max-h-[calc(100vh-7.5rem)] lg:overflow-y-auto lg:pb-2 ${
fixedDesktop ? "lg:fixed lg:top-[5.5rem] lg:w-72" : "lg:sticky lg:top-8"
}`}
>
<CalendarCard {...calendarProps} />
</div>
</aside>
);