Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 03aa0a3

Browse files
committed
improving calendar
1 parent 292aac7 commit 03aa0a3

File tree

3 files changed

+56
-50
lines changed

3 files changed

+56
-50
lines changed

src/components/HeaderMenu.tsx

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -433,56 +433,59 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
433433
</div>
434434
))}
435435
</div>
436-
<div
437-
style={{
438-
borderTop: `1px solid ${StyleVariables.BACKGROUND_DIVIDER}`,
439-
padding: "4px 0px",
440-
}}
441-
>
442-
{/** Column settings section */}
443-
<div style={{ padding: "4px 0px" }}>
444-
<div
445-
className="menu-item sort-button"
446-
onMouseEnter={() => setShowSettings(true)}
447-
onMouseLeave={() => setShowSettings(false)}
448-
ref={setSettingsReferenceElement}
449-
>
450-
<span className="svg-icon svg-text icon-margin">
451-
<AdjustmentsIcon />
452-
</span>
453-
<span>Settings</span>
454-
</div>
455-
{showSettings && (
436+
{!column.isMetadata && (
437+
<div
438+
style={{
439+
borderTop: `1px solid ${StyleVariables.BACKGROUND_DIVIDER}`,
440+
padding: "4px 0px",
441+
}}
442+
>
443+
{/** Column settings section */}
444+
445+
<div style={{ padding: "4px 0px" }}>
456446
<div
457-
className={`menu ${c("popper")}`}
458-
ref={setSettingsPopperElement}
447+
className="menu-item sort-button"
459448
onMouseEnter={() => setShowSettings(true)}
460449
onMouseLeave={() => setShowSettings(false)}
461-
{...settingsPopper.attributes.popper}
462-
style={{
463-
...settingsPopper.styles.popper,
464-
width: 200,
465-
zIndex: 4,
466-
padding: "4px 0px",
467-
}}
450+
ref={setSettingsReferenceElement}
468451
>
469-
<FormGroup>
470-
<FormControlLabel
471-
control={
472-
<Switch
473-
checked={isInline}
474-
onChange={(event) => {
475-
handleChangeToggleInlineFrontmatter(event);
476-
}}
477-
/>
478-
}
479-
label="Inline"
480-
/>
481-
</FormGroup>
452+
<span className="svg-icon svg-text icon-margin">
453+
<AdjustmentsIcon />
454+
</span>
455+
<span>Settings</span>
482456
</div>
483-
)}
457+
{showSettings && (
458+
<div
459+
className={`menu ${c("popper")}`}
460+
ref={setSettingsPopperElement}
461+
onMouseEnter={() => setShowSettings(true)}
462+
onMouseLeave={() => setShowSettings(false)}
463+
{...settingsPopper.attributes.popper}
464+
style={{
465+
...settingsPopper.styles.popper,
466+
width: 200,
467+
zIndex: 4,
468+
padding: "4px 0px",
469+
}}
470+
>
471+
<FormGroup>
472+
<FormControlLabel
473+
control={
474+
<Switch
475+
checked={isInline}
476+
onChange={(event) => {
477+
handleChangeToggleInlineFrontmatter(event);
478+
}}
479+
/>
480+
}
481+
label="Inline"
482+
/>
483+
</FormGroup>
484+
</div>
485+
)}
486+
</div>
484487
</div>
485-
</div>
488+
)}
486489
</div>
487490
</div>
488491
)}

src/components/portals/CalendarPortal.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ const CalendarPortal = (calendarProps: CalendarProps) => {
2222
/** state of cell value */
2323
const { value, setValue } = useContext(CellContext);
2424

25-
const [calendarState, setCalendarState] = useState(
26-
DateTime.fromFormat(value.value, "yyyy-MM-dd").toJSDate()
27-
);
25+
let initialDate = new Date();
26+
if (DateTime.isDateTime(value.value)) {
27+
initialDate = DateTime.fromFormat(value.value, "yyyy-MM-dd").toJSDate();
28+
}
29+
const [calendarState, setCalendarState] = useState(initialDate);
30+
2831
function handleCalendarChange(date: Date) {
2932
setCalendarState(date);
3033
setShowCalendar(false);
@@ -51,7 +54,7 @@ const CalendarPortal = (calendarProps: CalendarProps) => {
5154
zIndex: 4,
5255
minWidth: 200,
5356
maxWidth: 320,
54-
padding: "0.75rem",
57+
padding: "0.5rem",
5558
background: StyleVariables.BACKGROUND_SECONDARY,
5659
}}
5760
onBlur={() => setShowCalendar(false)}

styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
.react-calendar {
340340
width: 350px;
341341
max-width: 100%;
342-
background: white;
342+
background: var(--background-secondary);
343343
border: 1px solid #a0a096;
344344
font-family: Arial, Helvetica, sans-serif;
345345
line-height: 1.125em;
@@ -421,7 +421,7 @@
421421
}
422422

423423
.react-calendar__month-view__days__day--weekend {
424-
color: #d10000;
424+
color: var(--background-modifier-error);
425425
}
426426

427427
.react-calendar__month-view__days__day--neighboringMonth {

0 commit comments

Comments
 (0)