mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
🔀 Merge pull request #224 from ajnart/ajnart/issue217
✨ Configure calendar widget to show Sunday first #217
This commit is contained in:
@@ -29,6 +29,12 @@ export const CalendarModule: IModule = {
|
|||||||
'A calendar module for displaying upcoming releases. It interacts with the Sonarr and Radarr API.',
|
'A calendar module for displaying upcoming releases. It interacts with the Sonarr and Radarr API.',
|
||||||
icon: CalendarIcon,
|
icon: CalendarIcon,
|
||||||
component: CalendarComponent,
|
component: CalendarComponent,
|
||||||
|
options: {
|
||||||
|
sundaystart: {
|
||||||
|
name: 'Start the week on Sunday',
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function CalendarComponent(props: any) {
|
export default function CalendarComponent(props: any) {
|
||||||
@@ -104,8 +110,11 @@ export default function CalendarComponent(props: any) {
|
|||||||
});
|
});
|
||||||
}, [config.services]);
|
}, [config.services]);
|
||||||
|
|
||||||
|
const weekStartsAtSunday =
|
||||||
|
(config?.modules?.[CalendarModule.title]?.options?.sundaystart?.value as boolean) ?? false;
|
||||||
return (
|
return (
|
||||||
<Calendar
|
<Calendar
|
||||||
|
firstDayOfWeek={weekStartsAtSunday ? 'sunday' : 'monday'}
|
||||||
onChange={(day: any) => {}}
|
onChange={(day: any) => {}}
|
||||||
dayStyle={(date) =>
|
dayStyle={(date) =>
|
||||||
date.getDay() === today.getDay() && date.getDate() === today.getDate()
|
date.getDay() === today.getDay() && date.getDate() === today.getDate()
|
||||||
@@ -115,6 +124,13 @@ export default function CalendarComponent(props: any) {
|
|||||||
}
|
}
|
||||||
: {}
|
: {}
|
||||||
}
|
}
|
||||||
|
styles={{
|
||||||
|
calendarHeader: {
|
||||||
|
marginRight: 15,
|
||||||
|
marginLeft: 15,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
allowLevelChange={false}
|
||||||
dayClassName={(date, modifiers) => cx({ [classes.weekend]: modifiers.weekend })}
|
dayClassName={(date, modifiers) => cx({ [classes.weekend]: modifiers.weekend })}
|
||||||
renderDay={(renderdate) => (
|
renderDay={(renderdate) => (
|
||||||
<DayComponent
|
<DayComponent
|
||||||
|
|||||||
@@ -120,8 +120,8 @@ export function ModuleWrapper(props: any) {
|
|||||||
styles={{
|
styles={{
|
||||||
root: {
|
root: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 15,
|
top: 12,
|
||||||
right: 15,
|
right: 12,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user