Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const useGoogleLogin = ({
setLoading(true);

return login();
}, [login, onStart, setData, setLoading]),
}, [login, onStart]),
data,
loading,
};
Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/common/hooks/useBufferedVisibility.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, renderHook, waitFor } from "@testing-library/react";
import { act, renderHook } from "@testing-library/react";
import { useBufferedVisibility } from "./useBufferedVisibility";
import {
afterEach,
Expand All @@ -11,7 +11,7 @@ import {
} from "bun:test";

describe("useBufferedVisibility", () => {
let timeoutCallbacks: Array<{ callback: () => void; delay: number }> = [];
let _timeoutCallbacks: Array<{ callback: () => void; delay: number }> = [];
let setTimeoutSpy: ReturnType<typeof spyOn>;
let clearTimeoutSpy: ReturnType<typeof spyOn>;
let currentTimeoutId = 0;
Expand All @@ -22,7 +22,7 @@ describe("useBufferedVisibility", () => {

beforeEach(() => {
setSystemTime(new Date("2024-01-01T00:00:00.000Z"));
timeoutCallbacks = [];
_timeoutCallbacks = [];
currentTimeoutId = 0;
activeTimeouts.clear();

Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/common/hooks/useCursorCoordinates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function useCursorCoordinates() {
});

return () => subscription.unsubscribe();
}, [setX, setY]);
}, []);

return { x, y };
}
14 changes: 3 additions & 11 deletions packages/web/src/common/hooks/useEventDNDActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ import {
ID_GRID_ALLDAY_ROW,
ID_GRID_MAIN,
} from "@web/common/constants/web.constants";
import {
afterAll,
afterEach,
beforeEach,
describe,
expect,
it,
mock,
} from "bun:test";
import { afterAll, beforeEach, describe, expect, it, mock } from "bun:test";
import { readFile, writeFile } from "node:fs/promises";

// Mock definitions
Expand Down Expand Up @@ -50,8 +42,8 @@ mock.module("@web/views/Day/util/agenda/agenda.util", () => ({
getSnappedMinutes: mockGetSnappedMinutes,
getAgendaEventTitle: (event) => `${event?.title || ""} -`,
getAgendaEventTime: (d) => (d ? new Date(d).toISOString() : ""),
getAgendaEventPosition: (date) => 0,
getNowLinePosition: (date) => 0,
getAgendaEventPosition: (_date) => 0,
getNowLinePosition: (_date) => 0,
getEventTimeFromPosition: (_y, dateInView) =>
dateInView.startOf ? dateInView.startOf("day") : new Date(),
roundMinutesToNearestFifteen: (minutes) => Math.round(minutes / 15) * 15,
Expand Down
14 changes: 8 additions & 6 deletions packages/web/src/common/hooks/useMovementEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ interface Options {
eventTypes?: Array<"pointerup" | "pointerdown" | "pointermove">;
}

const DEFAULT_EVENT_TYPES: Array<"pointerup" | "pointerdown" | "pointermove"> =
[];
const DEFAULT_SELECTORS: Array<keyof HTMLElementTagNameMap | string> = [];

/**
* useMovementEvent
*
Expand All @@ -35,17 +39,16 @@ interface Options {
export function useMovementEvent({
handler,
deps = [],
eventTypes = [],
selectors = [],
eventTypes = DEFAULT_EVENT_TYPES,
selectors = DEFAULT_SELECTORS,
}: Options) {
const typeFilter = useCallback(
({ event }: DomMovement) => {
if (eventTypes.length === 0) return true;

return eventTypes.some((eventType) => event.type === eventType);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
eventTypes,
[eventTypes],
);

const elementsFilter = useCallback(
Expand All @@ -54,8 +57,7 @@ export function useMovementEvent({

return selectors.some((el) => combination.element?.closest(el));
},
// eslint-disable-next-line react-hooks/exhaustive-deps
selectors,
[selectors],
);

const pause = useMemo(() => new BehaviorSubject<boolean>(false), []);
Expand Down
1 change: 0 additions & 1 deletion packages/web/src/components/ContextMenu/styled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "styled-components";
import { darken } from "@core/util/color.utils";

export const PriorityContainer = styled.div`
display: flex;
Expand Down
1 change: 0 additions & 1 deletion packages/web/src/components/DND/DNDContext.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { render, screen } from "@testing-library/react";
import { type ReactNode } from "react";
import { BehaviorSubject } from "rxjs";
import {
afterAll,
beforeEach,
Expand Down
1 change: 0 additions & 1 deletion packages/web/src/components/DND/Droppable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
forwardRef,
type HTMLAttributes,
type ReactHTML,
useCallback,
} from "react";

function CompassDroppable(
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/DatePicker/styled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components";
import { brighten, compliment, darken, isDark } from "@core/util/color.utils";
import { brighten, darken, isDark } from "@core/util/color.utils";
import { theme } from "@web/common/styles/theme";
import { Flex } from "@web/components/Flex";
import { Text } from "@web/components/Text";
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/components/Focusable/Focusable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export const Focusable = forwardRef<HTMLElement, Props>(
setIsFocused(true);
props.onFocus?.(event);
},
[props.onFocus, setIsFocused],
[props.onFocus],
);

const onBlur = useCallback(
(event: FocusEvent<HTMLElement>) => {
setIsFocused(false);
props.onBlur?.(event);
},
[props.onBlur, setIsFocused],
[props.onBlur],
);

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {
import {
type ForwardRefRenderFunction,
forwardRef,
type HTMLAttributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import { useEffect, useState } from "react";
import {
AlignItems,
JustifyContent,
Expand Down
2 changes: 0 additions & 2 deletions packages/web/src/components/SpaceCharacter/SpaceCharacter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import React from "react";

export const SpaceCharacter = () => <>&nbsp;</>;
1 change: 0 additions & 1 deletion packages/web/src/ducks/events/sagas/someday.sagas.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { runSaga } from "redux-saga";
import { Origin, Priorities } from "@core/constants/core.constants";
import { type Schema_Event } from "@core/types/event.types";
import dayjs from "@core/util/date/dayjs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useGridMouseMove = () => {
drag(e);
}
},
[draft?.isAllDay, drag, isDrafting, isDragging, isResizing, resize],
[drag, isDrafting, isDragging, isResizing, resize],
);

const _onMouseUp = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ export const useDraftActions = (

const event: WithCompassId<Omit<Schema_WebEvent, "_id">> = {
...draft,
_id: draft!._id!,
user: draft!.user,
_id: draft!._id,
user: draft?.user,
isAllDay: false,
isSomeday: true,
startDate: start,
endDate: end,
origin: draft!.origin,
origin: draft?.origin,
priority: draft?.priority ?? Priorities.UNASSIGNED,
order: somedayWeekCount,
};
Expand Down Expand Up @@ -341,7 +341,9 @@ export const useDraftActions = (

const event = new OnSubmitParser(draft).parse();
const payload = getEditSlicePayload(event, applyTo);
dispatch(editEventSlice.actions.request(payload as unknown as void));
dispatch(
editEventSlice.actions.request(payload as unknown as undefined),
);

if (shouldAddToView(event)) {
dispatch(getWeekEventsSlice.actions.insert(event._id!));
Expand Down Expand Up @@ -537,7 +539,7 @@ export const useDraftActions = (
setDraft((_draft): Schema_GridEvent => {
return {
..._draft!,
_id: _draft!._id!,
_id: _draft!._id,
hasFlipped: justFlipped,
endDate: endDate,
startDate: startDate,
Expand Down Expand Up @@ -673,6 +675,7 @@ export const useDraftActions = (
reduxDraft,
startDragging,
startResizing,
openForm,
]);

const actions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const useDraftEffects = (
setDateBeingChanged,
} = setters;

// biome-ignore lint/correctness/useExhaustiveDependencies: draft state should clear only when the visible week changes.
useEffect(() => {
if (isDragging || isResizing) {
return;
Expand All @@ -46,7 +47,6 @@ export const useDraftEffects = (
setDragStatus(null);
setResizeStatus(null);
setDateBeingChanged(null);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [weekProps.component.week]);

useEffect(() => {
Expand Down Expand Up @@ -91,5 +91,5 @@ export const useDraftEffects = (
durationMin,
});
}
}, [isDragging]);
}, [isDragging, setDragStatus, draft?.endDate, draft, setIsFormOpen]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useDraftConfirmation = ({
setRecurrenceUpdateScopeDialogOpen(false);
discard();
},
[finalDraft, submit, setFinalDraft, discard, deleteEvent],
[finalDraft, submit, discard, deleteEvent],
);

const onSubmit = useCallback(
Expand Down Expand Up @@ -60,14 +60,7 @@ export const useDraftConfirmation = ({
submit(_draft, applyTo);
discard();
},
[
submit,
setRecurrenceUpdateScopeDialogOpen,
setFinalDraft,
isRecurrence,
isInstance,
discard,
],
[submit, isRecurrence, isInstance, discard],
);

const onDelete = useCallback(async () => {
Expand All @@ -85,14 +78,7 @@ export const useDraftConfirmation = ({

deleteEvent(RecurringEventUpdateScope.THIS_EVENT);
discard();
}, [
isSomeday,
setRecurrenceUpdateScopeDialogOpen,
setFinalDraft,
deleteEvent,
isRecurrence,
discard,
]);
}, [isSomeday, deleteEvent, isRecurrence, discard]);

return {
isRecurrenceUpdateScopeDialogOpen,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type FC, type MouseEvent, useEffect } from "react";
import { type FC, type MouseEvent, useEffect } from "react";
import { YEAR_MONTH_DAY_FORMAT } from "@core/constants/date.constants";
import { Categories_Event } from "@core/types/event.types";
import {
Expand Down Expand Up @@ -45,7 +45,7 @@ export const AllDayRow: FC<Props> = ({
useEffect(() => {
measurements.remeasure(ID_GRID_MAIN);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rowsCount]);
}, [measurements.remeasure]);

const startAlldayDraft = async (e: MouseEvent) => {
const x = getX(e, isSidebarOpen);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type FC } from "react";
import { type FC } from "react";
import { YEAR_MONTH_DAY_FORMAT } from "@core/constants/date.constants";
import { type Dayjs } from "@core/util/date/dayjs";
import { theme } from "@web/common/styles/theme";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import dayjs from "@core/util/date/dayjs";
import {
getColorsByHour,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type FC } from "react";
import { type FC } from "react";
import { type DragEdgeNavigationState } from "@web/views/Calendar/hooks/grid/useDragEdgeNavigation";
import {
StyledEdgeZone,
Expand Down
Loading
Loading