Skip to content

Commit 15e9b6a

Browse files
committed
Various tweaks
1 parent e6a91ea commit 15e9b6a

File tree

11 files changed

+47
-27
lines changed

11 files changed

+47
-27
lines changed

src/common/utils/dateUtils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export function isToday(
3333
);
3434
}
3535

36+
export function isSameDay(date1: Date, date2: Date): boolean {
37+
return startOfDayUTC(date1) === startOfDayUTC(date2);
38+
}
39+
3640
export function startOfDay(date: Date) {
3741
return new Date(
3842
date.getFullYear(),

src/components/AppSideBar/AppSideBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function AppSideBar({ items }: AppSideBarProps) {
2121
onClick={item.onClick}
2222
key={item.title}
2323
active={item.isActive ?? false}
24-
activeColor={settings.accentColor}
24+
activeColor={settings.secondaryColor}
2525
>
2626
{item.title}
2727
</StyledItem>

src/components/MenuItems/MenuItems.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function MenuItem({
131131
onClick={handleOnClick}
132132
onMouseEnter={handleOnMouseEnter}
133133
onMouseLeave={handleOnMouseLeave}
134-
hoverColor={settings.accentColor}
134+
hoverColor={settings.secondaryColor}
135135
>
136136
<span>{title}</span>
137137
{items && open && (

src/programs/Calendar/Calendar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import CalendarNavigation from "./CalendarNavigation/CalendarNavigation";
1111
import { useCalendar } from "./hooks/useCalendar";
1212
import CalendarSidebar from "./CalendarSidebar/CalendarSidebar";
1313
import CalendarDay from "./CalendarDay/CalendarDay";
14+
import { isSameDay } from "../../common/utils/dateUtils";
1415

1516
type CalendarHandles = BorderedAppContentHandles<HTMLDivElement>;
1617

@@ -20,7 +21,7 @@ const Calendar = forwardRef<CalendarHandles, CalendarProps>((_props, ref) => {
2021
const sidebarToggle = useToggle();
2122
const calendarRef = useRef<HTMLDivElement>(null);
2223
const calendar = useCalendar();
23-
const [accentColor] = useSystemSettings((s) => [s.accentColor]);
24+
const [accentColor] = useSystemSettings((s) => [s.secondaryColor]);
2425

2526
useImperativeHandle(ref, () => ({
2627
element: calendarRef.current,
@@ -53,6 +54,7 @@ const Calendar = forwardRef<CalendarHandles, CalendarProps>((_props, ref) => {
5354
isToday={day.isToday}
5455
onClick={() => calendar.setCursor(day.date)}
5556
key={day.date.toISOString()}
57+
isSelected={isSameDay(calendar.cursor, day.date)}
5658
/>
5759
))}
5860
</StyledCalendarDays>
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { getDayName } from "../../../common/utils/dateUtils";
22
import useSystemSettings from "../../../stores/systemSettingsStore";
3-
import { StyledCalendarDay } from "./styles";
3+
import { StyledCalendarDay, StyledCalendarDayNo } from "./styles";
44

55
interface CalendarDayProps {
66
date: Date;
77
isToday: boolean;
88
isThisMonth: boolean;
99
onClick(): void;
10+
isSelected: boolean;
1011
}
1112

1213
export default function CalendarDay({
1314
date,
1415
isToday,
1516
isThisMonth,
1617
onClick,
18+
isSelected,
1719
}: CalendarDayProps) {
18-
const [mainColor, fontColor] = useSystemSettings((s) => [
19-
s.mainColor,
20-
s.accentColor,
21-
s.fontColor,
22-
]);
20+
const [mainColor, accentColor, fontColor, primaryColor] = useSystemSettings(
21+
(s) => [s.mainColor, s.secondaryColor, s.fontColor, s.primaryColor],
22+
);
2323
const dayOfWeek = getDayName(date.getDay());
2424
const dayOfMonth = date.getDate();
2525

@@ -29,10 +29,14 @@ export default function CalendarDay({
2929
color={fontColor}
3030
currentMonth={isThisMonth}
3131
onClick={onClick}
32+
outlineColor={primaryColor}
33+
isSelected={isSelected}
3234
>
3335
<span>{dayOfWeek}</span>
34-
<span>{dayOfMonth}</span>
35-
{isToday && <span>TODAY</span>}
36+
<span>
37+
<StyledCalendarDayNo>{dayOfMonth}</StyledCalendarDayNo>
38+
</span>
39+
{/* {isToday && <span>TODAY</span>} */}
3640
</StyledCalendarDay>
3741
);
3842
}

src/programs/Calendar/CalendarDay/styles.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ interface StyledCalendarDayProps {
66
backgroundColor: string;
77
color: string;
88
currentMonth: boolean;
9+
outlineColor: string;
10+
isSelected: boolean;
911
}
1012

1113
export const StyledCalendarDay = styled.div<StyledCalendarDayProps>`
1214
display: flex;
1315
flex-direction: column;
14-
background-color: ${(props) => props.backgroundColor};
16+
background-color: ${(props) =>
17+
props.isSelected ? props.outlineColor : props.backgroundColor};
18+
/* border: ${(p) =>
19+
p.isSelected ? `1px solid ${p.outlineColor}` : undefined}; */
1520
color: ${(props) =>
1621
props.currentMonth
1722
? undefined
@@ -26,3 +31,6 @@ export const StyledCalendarDay = styled.div<StyledCalendarDayProps>`
2631
: lighten(0.1, props.backgroundColor)};
2732
}
2833
`;
34+
35+
interface StyledCalendarDayNoProps {}
36+
export const StyledCalendarDayNo = styled.div<StyledCalendarDayNoProps>``;

src/programs/FileBrowser/DirectoryOrFile/DirectoryOrFile.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function DirectoryOrFile({
3737
const clickPosition = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
3838
const [contextMenuOpen, setContextMenuOpen] = useState(false);
3939
const [contextAction, setContextAction] = useState<ContextMenuAction | null>(
40-
null
40+
null,
4141
);
4242
const settings = useSystemSettings();
4343
const fs = useLocalFS();
@@ -52,7 +52,7 @@ function DirectoryOrFile({
5252
return (
5353
<StyledItem
5454
selected={selected}
55-
selectedColor={settings.accentColor}
55+
selectedColor={settings.secondaryColor}
5656
onDoubleClick={() => openFSObject(fsObject)}
5757
onClick={() => setSelected(fsObject.path)}
5858
key={fsObject.path}
@@ -65,7 +65,7 @@ function DirectoryOrFile({
6565
fsObject,
6666
fs,
6767
setContextAction,
68-
setContextMenuOpen
68+
setContextMenuOpen,
6969
)}
7070
close={() => setContextMenuOpen(!contextMenuOpen)}
7171
/>

src/programs/FileBrowser/FileBrowser.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function TopBar({
4343
navBack,
4444
}: TopBarProps) {
4545
const [backgroundColor, fontColor] = useSystemSettings((s) => [
46-
s.accentColor,
46+
s.secondaryColor,
4747
s.fontColor,
4848
]);
4949
return (

src/programs/Settings/settingsPageConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function isHexColorCode(value: string) {
66
}
77

88
export function getPages(
9-
systemsSettings: SystemSettingState
9+
systemsSettings: SystemSettingState,
1010
): Record<string, SettingsPageProps> {
1111
return {
1212
appearance: {
@@ -44,12 +44,12 @@ export function getPages(
4444
title: "Accent Color",
4545
description:
4646
"The accent for the desktop UI, for things such as currently-selected items (not yet supported)",
47-
currentValue: systemsSettings.accentColor,
47+
currentValue: systemsSettings.secondaryColor,
4848
type: "color",
4949
valueValidation: (value) =>
5050
isHexColorCode(value) ? undefined : "Invalid HEX color code",
5151
onValueChanged(value) {
52-
systemsSettings.setAccentColor(value);
52+
systemsSettings.setSecondaryColor(value);
5353
},
5454
},
5555
{

src/programs/TextEditor/TextEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const TextEditor = forwardRef<TextEditorHandles, TextEditorProps>(
1818
return (
1919
<StyledTextEditor className="text-editor" ref={elementRef}>
2020
<StyledTextArea
21-
selectedColor={settings.accentColor}
21+
selectedColor={settings.secondaryColor}
2222
className="text-editor__content"
2323
/>
2424
</StyledTextEditor>

0 commit comments

Comments
 (0)