Skip to content

Commit c481b43

Browse files
committed
feat(frontend): general updates
1 parent 2ae467b commit c481b43

30 files changed

+128
-73
lines changed

apps/frontend/app/components/fitness.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Anchor,
@@ -24,6 +23,7 @@ import {
2423
import { startCase, truncate } from "@ryot/ts-utils";
2524
import { IconTrophy } from "@tabler/icons-react";
2625
import { useQuery } from "@tanstack/react-query";
26+
import { $path } from "remix-routes";
2727
import { match } from "ts-pattern";
2828
import { withFragment } from "ufo";
2929
import { dayjsLib, getSetColor } from "~/lib/generals";

apps/frontend/app/components/media.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Anchor,
@@ -24,6 +23,7 @@ import {
2423
ThemeIcon,
2524
Tooltip,
2625
} from "@mantine/core";
26+
import { $path } from "remix-routes";
2727
import "@mantine/dates/styles.css";
2828
import { useDisclosure } from "@mantine/hooks";
2929
import { Form, Link, useFetcher } from "@remix-run/react";

apps/frontend/app/lib/generals.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type Umami from "@bitprojects/umami-logger-typescript";
12
import {
23
createQueryKeys,
34
mergeQueryKeys,
@@ -48,6 +49,14 @@ export const queryClient = new QueryClient({
4849
defaultOptions: { queries: { staleTime: Number.POSITIVE_INFINITY } },
4950
});
5051

52+
declare global {
53+
interface Window {
54+
umami?: {
55+
track: typeof Umami.trackEvent;
56+
};
57+
}
58+
}
59+
5160
export const getSetColor = (l: SetLot) =>
5261
match(l)
5362
.with(SetLot.WarmUp, () => "yellow")

apps/frontend/app/lib/hooks.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type Umami from "@bitprojects/umami-logger-typescript";
2-
import { $path } from "@ignisda/remix-routes";
31
import { useComputedColorScheme, useMantineTheme } from "@mantine/core";
42
import { useForceUpdate } from "@mantine/hooks";
53
import {
@@ -12,6 +10,7 @@ import type { EntityLot } from "@ryot/generated/graphql/backend/graphql";
1210
import { useQuery } from "@tanstack/react-query";
1311
import Cookies from "js-cookie";
1412
import type { FormEvent } from "react";
13+
import { $path } from "remix-routes";
1514
import { useInterval } from "usehooks-ts";
1615
import {
1716
CurrentWorkoutKey,
@@ -22,14 +21,6 @@ import {
2221
import { type InProgressWorkout, useCurrentWorkout } from "~/lib/state/fitness";
2322
import type { loader as dashboardLoader } from "~/routes/_dashboard";
2423

25-
declare global {
26-
interface Window {
27-
umami?: {
28-
track: typeof Umami.trackEvent;
29-
};
30-
}
31-
}
32-
3324
export const useGetMantineColor = () => {
3425
const theme = useMantineTheme();
3526
const colors = Object.keys(theme.colors);

apps/frontend/app/lib/state/fitness.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import type { NavigateFunction } from "@remix-run/react";
32
import {
43
type CreateUserWorkoutMutationVariables,
@@ -18,6 +17,7 @@ import { createDraft, finishDraft } from "immer";
1817
import { atom, useAtom } from "jotai";
1918
import { atomWithReset, atomWithStorage } from "jotai/utils";
2019
import Cookies from "js-cookie";
20+
import { $path } from "remix-routes";
2121
import { withFragment } from "ufo";
2222
import { v4 as randomUUID } from "uuid";
2323
import {

apps/frontend/app/lib/utilities.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
2-
import { $path } from "@ignisda/remix-routes";
32
import {
43
createCookie,
54
createCookieSessionStorage,
@@ -25,6 +24,7 @@ import {
2524
type Variables,
2625
} from "graphql-request";
2726
import type { VariablesAndRequestHeadersArgs } from "node_modules/graphql-request/build/legacy/helpers/types";
27+
import { $path } from "remix-routes";
2828
import { match } from "ts-pattern";
2929
import { withoutHost } from "ufo";
3030
import { v4 as randomUUID } from "uuid";

apps/frontend/app/routes/_dashboard._index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Alert,
43
Box,
@@ -34,6 +33,7 @@ import {
3433
IconServer,
3534
} from "@tabler/icons-react";
3635
import { Fragment, type ReactNode } from "react";
36+
import { $path } from "remix-routes";
3737
import invariant from "tiny-invariant";
3838
import { match } from "ts-pattern";
3939
import { ApplicationGrid } from "~/components/common";

apps/frontend/app/routes/_dashboard.calendar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Anchor,
@@ -24,6 +23,7 @@ import {
2423
} from "@ryot/generated/graphql/backend/graphql";
2524
import { isNumber, snakeCase, startCase, sum, truncate } from "@ryot/ts-utils";
2625
import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
26+
import { $path } from "remix-routes";
2727
import { z } from "zod";
2828
import { zx } from "zodix";
2929
import { dayjsLib } from "~/lib/generals";

apps/frontend/app/routes/_dashboard.collections.list.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Anchor,
@@ -37,6 +36,7 @@ import { IconEdit, IconPlus, IconTrashFilled } from "@tabler/icons-react";
3736
import { ClientError } from "graphql-request";
3837
import { useEffect, useState } from "react";
3938
import { Virtuoso } from "react-virtuoso";
39+
import { $path } from "remix-routes";
4040
import { namedAction } from "remix-utils/named-action";
4141
import { withQuery } from "ufo";
4242
import { z } from "zod";

apps/frontend/app/routes/_dashboard.fitness.$action.tsx

+35-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Buffer } from "buffer";
22
import { useAutoAnimate } from "@formkit/auto-animate/react";
33
import { DragDropContext, Draggable, Droppable } from "@hello-pangea/dnd";
4-
import { $path } from "@ignisda/remix-routes";
54
import {
65
ActionIcon,
76
Anchor,
@@ -79,6 +78,7 @@ import { RESET } from "jotai/utils";
7978
import Cookies from "js-cookie";
8079
import { useRef } from "react";
8180
import Webcam from "react-webcam";
81+
import { $path } from "remix-routes";
8282
import { ClientOnly } from "remix-utils/client-only";
8383
import { namedAction } from "remix-utils/named-action";
8484
import invariant from "tiny-invariant";
@@ -911,20 +911,7 @@ const ExerciseDisplay = (props: {
911911
</Menu.Target>
912912
{currentTimer?.triggeredBy?.exerciseIdentifier ===
913913
exercise.identifier ? (
914-
<Progress
915-
pos="absolute"
916-
color="violet"
917-
bottom={-6}
918-
value={
919-
(currentTimer.endAt.diff(dayjsLib(), "seconds") * 100) /
920-
currentTimer.totalTime
921-
}
922-
size="xs"
923-
radius="md"
924-
w="100%"
925-
onClick={props.openTimerDrawer}
926-
style={{ cursor: "pointer" }}
927-
/>
914+
<RestTimerProgress onClick={props.openTimerDrawer} />
928915
) : null}
929916
</Group>
930917
{exercise.notes.map((note, idx) => (
@@ -1118,6 +1105,30 @@ const ExerciseDisplay = (props: {
11181105
) : null;
11191106
};
11201107

1108+
const RestTimerProgress = (props: { onClick: () => void }) => {
1109+
const [currentTimer] = useTimerAtom();
1110+
forceUpdateEverySecond();
1111+
1112+
if (!currentTimer) return null;
1113+
1114+
return (
1115+
<Progress
1116+
pos="absolute"
1117+
color="violet"
1118+
bottom={-6}
1119+
value={
1120+
(currentTimer.endAt.diff(dayjsLib(), "seconds") * 100) /
1121+
currentTimer.totalTime
1122+
}
1123+
size="xs"
1124+
radius="md"
1125+
w="100%"
1126+
onClick={props.onClick}
1127+
style={{ cursor: "pointer" }}
1128+
/>
1129+
);
1130+
};
1131+
11211132
const SetDisplay = (props: {
11221133
setIdx: number;
11231134
repsCol: boolean;
@@ -1214,17 +1225,20 @@ const SetDisplay = (props: {
12141225
{exercise.alreadyDoneSets[props.setIdx] ? (
12151226
<Box
12161227
onClick={() => {
1217-
if (set.confirmedAt) return;
12181228
setCurrentWorkout(
12191229
produce(currentWorkout, (draft) => {
1220-
draft.exercises[props.exerciseIdx].sets[
1221-
props.setIdx
1222-
].statistic =
1223-
exercise.alreadyDoneSets[props.setIdx].statistic;
1230+
const idxToTarget = set.confirmedAt
1231+
? props.setIdx + 1
1232+
: props.setIdx;
1233+
const setToTarget =
1234+
draft.exercises[props.exerciseIdx].sets[idxToTarget];
1235+
if (setToTarget)
1236+
setToTarget.statistic =
1237+
exercise.alreadyDoneSets[props.setIdx].statistic;
12241238
}),
12251239
);
12261240
}}
1227-
style={!set.confirmedAt ? { cursor: "pointer" } : undefined}
1241+
style={{ cursor: "pointer" }}
12281242
>
12291243
<DisplaySetStatistics
12301244
statistic={exercise.alreadyDoneSets[props.setIdx].statistic}

apps/frontend/app/routes/_dashboard.fitness.$entity.$id._index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useAutoAnimate } from "@formkit/auto-animate/react";
2-
import { $path } from "@ignisda/remix-routes";
32
import {
43
ActionIcon,
54
Anchor,
@@ -20,6 +19,7 @@ import {
2019
Title,
2120
} from "@mantine/core";
2221
import { DateTimePicker } from "@mantine/dates";
22+
import { $path } from "remix-routes";
2323
import "@mantine/dates/styles.css";
2424
import { useDisclosure } from "@mantine/hooks";
2525
import { unstable_defineAction, unstable_defineLoader } from "@remix-run/node";

apps/frontend/app/routes/_dashboard.fitness.$entity.list.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Accordion,
43
ActionIcon,
@@ -32,6 +31,7 @@ import {
3231
IconWeight,
3332
} from "@tabler/icons-react";
3433
import type { ReactElement } from "react";
34+
import { $path } from "remix-routes";
3535
import invariant from "tiny-invariant";
3636
import { match } from "ts-pattern";
3737
import { z } from "zod";

apps/frontend/app/routes/_dashboard.fitness.exercises.$action.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Button,
43
Container,
@@ -36,6 +35,7 @@ import {
3635
import { cloneDeep, processSubmission, startCase } from "@ryot/ts-utils";
3736
import { IconPhoto } from "@tabler/icons-react";
3837
import { ClientError } from "graphql-request";
38+
import { $path } from "remix-routes";
3939
import { namedAction } from "remix-utils/named-action";
4040
import invariant from "tiny-invariant";
4141
import { match } from "ts-pattern";

apps/frontend/app/routes/_dashboard.fitness.exercises.item.$id._index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Affix,
@@ -40,6 +39,7 @@ import {
4039
import { useQuery } from "@tanstack/react-query";
4140
import { Fragment } from "react";
4241
import { Virtuoso } from "react-virtuoso";
42+
import { $path } from "remix-routes";
4343
import { match } from "ts-pattern";
4444
import { withFragment } from "ufo";
4545
import { z } from "zod";

apps/frontend/app/routes/_dashboard.fitness.exercises.list.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Affix,
@@ -47,6 +46,7 @@ import {
4746
IconFilter,
4847
IconPlus,
4948
} from "@tabler/icons-react";
49+
import { $path } from "remix-routes";
5050
import { z } from "zod";
5151
import { zx } from "zodix";
5252
import { DebouncedSearchInput, FiltersModal } from "~/components/common";

apps/frontend/app/routes/_dashboard.media.$action.$lot.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Box,
@@ -48,6 +47,7 @@ import {
4847
IconSortDescending,
4948
} from "@tabler/icons-react";
5049
import { useState } from "react";
50+
import { $path } from "remix-routes";
5151
import { match } from "ts-pattern";
5252
import { withoutHost } from "ufo";
5353
import { z } from "zod";

apps/frontend/app/routes/_dashboard.media.create.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Anchor,
43
Button,
@@ -29,6 +28,7 @@ import {
2928
} from "@ryot/generated/graphql/backend/graphql";
3029
import { camelCase, changeCase, processSubmission } from "@ryot/ts-utils";
3130
import { IconCalendar, IconPhoto, IconVideo } from "@tabler/icons-react";
31+
import { $path } from "remix-routes";
3232
import { z } from "zod";
3333
import { useCoreDetails } from "~/lib/hooks";
3434
import { s3FileUploader, serverGqlService } from "~/lib/utilities.server";

apps/frontend/app/routes/_dashboard.media.genre.list.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Anchor,
43
Box,
@@ -20,6 +19,7 @@ import {
2019
} from "@remix-run/react";
2120
import { GenresListDocument } from "@ryot/generated/graphql/backend/graphql";
2221
import { truncate } from "@ryot/ts-utils";
22+
import { $path } from "remix-routes";
2323
import { z } from "zod";
2424
import { zx } from "zodix";
2525
import { ApplicationGrid, DebouncedSearchInput } from "~/components/common";

apps/frontend/app/routes/_dashboard.media.groups.$action.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
Box,
43
Center,
@@ -28,6 +27,7 @@ import {
2827
import { changeCase, startCase } from "@ryot/ts-utils";
2928
import { IconListCheck, IconSearch } from "@tabler/icons-react";
3029
import { useState } from "react";
30+
import { $path } from "remix-routes";
3131
import invariant from "tiny-invariant";
3232
import { match } from "ts-pattern";
3333
import { withoutHost } from "ufo";

apps/frontend/app/routes/_dashboard.media.item.$id._index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useAutoAnimate } from "@formkit/auto-animate/react";
2-
import { $path } from "@ignisda/remix-routes";
32
import {
43
Accordion,
54
ActionIcon,
@@ -77,6 +76,7 @@ import {
7776
import type { HumanizeDurationOptions } from "humanize-duration-ts";
7877
import { Fragment, type ReactNode, forwardRef, useState } from "react";
7978
import { Virtuoso, VirtuosoGrid } from "react-virtuoso";
79+
import { $path } from "remix-routes";
8080
import { namedAction } from "remix-utils/named-action";
8181
import { match } from "ts-pattern";
8282
import { withQuery } from "ufo";

apps/frontend/app/routes/_dashboard.media.people.$action.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Box,
@@ -39,6 +38,7 @@ import {
3938
IconSortDescending,
4039
} from "@tabler/icons-react";
4140
import { useState } from "react";
41+
import { $path } from "remix-routes";
4242
import { match } from "ts-pattern";
4343
import { withoutHost } from "ufo";
4444
import { z } from "zod";

apps/frontend/app/routes/_dashboard.settings.users.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { $path } from "@ignisda/remix-routes";
21
import {
32
ActionIcon,
43
Avatar,
@@ -48,6 +47,7 @@ import {
4847
} from "@tabler/icons-react";
4948
import { forwardRef, useState } from "react";
5049
import { VirtuosoGrid } from "react-virtuoso";
50+
import { $path } from "remix-routes";
5151
import { namedAction } from "remix-utils/named-action";
5252
import { match } from "ts-pattern";
5353
import { withQuery } from "ufo";

0 commit comments

Comments
 (0)