Skip to content

Commit

Permalink
feat: start of week
Browse files Browse the repository at this point in the history
  • Loading branch information
e-zz committed Mar 16, 2024
1 parent 904ec34 commit d48900e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Agenda3/components/calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const Calendar = ({ onCalendarTitleChange }: CalendarProps, ref) => {
const { updateEntity } = useAgendaEntities()
const tasksWithStart = useAtomValue(tasksWithStartAtom)
const settings = useAtomValue(settingsAtom)
const startingDay = settings.general?.startOfWeek
const groupType = settings.selectedFilters?.length ? 'filter' : 'page'
const showTasks = tasksWithStart?.filter((task) =>
settings.viewOptions?.hideCompleted ? task.status === 'todo' : true,
Expand Down Expand Up @@ -182,7 +183,7 @@ const Calendar = ({ onCalendarTitleChange }: CalendarProps, ref) => {
weekNumbers
weekNumberContent={({ num, date }) => <WeekNumber weekNumber={num} date={date} />}
defaultTimedEventDuration="00:30"
firstDay={1}
firstDay={Number(startingDay)}
fixedWeekCount={false}
ref={calendarRef}
height="100%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ const GeneralSettingsForm = () => {
]}
/>
</div>
<div className="mt-4">
<div className="text-gray-500">Start of Week</div>
<Select
placeholder="Select Start of Week"
className="w-[300px]"
value={settings.general?.startOfWeek}
onChange={(e) => onChange('general.startOfWeek', e)}
options={[
{ label: 'Sun', value: '0' },
{ label: 'Mon', value: '1' },
{ label: 'Tue', value: '2' },
{ label: 'Wed', value: '3' },
{ label: 'Thu', value: '4' },
{ label: 'Fri', value: '5' },
{ label: 'Sat', value: '6' },
]}
/>
</div>
</div>
</>
)
Expand Down
1 change: 1 addition & 0 deletions src/Agenda3/models/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Settings = {
general?: {
useJournalDayAsSchedule?: boolean
language?: Language
startOfWeek?: string
}
ics?: {
repo?: string
Expand Down

0 comments on commit d48900e

Please sign in to comment.