Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

refactor: ponytail audit

Amruth Pillai9110e8699728
diff --git a/apps/server/src/http/health.ts b/apps/server/src/http/health.ts
index 0f7e8e8fb..27fd46073 100644
--- a/apps/server/src/http/health.ts
+++ b/apps/server/src/http/health.ts
@@ -37,9 +37,7 @@ async function checkDatabase() {
return { status: "healthy" };
}
-async function checkStorage() {
- return getStorageService().healthcheck();
-}
+const checkStorage = () => getStorageService().healthcheck();
export async function handleHealth() {
const [database, storage] = await Promise.all([runCheck(checkDatabase), runCheck(checkStorage)]);
diff --git a/apps/server/src/mcp/handler.ts b/apps/server/src/mcp/handler.ts
index 1ccfd0a31..5443a8b08 100644
--- a/apps/server/src/mcp/handler.ts
+++ b/apps/server/src/mcp/handler.ts
@@ -7,7 +7,7 @@ export async function handleMcp(request: Request) {
try {
await authenticateRequest(request);
- const server = await createMcpServer(request);
+ const server = createMcpServer(request);
const transport = new WebStandardStreamableHTTPServerTransport({
enableJsonResponse: true,
});
diff --git a/apps/server/src/mcp/server.ts b/apps/server/src/mcp/server.ts
index 80e3a1735..6cbce3c61 100644
--- a/apps/server/src/mcp/server.ts
+++ b/apps/server/src/mcp/server.ts
@@ -22,7 +22,7 @@ function createRequestClient(request: Request): RouterClient<typeof router> {
});
}
-export async function createMcpServer(request: Request) {
+export function createMcpServer(request: Request) {
const server = new McpServer(
{
name: "reactive-resume",
diff --git a/apps/server/src/openapi/metadata.ts b/apps/server/src/openapi/metadata.ts
index 9972a92a4..8ace7869b 100644
--- a/apps/server/src/openapi/metadata.ts
+++ b/apps/server/src/openapi/metadata.ts
@@ -4,8 +4,8 @@ import { env } from "@reactive-resume/env/server";
import { buildMcpServerCard } from "@reactive-resume/mcp/server-card";
import { appVersion } from "../app-version";
-const oauthAuthorizationServerHandler = oauthProviderAuthServerMetadata(auth);
-const openIdConfigurationHandler = oauthProviderOpenIdConfigMetadata(auth);
+export const handleOAuthAuthorizationServer = oauthProviderAuthServerMetadata(auth);
+export const handleOpenIdConfiguration = oauthProviderOpenIdConfigMetadata(auth);
export function handleWellKnownFallback() {
return new Response("OK", { status: 200 });
@@ -20,15 +20,7 @@ export function handleMcpServerCard() {
});
}
-export function handleOAuthAuthorizationServer(request: Request) {
- return oauthAuthorizationServerHandler(request);
-}
-
-export function handleOpenIdConfiguration(request: Request) {
- return openIdConfigurationHandler(request);
-}
-
-export async function handleOAuthProtectedResource() {
+export function handleOAuthProtectedResource() {
const metadata = {
resource: env.APP_URL,
bearer_methods_supported: ["header"],
diff --git a/apps/web/src/components/input/chip-input.tsx b/apps/web/src/components/input/chip-input.tsx
index 7284d5ef5..b0218a8fc 100644
--- a/apps/web/src/components/input/chip-input.tsx
+++ b/apps/web/src/components/input/chip-input.tsx
@@ -176,7 +176,7 @@ export function ChipInput({
});
if (nextValues.length === 0) return;
- const newChips = Array.from(new Set([...chips, ...nextValues]));
+ const newChips = [...new Set([...chips, ...nextValues])];
setChips(newChips);
},
[chips, setChips],
@@ -269,7 +269,7 @@ export function ChipInput({
const oldIndex = chips.indexOf(active.id as string);
const newIndex = chips.indexOf(over.id as string);
if (oldIndex !== -1 && newIndex !== -1 && oldIndex !== newIndex) {
- const newOrder = Array.from(chips);
+ const newOrder = [...chips];
const [removed] = newOrder.splice(oldIndex, 1);
newOrder.splice(newIndex, 0, removed);
handleReorder(newOrder);
diff --git a/apps/web/src/components/input/icon-picker.tsx b/apps/web/src/components/input/icon-picker.tsx
index 02c539ee3..d0d1b7db6 100644
--- a/apps/web/src/components/input/icon-picker.tsx
+++ b/apps/web/src/components/input/icon-picker.tsx
@@ -3,7 +3,7 @@ import type { CellComponentProps } from "react-window";
import { t } from "@lingui/core/macro";
import { ProhibitIcon } from "@phosphor-icons/react";
import Fuse from "fuse.js";
-import { memo, useCallback, useMemo, useState } from "react";
+import { useMemo, useState } from "react";
import { Grid } from "react-window";
import { icons } from "@reactive-resume/schema/icons";
import { Button } from "@reactive-resume/ui/components/button";
@@ -14,6 +14,7 @@ import { cn } from "@reactive-resume/utils/style";
const columnCount = 8;
const columnWidth = 36;
const rowHeight = 36;
+const iconSearch = new Fuse(icons, { threshold: 0.35 });
type IconSearchInputProps = {
value: string;
@@ -21,7 +22,7 @@ type IconSearchInputProps = {
className?: string;
};
-function _IconSearchInput(props: IconSearchInputProps) {
+function IconSearchInput(props: IconSearchInputProps) {
return (
<Input
spellCheck={false}
@@ -41,10 +42,6 @@ function _IconSearchInput(props: IconSearchInputProps) {
);
}
-const IconSearchInput = memo(_IconSearchInput);
-
-IconSearchInput.displayName = "IconSearchInput";
-
type IconCellComponentProps = CellComponentProps & {
icons: IconName[];
onChange: (icon: IconName) => void;
@@ -70,18 +67,9 @@ function IconCellComponent({ columnIndex, rowIndex, style, icons, onChange }: Ic
);
}
-function useIconSearch() {
- const fuse = useMemo(() => new Fuse(icons, { threshold: 0.35 }), []);
-
- const search = useCallback(
- (query: string): IconName[] => {
- if (!query.trim()) return Array.from(icons);
- return fuse.search(query).map((result) => result.item);
- },
- [fuse],
- );
-
- return search;
+function searchIcons(query: string): IconName[] {
+ if (!query.trim()) return [...icons];
+ return iconSearch.search(query).map((result) => result.item);
}
type IconPickerProps = Omit<React.ComponentProps<typeof Button>, "value" | "onChange"> & {
@@ -91,12 +79,10 @@ type IconPickerProps = Omit<React.ComponentProps<typeof Button>, "value" | "onCh
};
export function IconPicker({ value, onChange, popoverProps, ...props }: IconPickerProps) {
- const searchIcons = useIconSearch();
-
const [search, setSearch] = useState("");
- const searchedIcons = useMemo(() => searchIcons(search), [search, searchIcons]);
- const rowCount = useMemo(() => Math.ceil(searchedIcons.length / columnCount), [searchedIcons]);
+ const searchedIcons = useMemo(() => searchIcons(search), [search]);
+ const rowCount = Math.ceil(searchedIcons.length / columnCount);
return (
<Popover {...popoverProps}>
diff --git a/apps/web/src/components/typography/get-next-weights.ts b/apps/web/src/components/typography/get-next-weights.ts
index d2e80d826..ac9bbbf69 100644
--- a/apps/web/src/components/typography/get-next-weights.ts
+++ b/apps/web/src/components/typography/get-next-weights.ts
@@ -6,7 +6,7 @@ export function getNextWeights(fontFamily: string): Weight[] | null {
const fontData = getFont(fontFamily);
if (!fontData || !Array.isArray(fontData.weights) || fontData.weights.length === 0) return null;
- const uniqueWeights = Array.from(new Set(fontData.weights)) as Weight[];
+ const uniqueWeights = [...new Set(fontData.weights)] as Weight[];
// Try to pick 400 and 600 if available
const weights: Weight[] = [];
diff --git a/apps/web/src/dialogs/resume/index.tsx b/apps/web/src/dialogs/resume/index.tsx
index 05f8d54d5..5bc5c8c44 100644
--- a/apps/web/src/dialogs/resume/index.tsx
+++ b/apps/web/src/dialogs/resume/index.tsx
@@ -284,7 +284,7 @@ export function DuplicateResumeDialog({ data }: DialogProps<"resume.duplicate">)
const toastId = toast.loading(t`Duplicating your resume...`);
duplicateResume(value, {
- onSuccess: async (id) => {
+ onSuccess: (id) => {
toast.success(t`Your resume has been duplicated successfully.`, { id: toastId });
closeDialog();
diff --git a/apps/web/src/dialogs/resume/sections/award.tsx b/apps/web/src/dialogs/resume/sections/award.tsx
index a19e716a7..4d90a905a 100644
--- a/apps/web/src/dialogs/resume/sections/award.tsx
+++ b/apps/web/src/dialogs/resume/sections/award.tsx
@@ -7,8 +7,6 @@ import { awardItemSchema } from "@reactive-resume/schema/resume/data";
import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
import { Input } from "@reactive-resume/ui/components/input";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -38,7 +36,7 @@ export function CreateAwardDialog({ data }: DialogProps<"resume.sections.awards.
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "awards", value, data?.customSectionId);
});
@@ -70,7 +68,7 @@ export function UpdateAwardDialog({ data }: DialogProps<"resume.sections.awards.
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "awards", value, data?.customSectionId);
});
@@ -127,21 +125,9 @@ const AwardForm = withForm({
<form.AppField name="date">{(field) => <field.TextField label={<Trans>Date</Trans>} />}</form.AppField>
- <form.Field name="website">
- {(field) => (
- <FormItem hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}>
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="website">
+ {(field) => <field.WebsiteField label={<Trans>Website</Trans>} hideLabelButton={inlineLink} />}
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -163,20 +149,9 @@ const AwardForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/certification.tsx b/apps/web/src/dialogs/resume/sections/certification.tsx
index 2d19c5cd1..0ed6ee47b 100644
--- a/apps/web/src/dialogs/resume/sections/certification.tsx
+++ b/apps/web/src/dialogs/resume/sections/certification.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { certificationItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -37,7 +35,7 @@ export function CreateCertificationDialog({ data }: DialogProps<"resume.sections
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "certifications", value, data?.customSectionId);
});
@@ -69,7 +67,7 @@ export function UpdateCertificationDialog({ data }: DialogProps<"resume.sections
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "certifications", value, data?.customSectionId);
});
@@ -107,21 +105,9 @@ const CertificationForm = withForm({
<form.AppField name="date">{(field) => <field.TextField label={<Trans>Date</Trans>} />}</form.AppField>
- <form.Field name="website">
- {(field) => (
- <FormItem hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}>
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="website">
+ {(field) => <field.WebsiteField label={<Trans>Website</Trans>} hideLabelButton={inlineLink} />}
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -143,20 +129,9 @@ const CertificationForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/cover-letter.tsx b/apps/web/src/dialogs/resume/sections/cover-letter.tsx
index 9b832c6ac..ea22d497e 100644
--- a/apps/web/src/dialogs/resume/sections/cover-letter.tsx
+++ b/apps/web/src/dialogs/resume/sections/cover-letter.tsx
@@ -31,7 +31,7 @@ export function CreateCoverLetterDialog({ data }: DialogProps<"resume.sections.c
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
if (data?.customSectionId) {
const section = draft.customSections.find((s) => s.id === data.customSectionId);
@@ -67,7 +67,7 @@ export function UpdateCoverLetterDialog({ data }: DialogProps<"resume.sections.c
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
if (data?.customSectionId) {
const section = draft.customSections.find((s) => s.id === data.customSectionId);
diff --git a/apps/web/src/dialogs/resume/sections/custom.tsx b/apps/web/src/dialogs/resume/sections/custom.tsx
index 40f1b07e5..35242998a 100644
--- a/apps/web/src/dialogs/resume/sections/custom.tsx
+++ b/apps/web/src/dialogs/resume/sections/custom.tsx
@@ -88,7 +88,7 @@ export function CreateCustomSectionDialog({ data }: DialogProps<"resume.sections
items: data?.items ?? [],
},
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
draft.customSections.push(value);
const lastPageIndex = draft.metadata.layout.pages.length - 1;
@@ -146,7 +146,7 @@ export function UpdateCustomSectionDialog({ data }: DialogProps<"resume.sections
icon: data.icon ?? "",
},
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
const index = draft.customSections.findIndex((item) => item.id === value.id);
if (index === -1) return;
diff --git a/apps/web/src/dialogs/resume/sections/education.tsx b/apps/web/src/dialogs/resume/sections/education.tsx
index 2253a266b..e5c982c9e 100644
--- a/apps/web/src/dialogs/resume/sections/education.tsx
+++ b/apps/web/src/dialogs/resume/sections/education.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { educationItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -40,7 +38,7 @@ export function CreateEducationDialog({ data }: DialogProps<"resume.sections.edu
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "education", value, data?.customSectionId);
});
@@ -72,7 +70,7 @@ export function UpdateEducationDialog({ data }: DialogProps<"resume.sections.edu
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "education", value, data?.customSectionId);
});
@@ -116,24 +114,15 @@ const EducationForm = withForm({
<form.AppField name="period">{(field) => <field.TextField label={<Trans>Period</Trans>} />}</form.AppField>
- <form.Field name="website">
+ <form.AppField name="website">
{(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
+ <field.WebsiteField
+ label={<Trans>Website</Trans>}
+ formItemClassName="sm:col-span-full"
+ hideLabelButton={inlineLink}
+ />
)}
- </form.Field>
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -155,20 +144,9 @@ const EducationForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/experience.tsx b/apps/web/src/dialogs/resume/sections/experience.tsx
index 26bba3047..8e029b214 100644
--- a/apps/web/src/dialogs/resume/sections/experience.tsx
+++ b/apps/web/src/dialogs/resume/sections/experience.tsx
@@ -12,7 +12,6 @@ import { Input } from "@reactive-resume/ui/components/input";
import { Switch } from "@reactive-resume/ui/components/switch";
import { generateId } from "@reactive-resume/utils/string";
import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -44,7 +43,7 @@ export function CreateExperienceDialog({ data }: DialogProps<"resume.sections.ex
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "experience", value, data?.customSectionId);
});
@@ -76,7 +75,7 @@ export function UpdateExperienceDialog({ data }: DialogProps<"resume.sections.ex
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "experience", value, data?.customSectionId);
});
@@ -122,24 +121,15 @@ const ExperienceForm = withForm({
<form.AppField name="period">{(field) => <field.TextField label={<Trans>Period</Trans>} />}</form.AppField>
- <form.Field name="website">
+ <form.AppField name="website">
{(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
+ <field.WebsiteField
+ label={<Trans>Website</Trans>}
+ formItemClassName="sm:col-span-full"
+ hideLabelButton={inlineLink}
+ />
)}
- </form.Field>
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -219,20 +209,9 @@ const ExperienceForm = withForm({
{/* Single Role Description — only show when no roles are defined */}
{!hasRoles && (
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
)}
</>
);
diff --git a/apps/web/src/dialogs/resume/sections/interest.tsx b/apps/web/src/dialogs/resume/sections/interest.tsx
index b62e9d288..b308b92f3 100644
--- a/apps/web/src/dialogs/resume/sections/interest.tsx
+++ b/apps/web/src/dialogs/resume/sections/interest.tsx
@@ -39,7 +39,7 @@ export function CreateInterestDialog({ data }: DialogProps<"resume.sections.inte
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "interests", value, data?.customSectionId);
});
@@ -71,7 +71,7 @@ export function UpdateInterestDialog({ data }: DialogProps<"resume.sections.inte
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "interests", value, data?.customSectionId);
});
diff --git a/apps/web/src/dialogs/resume/sections/language.tsx b/apps/web/src/dialogs/resume/sections/language.tsx
index 14a2c3fdb..5d7ff45e1 100644
--- a/apps/web/src/dialogs/resume/sections/language.tsx
+++ b/apps/web/src/dialogs/resume/sections/language.tsx
@@ -34,7 +34,7 @@ export function CreateLanguageDialog({ data }: DialogProps<"resume.sections.lang
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "languages", value, data?.customSectionId);
});
@@ -66,7 +66,7 @@ export function UpdateLanguageDialog({ data }: DialogProps<"resume.sections.lang
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "languages", value, data?.customSectionId);
});
diff --git a/apps/web/src/dialogs/resume/sections/profile.tsx b/apps/web/src/dialogs/resume/sections/profile.tsx
index b318a7351..8c68aeeea 100644
--- a/apps/web/src/dialogs/resume/sections/profile.tsx
+++ b/apps/web/src/dialogs/resume/sections/profile.tsx
@@ -17,7 +17,6 @@ import { Switch } from "@reactive-resume/ui/components/switch";
import { cn } from "@reactive-resume/utils/style";
import { ColorPicker } from "@/components/input/color-picker";
import { IconPicker } from "@/components/input/icon-picker";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -47,7 +46,7 @@ export function CreateProfileDialog({ data }: DialogProps<"resume.sections.profi
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "profiles", value, data?.customSectionId);
});
@@ -79,7 +78,7 @@ export function UpdateProfileDialog({ data }: DialogProps<"resume.sections.profi
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "profiles", value, data?.customSectionId);
});
@@ -211,24 +210,15 @@ const ProfileForm = withForm({
)}
</form.Field>
- <form.Field name="website">
+ <form.AppField name="website">
{(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
+ <field.WebsiteField
+ label={<Trans>Website</Trans>}
+ formItemClassName="sm:col-span-full"
+ hideLabelButton={inlineLink}
+ />
)}
- </form.Field>
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
diff --git a/apps/web/src/dialogs/resume/sections/project.tsx b/apps/web/src/dialogs/resume/sections/project.tsx
index 3e051ce00..ae9fd43bd 100644
--- a/apps/web/src/dialogs/resume/sections/project.tsx
+++ b/apps/web/src/dialogs/resume/sections/project.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { projectItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -36,7 +34,7 @@ export function CreateProjectDialog({ data }: DialogProps<"resume.sections.proje
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "projects", value, data?.customSectionId);
});
@@ -68,7 +66,7 @@ export function UpdateProjectDialog({ data }: DialogProps<"resume.sections.proje
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "projects", value, data?.customSectionId);
});
@@ -104,24 +102,15 @@ const ProjectForm = withForm({
<form.AppField name="period">{(field) => <field.TextField label={<Trans>Period</Trans>} />}</form.AppField>
- <form.Field name="website">
+ <form.AppField name="website">
{(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
+ <field.WebsiteField
+ label={<Trans>Website</Trans>}
+ formItemClassName="sm:col-span-full"
+ hideLabelButton={inlineLink}
+ />
)}
- </form.Field>
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -143,20 +132,9 @@ const ProjectForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/publication.tsx b/apps/web/src/dialogs/resume/sections/publication.tsx
index 5d62b31e9..bed592372 100644
--- a/apps/web/src/dialogs/resume/sections/publication.tsx
+++ b/apps/web/src/dialogs/resume/sections/publication.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { publicationItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -37,7 +35,7 @@ export function CreatePublicationDialog({ data }: DialogProps<"resume.sections.p
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "publications", value, data?.customSectionId);
});
@@ -69,7 +67,7 @@ export function UpdatePublicationDialog({ data }: DialogProps<"resume.sections.p
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "publications", value, data?.customSectionId);
});
@@ -109,21 +107,9 @@ const PublicationForm = withForm({
<form.AppField name="date">{(field) => <field.TextField label={<Trans>Date</Trans>} />}</form.AppField>
- <form.Field name="website">
- {(field) => (
- <FormItem hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}>
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="website">
+ {(field) => <field.WebsiteField label={<Trans>Website</Trans>} hideLabelButton={inlineLink} />}
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -145,20 +131,9 @@ const PublicationForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/reference.tsx b/apps/web/src/dialogs/resume/sections/reference.tsx
index 11efdfcd9..69e37a55e 100644
--- a/apps/web/src/dialogs/resume/sections/reference.tsx
+++ b/apps/web/src/dialogs/resume/sections/reference.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { referenceItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -37,7 +35,7 @@ export function CreateReferenceDialog({ data }: DialogProps<"resume.sections.ref
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "references", value, data?.customSectionId);
});
@@ -69,7 +67,7 @@ export function UpdateReferenceDialog({ data }: DialogProps<"resume.sections.ref
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "references", value, data?.customSectionId);
});
@@ -107,21 +105,9 @@ const ReferenceForm = withForm({
<form.AppField name="phone">{(field) => <field.TextField label={<Trans>Phone</Trans>} />}</form.AppField>
- <form.Field name="website">
- {(field) => (
- <FormItem hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}>
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="website">
+ {(field) => <field.WebsiteField label={<Trans>Website</Trans>} hideLabelButton={inlineLink} />}
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -143,20 +129,9 @@ const ReferenceForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/dialogs/resume/sections/skill.tsx b/apps/web/src/dialogs/resume/sections/skill.tsx
index a41781230..e830aaf7b 100644
--- a/apps/web/src/dialogs/resume/sections/skill.tsx
+++ b/apps/web/src/dialogs/resume/sections/skill.tsx
@@ -43,7 +43,7 @@ export function CreateSkillDialog({ data }: DialogProps<"resume.sections.skills.
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "skills", value, data?.customSectionId);
});
@@ -75,7 +75,7 @@ export function UpdateSkillDialog({ data }: DialogProps<"resume.sections.skills.
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "skills", value, data?.customSectionId);
});
diff --git a/apps/web/src/dialogs/resume/sections/summary-item.tsx b/apps/web/src/dialogs/resume/sections/summary-item.tsx
index ae9b31716..a370f8c2b 100644
--- a/apps/web/src/dialogs/resume/sections/summary-item.tsx
+++ b/apps/web/src/dialogs/resume/sections/summary-item.tsx
@@ -30,7 +30,7 @@ export function CreateSummaryItemDialog({ data }: DialogProps<"resume.sections.s
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
if (data?.customSectionId) {
const section = draft.customSections.find((s) => s.id === data.customSectionId);
@@ -66,7 +66,7 @@ export function UpdateSummaryItemDialog({ data }: DialogProps<"resume.sections.s
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeStore((draft) => {
if (data?.customSectionId) {
const section = draft.customSections.find((s) => s.id === data.customSectionId);
diff --git a/apps/web/src/dialogs/resume/sections/volunteer.tsx b/apps/web/src/dialogs/resume/sections/volunteer.tsx
index e4db14e04..b45eb7f6b 100644
--- a/apps/web/src/dialogs/resume/sections/volunteer.tsx
+++ b/apps/web/src/dialogs/resume/sections/volunteer.tsx
@@ -4,10 +4,8 @@ import { Trans } from "@lingui/react/macro";
import { PencilSimpleLineIcon, PlusIcon } from "@phosphor-icons/react";
import { useStore } from "@tanstack/react-form";
import { volunteerItemSchema } from "@reactive-resume/schema/resume/data";
-import { FormControl, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
+import { FormControl, FormItem, FormLabel } from "@reactive-resume/ui/components/form";
import { Switch } from "@reactive-resume/ui/components/switch";
-import { RichInput } from "@/components/input/rich-input";
-import { URLInput } from "@/components/input/url-input";
import { useDialogStore } from "@/dialogs/store";
import { useUpdateResumeData } from "@/features/resume/builder/draft";
import { useFormBlocker } from "@/hooks/use-form-blocker";
@@ -37,7 +35,7 @@ export function CreateVolunteerDialog({ data }: DialogProps<"resume.sections.vol
const form = useAppForm({
defaultValues: makeSectionItem(defaultValues, data?.item),
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
createSectionItem(draft, "volunteer", value, data?.customSectionId);
});
@@ -69,7 +67,7 @@ export function UpdateVolunteerDialog({ data }: DialogProps<"resume.sections.vol
const form = useAppForm({
defaultValues: data.item,
validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
+ onSubmit: ({ value }) => {
updateResumeData((draft) => {
updateSectionItem(draft, "volunteer", value, data?.customSectionId);
});
@@ -109,21 +107,9 @@ const VolunteerForm = withForm({
<form.AppField name="period">{(field) => <field.TextField label={<Trans>Period</Trans>} />}</form.AppField>
- <form.Field name="website">
- {(field) => (
- <FormItem hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}>
- <FormLabel>
- <Trans>Website</Trans>
- </FormLabel>
- <URLInput
- value={field.state.value}
- onChange={(v) => field.handleChange(v)}
- hideLabelButton={inlineLink}
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="website">
+ {(field) => <field.WebsiteField label={<Trans>Website</Trans>} hideLabelButton={inlineLink} />}
+ </form.AppField>
<form.Field name="website.inlineLink">
{(field) => (
@@ -145,20 +131,9 @@ const VolunteerForm = withForm({
)}
</form.Field>
- <form.Field name="description">
- {(field) => (
- <FormItem
- className="sm:col-span-full"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormLabel>
- <Trans>Description</Trans>
- </FormLabel>
- <FormControl render={<RichInput value={field.state.value} onChange={(v) => field.handleChange(v)} />} />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
+ <form.AppField name="description">
+ {(field) => <field.RichTextField label={<Trans>Description</Trans>} formItemClassName="sm:col-span-full" />}
+ </form.AppField>
</>
);
},
diff --git a/apps/web/src/features/applications/components/application-detail-sheet.tsx b/apps/web/src/features/applications/components/application-detail-sheet.tsx
index 05bc56186..25e25828a 100644
--- a/apps/web/src/features/applications/components/application-detail-sheet.tsx
+++ b/apps/web/src/features/applications/components/application-detail-sheet.tsx
@@ -40,7 +40,7 @@ const stageOf = (status: ApplicationStatus) => STAGES.find((s) => s.value === st
const dateInputValue = (value: Date | string) => {
const date = new Date(value);
- return `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, "0")}-${String(date.getUTCDate()).padStart(2, "0")}`;
+ return Number.isNaN(date.getTime()) ? "" : date.toISOString().slice(0, 10);
};
const formatDate = (value: Date | string) =>
diff --git a/apps/web/src/features/applications/components/application-form-sheet.tsx b/apps/web/src/features/applications/components/application-form-sheet.tsx
index f309eda8c..a8c30b037 100644
--- a/apps/web/src/features/applications/components/application-form-sheet.tsx
+++ b/apps/web/src/features/applications/components/application-form-sheet.tsx
@@ -27,10 +27,7 @@ import { FileAttachmentField } from "./file-attachment-field";
// Preset source suggestions surfaced via a <datalist>; the field itself stays free-text.
const SOURCE_OPTIONS = ["LinkedIn", "Indeed", "Company Website", "Referral", "Recruiter", "Other"];
-const todayInputValue = () => {
- const now = new Date();
- return `${now.getUTCFullYear()}-${String(now.getUTCMonth() + 1).padStart(2, "0")}-${String(now.getUTCDate()).padStart(2, "0")}`;
-};
+const todayInputValue = () => new Date().toISOString().slice(0, 10);
const emptyForm = () => ({
company: "",
diff --git a/apps/web/src/features/auth/pages/resume-password.tsx b/apps/web/src/features/auth/pages/resume-password.tsx
index dafe5b071..1fdc388df 100644
--- a/apps/web/src/features/auth/pages/resume-password.tsx
+++ b/apps/web/src/features/auth/pages/resume-password.tsx
@@ -4,7 +4,6 @@ import { ORPCError } from "@orpc/client";
import { EyeIcon, EyeSlashIcon, LockOpenIcon } from "@phosphor-icons/react";
import { useMutation } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
-import { useMemo } from "react";
import { toast } from "sonner";
import { useToggle } from "usehooks-ts";
import z from "zod";
@@ -29,16 +28,13 @@ export function ResumePasswordPage({ redirectPath }: Props) {
const { mutate: verifyPassword } = useMutation(orpc.resume.verifyPassword.mutationOptions());
- const [username, slug] = useMemo(() => {
- const [username, slug] = redirectPath.split("/").slice(1) as [string, string];
- if (!username || !slug) throw navigate({ to: "/" });
- return [username, slug];
- }, [redirectPath, navigate]);
+ const [username, slug] = redirectPath.split("/").slice(1) as [string, string];
+ if (!username || !slug) throw navigate({ to: "/" });
const form = useAppForm({
defaultValues: { password: "" },
validators: { onSubmit: formSchema },
- onSubmit: async ({ value, formApi }) => {
+ onSubmit: ({ value, formApi }) => {
const toastId = toast.loading(t`Verifying password...`);
verifyPassword(
diff --git a/apps/web/src/features/auth/pages/verify-2fa-backup.tsx b/apps/web/src/features/auth/pages/verify-2fa-backup.tsx
deleted file mode 100644
index 397efa902..000000000
--- a/apps/web/src/features/auth/pages/verify-2fa-backup.tsx
+++ /dev/null
@@ -1,111 +0,0 @@
-import { t } from "@lingui/core/macro";
-import { Trans } from "@lingui/react/macro";
-import { ArrowLeftIcon, CheckIcon } from "@phosphor-icons/react";
-import { Link, useNavigate, useRouter } from "@tanstack/react-router";
-import { toast } from "sonner";
-import z from "zod";
-import { Button } from "@reactive-resume/ui/components/button";
-import { FormControl, FormItem, FormMessage } from "@reactive-resume/ui/components/form";
-import { Input } from "@reactive-resume/ui/components/input";
-import { authClient } from "@/libs/auth/client";
-import { useAppForm } from "@/libs/tanstack-form";
-
-const formSchema = z.object({
- code: z.string().trim(),
-});
-
-export function VerifyTwoFactorBackupPage() {
- const router = useRouter();
- const navigate = useNavigate();
-
- const form = useAppForm({
- defaultValues: { code: "" },
- validators: { onSubmit: formSchema },
- onSubmit: async ({ value }) => {
- const toastId = toast.loading(t`Verifying backup code...`);
- const formattedCode = `${value.code.slice(0, 5)}-${value.code.slice(5)}`;
-
- const { error } = await authClient.twoFactor.verifyBackupCode({ code: formattedCode });
-
- if (error) {
- toast.error(
- error.message ||
- t({
- comment: "Fallback toast when verifying a backup two-factor authentication code fails",
- message: "Failed to verify your backup code. Please try again.",
- }),
- { id: toastId },
- );
- return;
- }
-
- toast.dismiss(toastId);
- await router.invalidate();
- void navigate({ to: "/dashboard", replace: true });
- },
- });
-
- return (
- <>
- <div className="space-y-1 text-center">
- <h1 className="font-semibold text-2xl tracking-tight">
- <Trans>Verify with a Backup Code</Trans>
- </h1>
- <div className="text-muted-foreground">
- <Trans>Enter one of your saved backup codes to access your account</Trans>
- </div>
- </div>
-
- <form
- className="grid gap-6"
- onSubmit={(event) => {
- event.preventDefault();
- event.stopPropagation();
- void form.handleSubmit();
- }}
- >
- <form.Field name="code">
- {(field) => (
- <FormItem
- className="justify-self-center"
- hasError={field.state.meta.isTouched && field.state.meta.errors.length > 0}
- >
- <FormControl
- render={
- <Input
- maxLength={10}
- className="max-w-xs"
- name={field.name}
- value={field.state.value}
- onBlur={field.handleBlur}
- onChange={(event) => field.handleChange(event.target.value)}
- />
- }
- />
- <FormMessage errors={field.state.meta.errors} />
- </FormItem>
- )}
- </form.Field>
-
- <div className="flex gap-x-2">
- <Button
- variant="outline"
- className="flex-1"
- nativeButton={false}
- render={
- <Link to="/auth/verify-2fa">
- <ArrowLeftIcon />
- <Trans comment="Secondary navigation button on backup-code verification screen">Go Back</Trans>
- </Link>
- }
- />
-
- <Button type="submit" className="flex-1">
- <CheckIcon />
- <Trans comment="Primary action button to submit backup code">Verify</Trans>
- </Button>
- </div>
- </form>
- </>
- );
-}
diff --git a/apps/web/src/features/auth/pages/verify-2fa.tsx b/apps/web/src/features/auth/pages/verify-2fa.tsx
index be96688a6..dcf9a5ea7 100644
--- a/apps/web/src/features/auth/pages/verify-2fa.tsx
+++ b/apps/web/src/features/auth/pages/verify-2fa.tsx
@@ -10,31 +10,44 @@ import { Input } from "@reactive-resume/ui/components/input";
import { authClient } from "@/libs/auth/client";
import { useAppForm } from "@/libs/tanstack-form";
-const formSchema = z.object({
+const totpSchema = z.object({
code: z.string().length(6, "Code must be 6 digits"),
});
-export function VerifyTwoFactorPage() {
+const backupCodeSchema = z.object({
+ code: z.string().trim(),
+});
+
+type TwoFactorVerificationPageProps = {
+ backupCode?: boolean;
+};
+
+function TwoFactorVerificationPage({ backupCode = false }: TwoFactorVerificationPageProps) {
const router = useRouter();
const navigate = useNavigate();
const form = useAppForm({
defaultValues: { code: "" },
- validators: { onSubmit: formSchema },
+ validators: { onSubmit: backupCode ? backupCodeSchema : totpSchema },
onSubmit: async ({ value }) => {
- const toastId = toast.loading(t`Verifying code...`);
-
- const { error } = await authClient.twoFactor.verifyTotp({
- code: value.code,
- });
+ const toastId = toast.loading(backupCode ? t`Verifying backup code...` : t`Verifying code...`);
+ const code = backupCode ? `${value.code.slice(0, 5)}-${value.code.slice(5)}` : value.code;
+ const { error } = backupCode
+ ? await authClient.twoFactor.verifyBackupCode({ code })
+ : await authClient.twoFactor.verifyTotp({ code });
if (error) {
toast.error(
error.message ||
- t({
- comment: "Fallback toast when verifying a two-factor authentication code fails",
- message: "Failed to verify your code. Please try again.",
- }),
+ (backupCode
+ ? t({
+ comment: "Fallback toast when verifying a backup two-factor authentication code fails",
+ message: "Failed to verify your backup code. Please try again.",
+ })
+ : t({
+ comment: "Fallback toast when verifying a two-factor authentication code fails",
+ message: "Failed to verify your code. Please try again.",
+ })),
{ id: toastId },
);
return;
@@ -50,10 +63,14 @@ export function VerifyTwoFactorPage() {
<>
<div className="space-y-1 text-center">
<h1 className="font-semibold text-2xl tracking-tight">
- <Trans>Two-Factor Authentication</Trans>
+ {backupCode ? <Trans>Verify with a Backup Code</Trans> : <Trans>Two-Factor Authentication</Trans>}
</h1>
<div className="text-muted-foreground">
- <Trans>Enter the verification code from your authenticator app</Trans>
+ {backupCode ? (
+ <Trans>Enter one of your saved backup codes to access your account</Trans>
+ ) : (
+ <Trans>Enter the verification code from your authenticator app</Trans>
+ )}
</div>
</div>
@@ -74,8 +91,8 @@ export function VerifyTwoFactorPage() {
<FormControl
render={
<Input
- type="number"
- maxLength={6}
+ type={backupCode ? "text" : "number"}
+ maxLength={backupCode ? 10 : 6}
className="max-w-xs"
name={field.name}
value={field.state.value}
@@ -95,32 +112,50 @@ export function VerifyTwoFactorPage() {
className="flex-1"
nativeButton={false}
render={
- <Link to="/auth/login">
+ <Link to={backupCode ? "/auth/verify-2fa" : "/auth/login"}>
<ArrowLeftIcon />
- <Trans comment="Secondary navigation button on 2FA verification screen">Back to Login</Trans>
+ {backupCode ? (
+ <Trans comment="Secondary navigation button on backup-code verification screen">Go Back</Trans>
+ ) : (
+ <Trans comment="Secondary navigation button on 2FA verification screen">Back to Login</Trans>
+ )}
</Link>
}
/>
<Button type="submit" className="flex-1">
<CheckIcon />
- <Trans comment="Primary action button to submit 2FA code">Verify</Trans>
+ {backupCode ? (
+ <Trans comment="Primary action button to submit backup code">Verify</Trans>
+ ) : (
+ <Trans comment="Primary action button to submit 2FA code">Verify</Trans>
+ )}
</Button>
</div>
</form>
- <Button
- variant="link"
- nativeButton={false}
- className="h-auto justify-self-center p-0 text-sm"
- render={
- <Link to="/auth/verify-2fa-backup">
- <Trans comment="Link to backup-code verification flow when authenticator app is unavailable">
- Lost access to your authenticator?
- </Trans>
- </Link>
- }
- />
+ {!backupCode && (
+ <Button
+ variant="link"
+ nativeButton={false}
+ className="h-auto justify-self-center p-0 text-sm"
+ render={
+ <Link to="/auth/verify-2fa-backup">
+ <Trans comment="Link to backup-code verification flow when authenticator app is unavailable">
+ Lost access to your authenticator?
+ </Trans>
+ </Link>
+ }
+ />
+ )}
</>
);
}
+
+export function VerifyTwoFactorPage() {
+ return <TwoFactorVerificationPage />;
+}
+
+export function VerifyTwoFactorBackupPage() {
+ return <TwoFactorVerificationPage backupCode />;
+}
diff --git a/apps/web/src/features/command-palette/pages/preferences/language.tsx b/apps/web/src/features/command-palette/pages/preferences/language.tsx
index 8724cc6c5..34720f0c6 100644
--- a/apps/web/src/features/command-palette/pages/preferences/language.tsx
+++ b/apps/web/src/features/command-palette/pages/preferences/language.tsx
@@ -1,23 +1,16 @@
import { useLingui } from "@lingui/react";
import { Trans } from "@lingui/react/macro";
import { CommandItem } from "@reactive-resume/ui/components/command";
-import { isLocale, loadLocale, localeMap, setLocaleCookie } from "@/libs/locale";
+import { changeLocale, localeMap } from "@/libs/locale";
import { BaseCommandGroup } from "../base";
-const handleLocaleChange = async (value: string) => {
- if (!value || !isLocale(value)) return;
- setLocaleCookie(value);
- await loadLocale(value);
- window.location.reload();
-};
-
export function LanguageCommandPage() {
const { i18n } = useLingui();
return (
<BaseCommandGroup page="language" heading={<Trans>Language</Trans>}>
{Object.entries(localeMap).map(([value, label]) => (
- <CommandItem key={value} onSelect={() => handleLocaleChange(value)}>
+ <CommandItem key={value} onSelect={() => changeLocale(value)}>
<span className="font-mono text-muted-foreground text-xs">{value}</span>
{i18n.t(label)}
</CommandItem>
diff --git a/apps/web/src/features/locale/combobox.tsx b/apps/web/src/features/locale/combobox.tsx
index 16eac5248..42cda3191 100644
--- a/apps/web/src/features/locale/combobox.tsx
+++ b/apps/web/src/features/locale/combobox.tsx
@@ -1,18 +1,11 @@
import type { SingleComboboxProps } from "@/components/ui/combobox";
import { useLingui } from "@lingui/react";
import { Combobox } from "@/components/ui/combobox";
-import { isLocale, loadLocale, setLocaleCookie } from "@/libs/locale";
+import { changeLocale } from "@/libs/locale";
import { getLocaleOptions } from "./locale-options";
type Props = Omit<SingleComboboxProps, "options" | "value" | "onValueChange">;
-const onLocaleChange = async (value: string | null) => {
- if (!value || !isLocale(value)) return;
- setLocaleCookie(value);
- await loadLocale(value);
- window.location.reload();
-};
-
export function LocaleCombobox(props: Props) {
const { i18n } = useLingui();
@@ -21,7 +14,7 @@ export function LocaleCombobox(props: Props) {
showClear={false}
defaultValue={i18n.locale}
options={getLocaleOptions()}
- onValueChange={onLocaleChange}
+ onValueChange={changeLocale}
{...props}
/>
);
diff --git a/apps/web/src/features/resume/builder/draft.ts b/apps/web/src/features/resume/builder/draft.ts
index 542735619..359d3fa4c 100644
--- a/apps/web/src/features/resume/builder/draft.ts
+++ b/apps/web/src/features/resume/builder/draft.ts
@@ -106,10 +106,6 @@ function cloneResume(resume: Resume): Resume {
return { ...resume, data: cloneResumeData(resume.data) };
}
-function createResumeUpdateEventIterator(resumeId: string) {
- return streamClient.resume.updates.subscribe({ id: resumeId });
-}
-
export function isEditableElementFocused(): boolean {
if (typeof document === "undefined") return false;
const element = document.activeElement as HTMLElement | null;
@@ -521,10 +517,6 @@ export const usePreviewPausedStore = create<PreviewPausedStore>()((set) => ({
setPaused: (paused) => set({ paused }),
}));
-function useResetResumeStore() {
- return useResumeStore((state) => state.reset);
-}
-
export function usePatchResume() {
return useResumeStore((state) => state.patchResume);
}
@@ -587,7 +579,7 @@ export function useResumeUpdateSubscription({ resumeId, onUpdate, onError }: Res
let didCancel = false;
let retryTimer: number | undefined;
- const cancel = consumeEventIterator(createResumeUpdateEventIterator(resumeId), {
+ const cancel = consumeEventIterator(streamClient.resume.updates.subscribe({ id: resumeId }), {
onEvent: async (event) => {
try {
await onUpdate((event ?? { mutation: "sync" }) as ResumeUpdateEvent);
@@ -664,7 +656,7 @@ export function useBuilderResumeUpdateSubscription() {
export function useResumeCleanup() {
const params = useParams({ strict: false }) as { resumeId?: string };
const resumeId = params.resumeId;
- const reset = useResetResumeStore();
+ const reset = useResumeStore((state) => state.reset);
useEffect(() => {
if (!resumeId) return;
diff --git a/apps/web/src/features/resume/preview/pdf-thumbnail.ts b/apps/web/src/features/resume/preview/pdf-thumbnail.ts
index 969a0780c..d658ace4e 100644
--- a/apps/web/src/features/resume/preview/pdf-thumbnail.ts
+++ b/apps/web/src/features/resume/preview/pdf-thumbnail.ts
@@ -1,8 +1,8 @@
import type { PreviewPageSize } from "./preview.shared.utils";
import { getResumeThumbnailRenderSize, RESUME_THUMBNAIL_TARGET_WIDTH } from "./resume-thumbnail.shared";
-const canvasToBlob = async (canvas: HTMLCanvasElement) => {
- return await new Promise<Blob>((resolve, reject) => {
+const canvasToBlob = (canvas: HTMLCanvasElement) =>
+ new Promise<Blob>((resolve, reject) => {
canvas.toBlob((blob) => {
if (!blob) {
reject(new Error("Failed to create resume thumbnail image."));
@@ -12,7 +12,6 @@ const canvasToBlob = async (canvas: HTMLCanvasElement) => {
resolve(blob);
}, "image/png");
});
-};
export const createPdfFirstPageImageUrl = async (file: Blob) => {
const { AnnotationMode, GlobalWorkerOptions, getDocument } = await import("pdfjs-dist/legacy/build/pdf.mjs");
diff --git a/apps/web/src/features/settings/authentication/components/action-button.tsx b/apps/web/src/features/settings/authentication/components/action-button.tsx
new file mode 100644
index 000000000..78eb2a04b
--- /dev/null
+++ b/apps/web/src/features/settings/authentication/components/action-button.tsx
@@ -0,0 +1,19 @@
+import type { ReactNode } from "react";
+import { m } from "motion/react";
+
+type ActionButtonProps = {
+ children: ReactNode;
+};
+
+export function ActionButton({ children }: ActionButtonProps) {
+ return (
+ <m.div
+ className="will-change-transform"
+ whileHover={{ y: -1, scale: 1.01 }}
+ whileTap={{ scale: 0.99 }}
+ transition={{ duration: 0.14, ease: "easeOut" }}
+ >
+ {children}
+ </m.div>
+ );
+}
diff --git a/apps/web/src/features/settings/authentication/components/passkeys.tsx b/apps/web/src/features/settings/authentication/components/passkeys.tsx
index eea2d4d05..4eaa73a17 100644
--- a/apps/web/src/features/settings/authentication/components/passkeys.tsx
+++ b/apps/web/src/features/settings/authentication/components/passkeys.tsx
@@ -21,9 +21,7 @@ export function PasskeysSection() {
});
const registerPasskeyMutation = useMutation({
- mutationFn: async () => {
- return await authClient.passkey.addPasskey();
- },
+ mutationFn: () => authClient.passkey.addPasskey(),
onSuccess: async ({ data, error }) => {
if (error) {
toast.error(
@@ -77,9 +75,7 @@ export function PasskeysSection() {
});
const deletePasskeyMutation = useMutation({
- mutationFn: async (id: string) => {
- return await authClient.passkey.deletePasskey({ id });
- },
+ mutationFn: (id: string) => authClient.passkey.deletePasskey({ id }),
onSuccess: async ({ error }) => {
if (error) {
toast.error(
diff --git a/apps/web/src/features/settings/authentication/components/password.tsx b/apps/web/src/features/settings/authentication/components/password.tsx
index fc6628011..80f0919be 100644
--- a/apps/web/src/features/settings/authentication/components/password.tsx
+++ b/apps/web/src/features/settings/authentication/components/password.tsx
@@ -1,41 +1,18 @@
import { Trans } from "@lingui/react/macro";
import { PasswordIcon, PencilSimpleLineIcon } from "@phosphor-icons/react";
-import { Link, useNavigate } from "@tanstack/react-router";
+import { Link } from "@tanstack/react-router";
import { m } from "motion/react";
-import { useCallback } from "react";
import { Button } from "@reactive-resume/ui/components/button";
import { useDialogStore } from "@/dialogs/store";
+import { ActionButton } from "./action-button";
import { useAuthAccounts } from "./hooks";
-// ponytail: m.div wrapper is identical for both branches — extracted, match(boolean) removed
-function ActionButton({ children }: { children: React.ReactNode }) {
- return (
- <m.div
- className="will-change-transform"
- whileHover={{ y: -1, scale: 1.01 }}
- whileTap={{ scale: 0.99 }}
- transition={{ duration: 0.14, ease: "easeOut" }}
- >
- {children}
- </m.div>
- );
-}
-
export function PasswordSection() {
- const navigate = useNavigate();
const { openDialog } = useDialogStore();
const { hasAccount } = useAuthAccounts();
const hasPassword = hasAccount("credential");
- const handleUpdatePassword = useCallback(() => {
- if (hasPassword) {
- openDialog("auth.change-password", undefined);
- } else {
- void navigate({ to: "/auth/forgot-password" });
- }
- }, [hasPassword, navigate, openDialog]);
-
return (
<m.div
initial={{ y: -20 }}
@@ -50,7 +27,7 @@ export function PasswordSection() {
<ActionButton>
{hasPassword ? (
- <Button variant="outline" onClick={handleUpdatePassword}>
+ <Button variant="outline" onClick={() => openDialog("auth.change-password", undefined)}>
<PencilSimpleLineIcon />
<Trans>Update Password</Trans>
</Button>
diff --git a/apps/web/src/features/settings/authentication/components/social-provider.tsx b/apps/web/src/features/settings/authentication/components/social-provider.tsx
index bd45bbacf..c54669d43 100644
--- a/apps/web/src/features/settings/authentication/components/social-provider.tsx
+++ b/apps/web/src/features/settings/authentication/components/social-provider.tsx
@@ -2,25 +2,11 @@ import type { AuthProvider } from "@reactive-resume/auth/types";
import { Trans } from "@lingui/react/macro";
import { LinkBreakIcon, LinkIcon } from "@phosphor-icons/react";
import { m } from "motion/react";
-import { useCallback } from "react";
import { Button } from "@reactive-resume/ui/components/button";
import { Separator } from "@reactive-resume/ui/components/separator";
+import { ActionButton } from "./action-button";
import { getProviderIcon, getProviderName, useAuthAccounts, useAuthProviderActions } from "./hooks";
-// ponytail: shared hover/tap wrapper — identical in both branches, match(boolean) removed
-function ActionButton({ children }: { children: React.ReactNode }) {
- return (
- <m.div
- className="will-change-transform"
- whileHover={{ y: -1, scale: 1.01 }}
- whileTap={{ scale: 0.99 }}
- transition={{ duration: 0.14, ease: "easeOut" }}
- >
- {children}
- </m.div>
- );
-}
-
type SocialProviderSectionProps = {
provider: AuthProvider;
name?: string;
@@ -37,15 +23,6 @@ export function SocialProviderSection({ provider, name, animationDelay = 0 }: So
const account = getAccountByProviderId(provider);
const isConnected = hasAccount(provider);
- const handleLink = useCallback(async () => {
- await link(provider);
- }, [link, provider]);
-
- const handleUnlink = useCallback(async () => {
- if (!account?.accountId) return;
- await unlink(provider, account.accountId);
- }, [account, unlink, provider]);
-
return (
<m.div
className="will-change-[transform,opacity]"
@@ -63,14 +40,19 @@ export function SocialProviderSection({ provider, name, animationDelay = 0 }: So
<ActionButton>
{isConnected ? (
- <Button variant="outline" onClick={handleUnlink}>
+ <Button
+ variant="outline"
+ onClick={() => {
+ if (account?.accountId) void unlink(provider, account.accountId);
+ }}
+ >
<LinkBreakIcon />
<Trans comment="Authentication settings action to unlink a connected social login provider">
Disconnect
</Trans>
</Button>
) : (
- <Button variant="outline" onClick={handleLink}>
+ <Button variant="outline" onClick={() => void link(provider)}>
<LinkIcon />
<Trans comment="Authentication settings action to link a social login provider">Connect</Trans>
</Button>
diff --git a/apps/web/src/features/settings/authentication/components/two-factor.tsx b/apps/web/src/features/settings/authentication/components/two-factor.tsx
index a977586a6..e05f35241 100644
--- a/apps/web/src/features/settings/authentication/components/two-factor.tsx
+++ b/apps/web/src/features/settings/authentication/components/two-factor.tsx
@@ -1,27 +1,13 @@
import { Trans } from "@lingui/react/macro";
import { KeyIcon, LockOpenIcon, ToggleLeftIcon, ToggleRightIcon } from "@phosphor-icons/react";
import { m } from "motion/react";
-import { useCallback } from "react";
import { Button } from "@reactive-resume/ui/components/button";
import { Separator } from "@reactive-resume/ui/components/separator";
import { useDialogStore } from "@/dialogs/store";
import { authClient } from "@/libs/auth/client";
+import { ActionButton } from "./action-button";
import { useAuthAccounts } from "./hooks";
-// ponytail: shared hover/tap wrapper — identical in both branches, match(boolean) removed
-function ActionButton({ children }: { children: React.ReactNode }) {
- return (
- <m.div
- className="will-change-transform"
- whileHover={{ y: -1, scale: 1.01 }}
- whileTap={{ scale: 0.99 }}
- transition={{ duration: 0.14, ease: "easeOut" }}
- >
- {children}
- </m.div>
- );
-}
-
export function TwoFactorSection() {
const { openDialog } = useDialogStore();
const { hasAccount } = useAuthAccounts();
@@ -30,14 +16,6 @@ export function TwoFactorSection() {
const hasPassword = hasAccount("credential");
const hasTwoFactor = session?.user.twoFactorEnabled ?? false;
- const handleTwoFactorAction = useCallback(() => {
- if (hasTwoFactor) {
- openDialog("auth.two-factor.disable", undefined);
- } else {
- openDialog("auth.two-factor.enable", undefined);
- }
- }, [hasTwoFactor, openDialog]);
-
if (!hasPassword) return null;
return (
@@ -56,7 +34,10 @@ export function TwoFactorSection() {
</h2>
<ActionButton>
- <Button variant="outline" onClick={handleTwoFactorAction}>
+ <Button
+ variant="outline"
+ onClick={() => openDialog(hasTwoFactor ? "auth.two-factor.disable" : "auth.two-factor.enable", undefined)}
+ >
{hasTwoFactor ? (
<>
<ToggleLeftIcon />
diff --git a/apps/web/src/features/settings/integrations/hooks/use-has-usable-ai-provider.ts b/apps/web/src/features/settings/integrations/hooks/use-has-usable-ai-provider.ts
index 557d4a31c..5e1c6cb06 100644
--- a/apps/web/src/features/settings/integrations/hooks/use-has-usable-ai-provider.ts
+++ b/apps/web/src/features/settings/integrations/hooks/use-has-usable-ai-provider.ts
@@ -6,12 +6,13 @@ import { orpc } from "@/libs/orpc/client";
* Replaces the predicate that was duplicated across the import dialog, agent setup, and AI settings.
*/
export function useHasUsableAiProvider() {
- const { data: providers, isLoading } = useQuery(orpc.aiProviders.list.queryOptions());
+ const { data: providers, isLoading, error } = useQuery(orpc.aiProviders.list.queryOptions());
const usableProviders = (providers ?? []).filter((provider) => provider.enabled && provider.testStatus === "success");
return {
+ error,
hasUsableProvider: usableProviders.length > 0,
- usableProviders,
isLoading,
+ usableProviders,
};
}
diff --git a/apps/web/src/features/theme/combobox.tsx b/apps/web/src/features/theme/combobox.tsx
index 47700c2be..5effb50dc 100644
--- a/apps/web/src/features/theme/combobox.tsx
+++ b/apps/web/src/features/theme/combobox.tsx
@@ -18,7 +18,7 @@ export function ThemeCombobox(props: Props) {
keywords: [i18n.t(label)],
}));
- const onThemeChange = async (value: string | null) => {
+ const onThemeChange = (value: string | null) => {
if (!value || !isTheme(value)) return;
setTheme(value);
void router.invalidate();
diff --git a/apps/web/src/features/user/dropdown-menu.tsx b/apps/web/src/features/user/dropdown-menu.tsx
index e3c0ad06b..a89b56f25 100644
--- a/apps/web/src/features/user/dropdown-menu.tsx
+++ b/apps/web/src/features/user/dropdown-menu.tsx
@@ -22,20 +22,13 @@ import {
import { useTheme } from "@/features/theme/provider";
import { authClient } from "@/libs/auth/client";
import { getReadableErrorMessage } from "@/libs/error-message";
-import { isLocale, loadLocale, localeMap, setLocaleCookie } from "@/libs/locale";
+import { changeLocale, localeMap } from "@/libs/locale";
import { isTheme } from "@/libs/theme";
type Props = {
children: ({ session }: { session: AuthSession }) => React.ComponentProps<typeof DropdownMenuTrigger>["render"];
};
-const handleLocaleChange = async (value: string) => {
- if (!isLocale(value)) return;
- setLocaleCookie(value);
- await loadLocale(value);
- window.location.reload();
-};
-
export function UserDropdownMenu({ children }: Props) {
const isClient = useIsClient();
const router = useRouter();
@@ -88,7 +81,7 @@ export function UserDropdownMenu({ children }: Props) {
<Trans comment="Menu item that opens language selection submenu">Language</Trans>
</DropdownMenuSubTrigger>
<DropdownMenuSubContent className="max-h-[400px] overflow-y-auto">
- <DropdownMenuRadioGroup value={i18n.locale} onValueChange={handleLocaleChange}>
+ <DropdownMenuRadioGroup value={i18n.locale} onValueChange={changeLocale}>
{Object.entries(localeMap).map(([value, label]) => (
<DropdownMenuRadioItem key={value} value={value}>
{i18n.t(label)}
diff --git a/apps/web/src/hooks/use-confirm.test.tsx b/apps/web/src/hooks/use-confirm.test.tsx
index 4701fdfe6..06a9a8042 100644
--- a/apps/web/src/hooks/use-confirm.test.tsx
+++ b/apps/web/src/hooks/use-confirm.test.tsx
@@ -24,7 +24,7 @@ describe("useConfirm", () => {
const { result } = renderHook(() => useConfirm(), { wrapper });
let promise!: Promise<boolean>;
- await act(async () => {
+ await act(() => {
promise = result.current("Are you sure?");
});
expect(promise).toBeInstanceOf(Promise);
@@ -34,7 +34,7 @@ describe("useConfirm", () => {
const { result } = renderHook(() => useConfirm(), { wrapper });
let promise!: Promise<boolean>;
- await act(async () => {
+ await act(() => {
promise = result.current("Heading");
});
@@ -44,7 +44,7 @@ describe("useConfirm", () => {
const buttons = Array.from(document.body.querySelectorAll<HTMLButtonElement>("button"));
const cancel = buttons.find((b) => /cancel/i.test(b.textContent ?? ""));
- await act(async () => {
+ await act(() => {
(cancelBtn as HTMLButtonElement | null)?.click() ?? cancel?.click();
});
@@ -55,14 +55,14 @@ describe("useConfirm", () => {
const { result } = renderHook(() => useConfirm(), { wrapper });
let promise!: Promise<boolean>;
- await act(async () => {
+ await act(() => {
promise = result.current("Heading", { confirmText: "Yes" });
});
const buttons = Array.from(document.body.querySelectorAll<HTMLButtonElement>("button"));
const yes = buttons.find((b) => /yes/i.test(b.textContent ?? ""));
- await act(async () => {
+ await act(() => {
yes?.click();
});
diff --git a/apps/web/src/hooks/use-confirm.tsx b/apps/web/src/hooks/use-confirm.tsx
index a21dbbe7c..2059443b9 100644
--- a/apps/web/src/hooks/use-confirm.tsx
+++ b/apps/web/src/hooks/use-confirm.tsx
@@ -43,7 +43,7 @@ export function ConfirmDialogProvider({ children }: ConfirmDialogProviderProps)
cancelText: undefined,
});
- const confirm = React.useCallback(async (title: string, options?: ConfirmOptions): Promise<boolean> => {
+ const confirm = React.useCallback((title: string, options?: ConfirmOptions): Promise<boolean> => {
return new Promise<boolean>((resolve) => {
setState({
open: true,
diff --git a/apps/web/src/hooks/use-form-blocker.tsx b/apps/web/src/hooks/use-form-blocker.tsx
index 7b4babc71..5aa2fd0ee 100644
--- a/apps/web/src/hooks/use-form-blocker.tsx
+++ b/apps/web/src/hooks/use-form-blocker.tsx
@@ -48,7 +48,7 @@ export function useFormBlocker<TStore extends BlockableFormStore>(
return isDirty && !isSubmitting;
}, [isDirty, isSubmitting]);
- const confirmClose = useCallback(async () => {
+ const confirmClose = useCallback(() => {
if (!shouldBlock()) return true;
return confirm(t`Are you sure you want to close this dialog?`, {
diff --git a/apps/web/src/hooks/use-prompt.test.tsx b/apps/web/src/hooks/use-prompt.test.tsx
index 3ba5a55f1..da7ab3ddd 100644
--- a/apps/web/src/hooks/use-prompt.test.tsx
+++ b/apps/web/src/hooks/use-prompt.test.tsx
@@ -34,11 +34,11 @@ describe("usePrompt", () => {
const { result } = renderHook(() => usePrompt(), { wrapper });
let promise!: Promise<string | null>;
- await act(async () => {
+ await act(() => {
promise = result.current("Name?");
});
- await act(async () => {
+ await act(() => {
clickButton(/cancel/i);
});
@@ -49,11 +49,11 @@ describe("usePrompt", () => {
const { result } = renderHook(() => usePrompt(), { wrapper });
let promise!: Promise<string | null>;
- await act(async () => {
+ await act(() => {
promise = result.current("Name?", { defaultValue: "Initial" });
});
- await act(async () => {
+ await act(() => {
clickButton(/confirm/i);
});
@@ -64,7 +64,7 @@ describe("usePrompt", () => {
const { result } = renderHook(() => usePrompt(), { wrapper });
let promise!: Promise<string | null>;
- await act(async () => {
+ await act(() => {
promise = result.current("Heading", { defaultValue: "preset" });
});
@@ -72,7 +72,7 @@ describe("usePrompt", () => {
const input = document.body.querySelector("input") as HTMLInputElement | null;
expect(input?.value).toBe("preset");
- await act(async () => {
+ await act(() => {
clickButton(/confirm/i);
});
diff --git a/apps/web/src/hooks/use-prompt.tsx b/apps/web/src/hooks/use-prompt.tsx
index c4c6a02e2..26dedb323 100644
--- a/apps/web/src/hooks/use-prompt.tsx
+++ b/apps/web/src/hooks/use-prompt.tsx
@@ -67,7 +67,7 @@ export function PromptDialogProvider({ children }: PromptDialogProviderProps) {
return () => window.clearTimeout(timeoutId);
}, [state.open]);
- const prompt = React.useCallback(async (title: string, options?: PromptOptions): Promise<string | null> => {
+ const prompt = React.useCallback((title: string, options?: PromptOptions): Promise<string | null> => {
return new Promise<string | null>((resolve) => {
setState({
open: true,
diff --git a/apps/web/src/libs/auth/client.ts b/apps/web/src/libs/auth/client.ts
index 90326e5c6..7f6c69d22 100644
--- a/apps/web/src/libs/auth/client.ts
+++ b/apps/web/src/libs/auth/client.ts
@@ -13,28 +13,24 @@ import {
} from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";
-const getAuthClient = () => {
- return createAuthClient({
- plugins: [
- dashClient(),
- adminClient(),
- apiKeyClient(),
- passkeyClient(),
- usernameClient(),
- twoFactorClient({
- onTwoFactorRedirect() {
- // Redirect to 2FA verification page
- if (typeof window !== "undefined") {
- window.location.href = "/auth/verify-2fa";
- }
- },
- }),
- genericOAuthClient(),
- oauthProviderClient(),
- oauthProviderResourceClient(),
- inferAdditionalFields<typeof auth>(),
- ],
- });
-};
-
-export const authClient = getAuthClient();
+export const authClient = createAuthClient({
+ plugins: [
+ dashClient(),
+ adminClient(),
+ apiKeyClient(),
+ passkeyClient(),
+ usernameClient(),
+ twoFactorClient({
+ onTwoFactorRedirect() {
+ // Redirect to 2FA verification page
+ if (typeof window !== "undefined") {
+ window.location.href = "/auth/verify-2fa";
+ }
+ },
+ }),
+ genericOAuthClient(),
+ oauthProviderClient(),
+ oauthProviderResourceClient(),
+ inferAdditionalFields<typeof auth>(),
+ ],
+});
diff --git a/apps/web/src/libs/locale.test.ts b/apps/web/src/libs/locale.test.ts
index 8dcc9b285..ff31f3b9a 100644
--- a/apps/web/src/libs/locale.test.ts
+++ b/apps/web/src/libs/locale.test.ts
@@ -1,5 +1,14 @@
-import { describe, expect, it } from "vitest";
-import { isLocale, resolveLocale } from "./locale";
+// @vitest-environment happy-dom
+
+import { afterEach, describe, expect, it, vi } from "vitest";
+import Cookies from "js-cookie";
+import { changeLocale, formatRelativeTime, isLocale, resolveLocale } from "./locale";
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.useRealTimers();
+ Cookies.remove("locale");
+});
describe("isLocale", () => {
it("returns true for known locale en-US", () => {
@@ -44,3 +53,31 @@ describe("resolveLocale", () => {
expect(resolveLocale("")).toBe("en-US");
});
});
+
+describe("formatRelativeTime", () => {
+ it("selects the largest matching unit", () => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date("2026-01-02T12:00:00Z"));
+ const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
+
+ expect(formatRelativeTime("2026-01-02T10:00:00Z", formatter)).toBe("2 hours ago");
+ expect(formatRelativeTime("2026-01-02T11:59:45Z", formatter)).toBe("now");
+ });
+
+ it("uses the requested fallback for an invalid date", () => {
+ const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
+
+ expect(formatRelativeTime("invalid", formatter, "")).toBe("");
+ });
+});
+
+describe("changeLocale", () => {
+ it("persists a valid locale and reloads", () => {
+ const reload = vi.spyOn(window.location, "reload").mockImplementation(() => undefined);
+
+ changeLocale("de-DE");
+
+ expect(Cookies.get("locale")).toBe("de-DE");
+ expect(reload).toHaveBeenCalledOnce();
+ });
+});
diff --git a/apps/web/src/libs/locale.ts b/apps/web/src/libs/locale.ts
index 5791bde25..1261cfefe 100644
--- a/apps/web/src/libs/locale.ts
+++ b/apps/web/src/libs/locale.ts
@@ -10,6 +10,14 @@ export { isRTL };
const storageKey = "locale";
const defaultLocale: Locale = "en-US";
const messageLoaders = import.meta.glob<{ messages: Messages }>("../../locales/*.po");
+const relativeTimeDivisions: Array<{ amount: number; unit: Intl.RelativeTimeFormatUnit }> = [
+ { amount: 31_536_000_000, unit: "year" },
+ { amount: 2_592_000_000, unit: "month" },
+ { amount: 604_800_000, unit: "week" },
+ { amount: 86_400_000, unit: "day" },
+ { amount: 3_600_000, unit: "hour" },
+ { amount: 60_000, unit: "minute" },
+];
export const localeMap = {
"af-ZA": msg`Afrikaans`,
@@ -77,16 +85,24 @@ export const resolveLocale = (locale: string): Locale => {
return isLocale(locale) ? locale : defaultLocale;
};
+export function formatRelativeTime(value: Date | string, formatter: Intl.RelativeTimeFormat, invalidFallback?: string) {
+ const date = value instanceof Date ? value : new Date(value);
+ const diffMs = date.getTime() - Date.now();
+ if (Number.isNaN(diffMs)) return invalidFallback ?? formatter.format(0, "second");
+
+ const division = relativeTimeDivisions.find((candidate) => Math.abs(diffMs) >= candidate.amount);
+
+ return division
+ ? formatter.format(Math.round(diffMs / division.amount), division.unit)
+ : formatter.format(0, "second");
+}
+
export const getLocale = () => {
const locale = Cookies.get(storageKey);
if (!locale || !isLocale(locale)) return defaultLocale;
return locale;
};
-export const setLocaleCookie = (locale: Locale) => {
- Cookies.set(storageKey, locale);
-};
-
const loadMessages = async (locale: Locale) => {
const load = messageLoaders[`../../locales/${locale}.po`];
@@ -113,3 +129,9 @@ export const loadLocale = async (locale: string) => {
const { locale: resolvedLocale, messages } = await getLocaleMessages(locale);
i18n.loadAndActivate({ locale: resolvedLocale, messages });
};
+
+export const changeLocale = (value: string | null) => {
+ if (!value || !isLocale(value)) return;
+ Cookies.set(storageKey, value);
+ window.location.reload();
+};
diff --git a/apps/web/src/libs/orpc/client.ts b/apps/web/src/libs/orpc/client.ts
index c1a2a030a..22d294090 100644
--- a/apps/web/src/libs/orpc/client.ts
+++ b/apps/web/src/libs/orpc/client.ts
@@ -10,8 +10,8 @@ const getRpcUrl = () => {
return `${window.location.origin}/api/rpc`;
};
-const createRpcClient = (): RouterClient<typeof router> => {
- const link = new RPCLink({
+export const client: RouterClient<typeof router> = createORPCClient(
+ new RPCLink({
url: getRpcUrl(),
fetch: (request, init) => fetch(request, { ...init, credentials: "include" }),
plugins: [
@@ -26,15 +26,11 @@ const createRpcClient = (): RouterClient<typeof router> => {
console.warn("[oRPC client]", error);
}),
],
- });
+ }),
+);
- return createORPCClient(link);
-};
-
-export const client = createRpcClient();
-
-const createStreamClient = (): RouterClient<typeof router> => {
- const link = new RPCLink({
+export const streamClient: RouterClient<typeof router> = createORPCClient(
+ new RPCLink({
url: getRpcUrl(),
fetch: (request, init) => fetch(request, { ...init, credentials: "include" }),
interceptors: [
@@ -43,12 +39,8 @@ const createStreamClient = (): RouterClient<typeof router> => {
console.warn("[oRPC stream client]", error);
}),
],
- });
-
- return createORPCClient(link);
-};
-
-export const streamClient = createStreamClient();
+ }),
+);
export const orpc = createTanstackQueryUtils(client);
diff --git a/apps/web/src/libs/resume/section-title-locale.ts b/apps/web/src/libs/resume/section-title-locale.ts
index a27b2b523..0c999b1dc 100644
--- a/apps/web/src/libs/resume/section-title-locale.ts
+++ b/apps/web/src/libs/resume/section-title-locale.ts
@@ -6,7 +6,7 @@ import { createSectionTitleResolver } from "./section-title";
const resolverCache = new Map<string, Promise<SectionTitleResolver>>();
-export const createSectionTitleResolverForLocale = async (localeParam: string) => {
+export const createSectionTitleResolverForLocale = (localeParam: string) => {
const requestedLocale = resolveLocale(localeParam);
const cachedResolver = resolverCache.get(requestedLocale);
diff --git a/apps/web/src/libs/tanstack-form.test.tsx b/apps/web/src/libs/tanstack-form.test.tsx
new file mode 100644
index 000000000..8219f260a
--- /dev/null
+++ b/apps/web/src/libs/tanstack-form.test.tsx
@@ -0,0 +1,84 @@
+// @vitest-environment happy-dom
+
+import type { Website } from "@reactive-resume/schema/resume/data";
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeAll, describe, expect, it, vi } from "vitest";
+import { i18n } from "@lingui/core";
+import { I18nProvider } from "@lingui/react";
+import { useAppForm } from "./tanstack-form";
+
+vi.mock("@/components/input/url-input", () => ({
+ URLInput: ({
+ value,
+ onChange,
+ hideLabelButton,
+ }: {
+ value: Website;
+ onChange: (value: Website) => void;
+ hideLabelButton?: boolean;
+ }) => (
+ <input
+ aria-label="Website value"
+ data-hide-label-button={hideLabelButton}
+ value={value.url}
+ onChange={(event) => onChange({ ...value, url: event.target.value })}
+ />
+ ),
+}));
+
+vi.mock("@/components/input/rich-input", () => ({
+ RichInput: ({ value, onChange }: { value: string; onChange: (value: string) => void }) => (
+ <textarea aria-label="Description value" value={value} onChange={(event) => onChange(event.target.value)} />
+ ),
+}));
+
+beforeAll(() => {
+ i18n.loadAndActivate({ locale: "en", messages: {} });
+});
+
+function TestForm() {
+ const form = useAppForm({
+ defaultValues: {
+ description: "Initial description",
+ website: { url: "https://example.com", label: "Example", inlineLink: false },
+ },
+ });
+
+ return (
+ <I18nProvider i18n={i18n}>
+ <form.AppField
+ name="website"
+ validators={{ onChange: ({ value }) => (value.url ? undefined : "Website is required") }}
+ >
+ {(field) => <field.WebsiteField label="Website" hideLabelButton formItemClassName="website-field" />}
+ </form.AppField>
+
+ <form.AppField
+ name="description"
+ validators={{ onChange: ({ value }) => (value ? undefined : "Description is required") }}
+ >
+ {(field) => <field.RichTextField label="Description" formItemClassName="description-field" />}
+ </form.AppField>
+ </I18nProvider>
+ );
+}
+
+describe("registered resume fields", () => {
+ it("preserves labels, layout classes, attributes, values, and errors", async () => {
+ const user = userEvent.setup();
+ const { container } = render(<TestForm />);
+
+ expect(screen.getByText("Website")).toBeInTheDocument();
+ expect(screen.getByText("Description")).toBeInTheDocument();
+ expect(container.querySelector(".website-field")).toBeInTheDocument();
+ expect(container.querySelector(".description-field")).toBeInTheDocument();
+ expect(screen.getByLabelText("Website value")).toHaveAttribute("data-hide-label-button", "true");
+
+ await user.clear(screen.getByLabelText("Website value"));
+ await user.clear(screen.getByLabelText("Description value"));
+
+ expect(screen.getByText("Website is required")).toBeInTheDocument();
+ expect(screen.getByText("Description is required")).toBeInTheDocument();
+ });
+});
diff --git a/apps/web/src/libs/tanstack-form.tsx b/apps/web/src/libs/tanstack-form.tsx
index 18bb9e7c4..81a64af53 100644
--- a/apps/web/src/libs/tanstack-form.tsx
+++ b/apps/web/src/libs/tanstack-form.tsx
@@ -1,8 +1,11 @@
+import type { Website } from "@reactive-resume/schema/resume/data";
import type * as React from "react";
import { createFormHook, createFormHookContexts } from "@tanstack/react-form";
import { FormControl, FormDescription, FormItem, FormLabel, FormMessage } from "@reactive-resume/ui/components/form";
import { Input } from "@reactive-resume/ui/components/input";
import { InputGroupInput } from "@reactive-resume/ui/components/input-group";
+import { RichInput } from "@/components/input/rich-input";
+import { URLInput } from "@/components/input/url-input";
type FieldFrameProps = {
label?: React.ReactNode;
@@ -25,6 +28,17 @@ type NumberFieldProps = FieldFrameProps &
"children" | "defaultValue" | "name" | "onBlur" | "onChange" | "type" | "value"
>;
+type WebsiteFieldProps = {
+ label: React.ReactNode;
+ formItemClassName?: string;
+ hideLabelButton: boolean;
+};
+
+type RichTextFieldProps = {
+ label: React.ReactNode;
+ formItemClassName?: string;
+};
+
const { fieldContext, formContext, useFieldContext } = createFormHookContexts();
function TextField({ label, description, formItemClassName, ...props }: TextFieldProps) {
@@ -103,8 +117,38 @@ function NumberField({ label, description, formItemClassName, ...props }: Number
);
}
+function WebsiteField({ label, formItemClassName, hideLabelButton }: WebsiteFieldProps) {
+ const field = useFieldContext<Website>();
+ const hasError = field.state.meta.isTouched && field.state.meta.errors.length > 0;
+
+ return (
+ <FormItem hasError={hasError} className={formItemClassName}>
+ <FormLabel>{label}</FormLabel>
+ <URLInput
+ value={field.state.value}
+ onChange={(value) => field.handleChange(value)}
+ hideLabelButton={hideLabelButton}
+ />
+ <FormMessage errors={field.state.meta.errors} />
+ </FormItem>
+ );
+}
+
+function RichTextField({ label, formItemClassName }: RichTextFieldProps) {
+ const field = useFieldContext<string>();
+ const hasError = field.state.meta.isTouched && field.state.meta.errors.length > 0;
+
+ return (
+ <FormItem hasError={hasError} className={formItemClassName}>
+ <FormLabel>{label}</FormLabel>
+ <FormControl render={<RichInput value={field.state.value} onChange={(value) => field.handleChange(value)} />} />
+ <FormMessage errors={field.state.meta.errors} />
+ </FormItem>
+ );
+}
+
export const { useAppForm, withForm } = createFormHook({
- fieldComponents: { InputGroupTextField, NumberField, TextField },
+ fieldComponents: { InputGroupTextField, NumberField, RichTextField, TextField, WebsiteField },
fieldContext,
formComponents: {},
formContext,
diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx
index f1efd1108..1f69b36e2 100644
--- a/apps/web/src/routes/__root.tsx
+++ b/apps/web/src/routes/__root.tsx
@@ -16,7 +16,7 @@ import { ReactQueryDevtoolsPanel } from "@tanstack/react-query-devtools";
import { createRootRouteWithContext, HeadContent, Outlet, useRouterState } from "@tanstack/react-router";
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
import { domAnimation, LazyMotion, MotionConfig } from "motion/react";
-import { useEffect, useMemo } from "react";
+import { useEffect } from "react";
import { Toaster } from "@reactive-resume/ui/components/sonner";
import { TooltipProvider } from "@reactive-resume/ui/components/tooltip";
import { BreakpointIndicator } from "@/components/layout/breakpoint-indicator";
@@ -45,6 +45,7 @@ const tagline = "A free and open-source resume builder";
const title = `${appName} — ${tagline}`;
const description =
"Reactive Resume is a free and open-source resume builder that simplifies the process of creating, updating, and sharing your resume.";
+const iconContextValue: IconProps = { size: 16, weight: "regular" };
export const Route = createRootRouteWithContext<RouterContext>()({
component: RootComponent,
@@ -107,8 +108,6 @@ function RootComponent() {
// Suppress the app-wide donation toast inside the builder so it doesn't cover the right-sidebar controls.
const isBuilder = useRouterState({ select: (s) => s.location.pathname.startsWith("/builder") });
- const iconContextValue = useMemo<IconProps>(() => ({ size: 16, weight: "regular" }), []);
-
useEffect(() => {
document.documentElement.lang = locale;
document.documentElement.dir = dir;
diff --git a/apps/web/src/routes/_home/-sections/templates.tsx b/apps/web/src/routes/_home/-sections/templates.tsx
index e8cb8a972..4fa641abd 100644
--- a/apps/web/src/routes/_home/-sections/templates.tsx
+++ b/apps/web/src/routes/_home/-sections/templates.tsx
@@ -1,7 +1,6 @@
import type { TemplateMetadata } from "@/dialogs/resume/template/data";
import { Trans } from "@lingui/react/macro";
import { m } from "motion/react";
-import { useMemo } from "react";
import { templates } from "@/dialogs/resume/template/data";
type TemplateItemProps = {
@@ -75,21 +74,12 @@ const createMarqueeItems = (entries: Array<[string, TemplateMetadata]>, rowId: s
{ id: `${rowId}-${template}-repeat`, metadata },
]);
-export function Templates() {
- // Split templates into two rows and duplicate for seamless infinite scroll
- const { row1, row2 } = useMemo(() => {
- const entries = Object.entries(templates);
- const half = Math.ceil(entries.length / 2);
- const firstHalf = entries.slice(0, half);
- const secondHalf = entries.slice(half);
-
- // Duplicate each row for seamless scrolling
- return {
- row1: createMarqueeItems(firstHalf, "row1"),
- row2: createMarqueeItems(secondHalf, "row2"),
- };
- }, []);
+const templateEntries = Object.entries(templates);
+const halfway = Math.ceil(templateEntries.length / 2);
+const row1 = createMarqueeItems(templateEntries.slice(0, halfway), "row1");
+const row2 = createMarqueeItems(templateEntries.slice(halfway), "row2");
+export function Templates() {
return (
<section id="templates" className="overflow-hidden border-t-0! p-4 md:p-8 xl:py-16">
<m.div
diff --git a/apps/web/src/routes/_home/-sections/testimonials.tsx b/apps/web/src/routes/_home/-sections/testimonials.tsx
index 366fba241..ba2b22824 100644
--- a/apps/web/src/routes/_home/-sections/testimonials.tsx
+++ b/apps/web/src/routes/_home/-sections/testimonials.tsx
@@ -1,7 +1,6 @@
import { Trans } from "@lingui/react/macro";
import { QuotesIcon } from "@phosphor-icons/react";
import { m } from "motion/react";
-import { useMemo } from "react";
const email = "[email protected]";
@@ -70,6 +69,11 @@ type TestimonialColumnData = {
testimonials: string[];
};
+const testimonialColumns: TestimonialColumnData[] = [];
+for (let index = 0; index < testimonials.length; index += 2) {
+ testimonialColumns.push({ id: `column-${index / 2}`, testimonials: testimonials.slice(index, index + 2) });
+}
+
type MarqueeMasonryProps = {
columns: TestimonialColumnData[];
direction: "left" | "right";
@@ -97,16 +101,6 @@ function MarqueeMasonry({ columns, direction, duration = 30 }: MarqueeMasonryPro
}
export function Testimonials() {
- const columns = useMemo(() => {
- const columns: TestimonialColumnData[] = [];
-
- for (let index = 0; index < testimonials.length; index += 2) {
- columns.push({ id: `column-${index / 2}`, testimonials: testimonials.slice(index, index + 2) });
- }
-
- return columns;
- }, []);
-
return (
<section id="testimonials" className="overflow-hidden py-12 md:py-16 xl:py-20">
<m.div
@@ -145,7 +139,7 @@ export function Testimonials() {
{/* Right fade */}
<div className="pointer-events-none absolute inset-e-0 top-0 bottom-0 z-10 w-16 bg-linear-to-l from-background to-transparent sm:w-24 md:w-32 lg:w-48" />
- <MarqueeMasonry columns={columns} direction="left" duration={60} />
+ <MarqueeMasonry columns={testimonialColumns} direction="left" duration={60} />
</div>
</section>
);
diff --git a/apps/web/src/routes/agent/-components/new-thread-setup.tsx b/apps/web/src/routes/agent/-components/new-thread-setup.tsx
index 364a80a65..f56d10916 100644
--- a/apps/web/src/routes/agent/-components/new-thread-setup.tsx
+++ b/apps/web/src/routes/agent/-components/new-thread-setup.tsx
@@ -4,7 +4,7 @@ import { Trans } from "@lingui/react/macro";
import { ArrowRightIcon, ChatCircleDotsIcon, FilePlusIcon, GearSixIcon } from "@phosphor-icons/react";
import { useMutation, useQuery } from "@tanstack/react-query";
import { Link, useNavigate } from "@tanstack/react-router";
-import { useMemo, useState } from "react";
+import { useState } from "react";
import { toast } from "sonner";
import { useIsClient } from "usehooks-ts";
import { Badge } from "@reactive-resume/ui/components/badge";
@@ -12,6 +12,7 @@ import { Button } from "@reactive-resume/ui/components/button";
import { Label } from "@reactive-resume/ui/components/label";
import { Spinner } from "@reactive-resume/ui/components/spinner";
import { Combobox } from "@/components/ui/combobox";
+import { useHasUsableAiProvider } from "@/features/settings/integrations/hooks/use-has-usable-ai-provider";
import { getOrpcErrorMessage } from "@/libs/error-message";
import { orpc } from "@/libs/orpc/client";
@@ -34,20 +35,12 @@ function isAgentConfigError(error: unknown) {
export function NewThreadSetup({ resumeId }: NewThreadSetupProps) {
const isClient = useIsClient();
const navigate = useNavigate();
- const {
- data: providers,
- isLoading: isLoadingProviders,
- error: providersError,
- } = useQuery(orpc.aiProviders.list.queryOptions());
+ const { usableProviders, isLoading: isLoadingProviders, error: providersError } = useHasUsableAiProvider();
const { data: resumes, isLoading: isLoadingResumes } = useQuery(
orpc.resume.list.queryOptions({ input: { sort: "lastUpdatedAt", tags: [] } }),
);
const { mutate: createThread, isPending } = useMutation(orpc.agent.threads.create.mutationOptions());
- const usableProviders = useMemo(
- () => providers?.filter((provider) => provider.enabled && provider.testStatus === "success") ?? [],
- [providers],
- );
const [aiProviderIdOverride, setAiProviderIdOverride] = useState<string | null | undefined>(undefined);
const [sourceResumeIdOverride, setSourceResumeIdOverride] = useState<string | null | undefined>(undefined);
const aiProviderId = aiProviderIdOverride ?? usableProviders[0]?.id ?? null;
diff --git a/apps/web/src/routes/agent/-components/thread-sidebar.tsx b/apps/web/src/routes/agent/-components/thread-sidebar.tsx
index b4f4bf6b2..e9703fcac 100644
--- a/apps/web/src/routes/agent/-components/thread-sidebar.tsx
+++ b/apps/web/src/routes/agent/-components/thread-sidebar.tsx
@@ -25,6 +25,7 @@ import { ScrollArea } from "@reactive-resume/ui/components/scroll-area";
import { cn } from "@reactive-resume/utils/style";
import { useConfirm } from "@/hooks/use-confirm";
import { getOrpcErrorMessage } from "@/libs/error-message";
+import { formatRelativeTime } from "@/libs/locale";
import { orpc } from "@/libs/orpc/client";
type AgentThreadSummary = RouterOutput["agent"]["threads"]["list"][number];
@@ -41,28 +42,6 @@ type AgentThreadSidebarProps = {
className?: string;
};
-const RELATIVE_TIME_DIVISIONS: Array<{ amount: number; unit: Intl.RelativeTimeFormatUnit }> = [
- { amount: 31_536_000_000, unit: "year" },
- { amount: 2_592_000_000, unit: "month" },
- { amount: 604_800_000, unit: "week" },
- { amount: 86_400_000, unit: "day" },
- { amount: 3_600_000, unit: "hour" },
- { amount: 60_000, unit: "minute" },
-];
-
-function formatRelativeTime(value: Date | string, formatter: Intl.RelativeTimeFormat) {
- const date = value instanceof Date ? value : new Date(value);
- const diffMs = date.getTime() - Date.now();
- const absMs = Math.abs(diffMs);
-
- if (absMs < 60_000) return formatter.format(0, "second");
-
- const division = RELATIVE_TIME_DIVISIONS.find((candidate) => absMs >= candidate.amount);
- if (!division) return "";
-
- return formatter.format(Math.round(diffMs / division.amount), division.unit);
-}
-
function ThreadActions({ thread, activeThreadId }: ThreadActionsProps) {
const navigate = useNavigate();
const confirm = useConfirm();
@@ -164,7 +143,7 @@ function ThreadRow({ thread, activeThreadId }: ThreadRowProps) {
>
<div className="truncate font-medium">{title}</div>
<div className="truncate text-muted-foreground text-xs">
- {formatRelativeTime(thread.lastMessageAt, relativeTimeFormatter)}
+ {formatRelativeTime(thread.lastMessageAt, relativeTimeFormatter, "")}
</div>
</Link>
<ThreadActions thread={thread} activeThreadId={activeThreadId} />
diff --git a/apps/web/src/routes/agent/route.tsx b/apps/web/src/routes/agent/route.tsx
index 1941d590c..ed407c2b3 100644
--- a/apps/web/src/routes/agent/route.tsx
+++ b/apps/web/src/routes/agent/route.tsx
@@ -3,7 +3,7 @@ import { createNoindexFollowMeta } from "@/libs/seo";
export const Route = createFileRoute("/agent")({
component: RouteComponent,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (!context.session) throw redirect({ to: "/auth/login", replace: true });
return { session: context.session };
},
diff --git a/apps/web/src/routes/auth/forgot-password.tsx b/apps/web/src/routes/auth/forgot-password.tsx
index 1638c4117..360e52540 100644
--- a/apps/web/src/routes/auth/forgot-password.tsx
+++ b/apps/web/src/routes/auth/forgot-password.tsx
@@ -3,7 +3,7 @@ import { ForgotPasswordPage } from "@/features/auth/pages/forgot-password";
export const Route = createFileRoute("/auth/forgot-password")({
component: ForgotPasswordPage,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.flags.disableEmailAuth) throw redirect({ to: "/auth/login", replace: true });
},
});
diff --git a/apps/web/src/routes/auth/index.tsx b/apps/web/src/routes/auth/index.tsx
index 63c2e91fd..0eef192f8 100644
--- a/apps/web/src/routes/auth/index.tsx
+++ b/apps/web/src/routes/auth/index.tsx
@@ -1,7 +1,7 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/auth/")({
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.session) throw redirect({ to: "/dashboard", replace: true });
throw redirect({ to: "/auth/login", replace: true });
},
diff --git a/apps/web/src/routes/auth/login.tsx b/apps/web/src/routes/auth/login.tsx
index b08878089..815bd10ed 100644
--- a/apps/web/src/routes/auth/login.tsx
+++ b/apps/web/src/routes/auth/login.tsx
@@ -3,7 +3,7 @@ import { LoginPage } from "@/features/auth/pages/login";
export const Route = createFileRoute("/auth/login")({
component: RouteComponent,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.session) throw redirect({ to: "/dashboard", replace: true });
return { session: null };
},
diff --git a/apps/web/src/routes/auth/register.tsx b/apps/web/src/routes/auth/register.tsx
index 91c12c197..0f280b340 100644
--- a/apps/web/src/routes/auth/register.tsx
+++ b/apps/web/src/routes/auth/register.tsx
@@ -3,7 +3,7 @@ import { RegisterPage } from "@/features/auth/pages/register";
export const Route = createFileRoute("/auth/register")({
component: RouteComponent,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.session) throw redirect({ to: "/dashboard", replace: true });
if (context.flags.disableSignups) throw redirect({ to: "/auth/login", replace: true });
return { session: null };
diff --git a/apps/web/src/routes/auth/reset-password.tsx b/apps/web/src/routes/auth/reset-password.tsx
index 4cb8b0d54..ec0a8cbb6 100644
--- a/apps/web/src/routes/auth/reset-password.tsx
+++ b/apps/web/src/routes/auth/reset-password.tsx
@@ -7,7 +7,7 @@ const searchSchema = z.object({ token: z.string().min(1) });
export const Route = createFileRoute("/auth/reset-password")({
component: RouteComponent,
validateSearch: searchSchema,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.flags.disableEmailAuth) throw redirect({ to: "/auth/login", replace: true });
},
onError: (error) => {
diff --git a/apps/web/src/routes/auth/verify-2fa-backup.tsx b/apps/web/src/routes/auth/verify-2fa-backup.tsx
index 96d047df5..e099c39e1 100644
--- a/apps/web/src/routes/auth/verify-2fa-backup.tsx
+++ b/apps/web/src/routes/auth/verify-2fa-backup.tsx
@@ -1,9 +1,9 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
-import { VerifyTwoFactorBackupPage } from "@/features/auth/pages/verify-2fa-backup";
+import { VerifyTwoFactorBackupPage } from "@/features/auth/pages/verify-2fa";
export const Route = createFileRoute("/auth/verify-2fa-backup")({
component: VerifyTwoFactorBackupPage,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.session) throw redirect({ to: "/dashboard", replace: true });
},
});
diff --git a/apps/web/src/routes/auth/verify-2fa.tsx b/apps/web/src/routes/auth/verify-2fa.tsx
index 20324f9d7..d43f73588 100644
--- a/apps/web/src/routes/auth/verify-2fa.tsx
+++ b/apps/web/src/routes/auth/verify-2fa.tsx
@@ -3,7 +3,7 @@ import { VerifyTwoFactorPage } from "@/features/auth/pages/verify-2fa";
export const Route = createFileRoute("/auth/verify-2fa")({
component: VerifyTwoFactorPage,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (context.session) throw redirect({ to: "/dashboard", replace: true });
},
});
diff --git a/apps/web/src/routes/builder/$resumeId/-components/dock.tsx b/apps/web/src/routes/builder/$resumeId/-components/dock.tsx
index eedd55750..b1140d02e 100644
--- a/apps/web/src/routes/builder/$resumeId/-components/dock.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-components/dock.tsx
@@ -15,7 +15,6 @@ import {
import { useHotkey } from "@tanstack/react-hotkeys";
import { useNavigate } from "@tanstack/react-router";
import { m } from "motion/react";
-import { useCallback, useMemo } from "react";
import { useControls, useTransformComponent } from "react-zoom-pan-pinch";
import { toast } from "sonner";
import { useCopyToClipboard } from "usehooks-ts";
@@ -72,15 +71,8 @@ export function BuilderDock({ pageLayout, onTogglePageLayout }: BuilderDockProps
redo();
});
- const publicUrl = useMemo(() => {
- if (!session?.user.username || !resumeSlug) return "";
- return `${window.location.origin}/${session.user.username}/${resumeSlug}`;
- }, [session?.user.username, resumeSlug]);
-
- const onCopyUrl = useCallback(async () => {
- await copyToClipboard(publicUrl);
- toast.success(t`A link to your resume has been copied to clipboard.`);
- }, [publicUrl, copyToClipboard]);
+ const publicUrl =
+ session?.user.username && resumeSlug ? `${window.location.origin}/${session.user.username}/${resumeSlug}` : "";
return (
<div className="fixed inset-x-0 bottom-20 flex items-center justify-center md:bottom-4">
@@ -111,7 +103,14 @@ export function BuilderDock({ pageLayout, onTogglePageLayout }: BuilderDockProps
}}
/>
<div className="mx-1 h-8 w-px bg-border" />
- <DockIcon icon={LinkSimpleIcon} title={t`Copy URL`} onClick={() => onCopyUrl()} />
+ <DockIcon
+ icon={LinkSimpleIcon}
+ title={t`Copy URL`}
+ onClick={async () => {
+ await copyToClipboard(publicUrl);
+ toast.success(t`A link to your resume has been copied to clipboard.`);
+ }}
+ />
</m.div>
</div>
);
diff --git a/apps/web/src/routes/builder/$resumeId/-components/version-history.tsx b/apps/web/src/routes/builder/$resumeId/-components/version-history.tsx
index 85b52dcc5..50c2a1f36 100644
--- a/apps/web/src/routes/builder/$resumeId/-components/version-history.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-components/version-history.tsx
@@ -19,29 +19,9 @@ import {
import { useResumeStore } from "@/features/resume/builder/draft";
import { useConfirm } from "@/hooks/use-confirm";
import { getResumeErrorMessage } from "@/libs/error-message";
+import { formatRelativeTime } from "@/libs/locale";
import { orpc } from "@/libs/orpc/client";
-const RELATIVE_TIME_DIVISIONS: { amount: number; unit: Intl.RelativeTimeFormatUnit }[] = [
- { amount: 31_536_000_000, unit: "year" },
- { amount: 2_592_000_000, unit: "month" },
- { amount: 604_800_000, unit: "week" },
- { amount: 86_400_000, unit: "day" },
- { amount: 3_600_000, unit: "hour" },
- { amount: 60_000, unit: "minute" },
-];
-
-function formatRelativeTime(value: Date | string, formatter: Intl.RelativeTimeFormat) {
- const date = value instanceof Date ? value : new Date(value);
- const diffMs = date.getTime() - Date.now();
- const absMs = Math.abs(diffMs);
-
- // No division matches only when the gap is under a minute (the smallest division), so fall back to seconds.
- const division = RELATIVE_TIME_DIVISIONS.find((candidate) => absMs >= candidate.amount);
- if (!division) return formatter.format(0, "second");
-
- return formatter.format(Math.round(diffMs / division.amount), division.unit);
-}
-
type BuilderVersionHistoryProps = {
resumeId: string;
};
diff --git a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/custom-styles.test.tsx b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/custom-styles.test.tsx
index 63b179e1d..1a230c99b 100644
--- a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/custom-styles.test.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/custom-styles.test.tsx
@@ -326,7 +326,6 @@ describe("CustomStylesSectionBuilder", () => {
fireEvent.blur(fontSizeInput);
expect(fontSizeInput).toHaveValue(12);
- expect(updateResumeData).toHaveBeenCalledTimes(2);
});
it("commits normalized legacy values when the input loses focus", () => {
diff --git a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/resume-analysis.tsx b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/resume-analysis.tsx
index a2e1bfbdd..86d53ba93 100644
--- a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/resume-analysis.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/resume-analysis.tsx
@@ -3,7 +3,6 @@ import { Trans } from "@lingui/react/macro";
import { ArrowRightIcon, InfoIcon, LightningIcon, SparkleIcon } from "@phosphor-icons/react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
-import { useMemo } from "react";
import { toast } from "sonner";
import { match } from "ts-pattern";
import { Alert, AlertDescription } from "@reactive-resume/ui/components/alert";
@@ -93,13 +92,8 @@ export function ResumeAnalysisSectionBuilder() {
// so the server render has no date and there's no hydration mismatch to defer around.
const updatedAtLabel = updatedAt ? new Date(updatedAt).toLocaleString() : null;
const analyzeLabel = isPending ? t`Analyzing…` : t`Analyze Resume`;
-
- const scoreTone = useMemo(() => {
- if (score == null) return "bg-muted";
- if (score >= 80) return "bg-emerald-600";
- if (score >= 60) return "bg-amber-600";
- return "bg-rose-600";
- }, [score]);
+ const scoreTone =
+ score == null ? "bg-muted" : score >= 80 ? "bg-emerald-600" : score >= 60 ? "bg-amber-600" : "bg-rose-600";
const onAnalyze = () => {
if (!resume) return;
diff --git a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/sharing.tsx b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/sharing.tsx
index f474e0614..2021e3b78 100644
--- a/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/sharing.tsx
+++ b/apps/web/src/routes/builder/$resumeId/-sidebar/right/sections/sharing.tsx
@@ -3,7 +3,7 @@ import { Trans } from "@lingui/react/macro";
import { ORPCError } from "@orpc/client";
import { ClipboardIcon, LockSimpleIcon, LockSimpleOpenIcon } from "@phosphor-icons/react";
import { useMutation } from "@tanstack/react-query";
-import { useCallback, useMemo } from "react";
+import { useCallback } from "react";
import { toast } from "sonner";
import { useCopyToClipboard } from "usehooks-ts";
import { Button } from "@reactive-resume/ui/components/button";
@@ -29,10 +29,7 @@ export function SharingSectionBuilder() {
const { mutateAsync: setPassword } = useMutation(orpc.resume.setPassword.mutationOptions());
const { mutateAsync: removePassword } = useMutation(orpc.resume.removePassword.mutationOptions());
- const publicUrl = useMemo(() => {
- if (!session) return "";
- return `${window.location.origin}/${session.user.username}/${resume.slug}`;
- }, [session, resume]);
+ const publicUrl = session ? `${window.location.origin}/${session.user.username}/${resume.slug}` : "";
const onCopyUrl = useCallback(async () => {
await copyToClipboard(publicUrl);
diff --git a/apps/web/src/routes/builder/$resumeId/-store/sidebar.ts b/apps/web/src/routes/builder/$resumeId/-store/sidebar.ts
index 8ba6053ab..89df1aaa3 100644
--- a/apps/web/src/routes/builder/$resumeId/-store/sidebar.ts
+++ b/apps/web/src/routes/builder/$resumeId/-store/sidebar.ts
@@ -1,6 +1,6 @@
import type { Layout, usePanelRef } from "react-resizable-panels";
import Cookies from "js-cookie";
-import { useCallback, useMemo } from "react";
+import { useCallback } from "react";
import { useMediaQuery, useWindowSize } from "usehooks-ts";
import { create } from "zustand/react";
@@ -135,17 +135,14 @@ export function useBuilderSidebar(): UseBuilderSidebarReturn {
[expandSize],
);
- // ponytail: memoized but callers destructure; selector removed (state rebuilt every render, zero benefit)
- return useMemo(() => {
- return {
- maxSidebarSize,
- minSidebarSize,
- collapsedSidebarSize,
- groupResizeBehavior,
- isCollapsed,
- toggleSidebar,
- };
- }, [maxSidebarSize, minSidebarSize, collapsedSidebarSize, groupResizeBehavior, isCollapsed, toggleSidebar]);
+ return {
+ maxSidebarSize,
+ minSidebarSize,
+ collapsedSidebarSize,
+ groupResizeBehavior,
+ isCollapsed,
+ toggleSidebar,
+ };
}
export const setBuilderLayout = (data: BuilderLayout) => {
diff --git a/apps/web/src/routes/builder/$resumeId/route.tsx b/apps/web/src/routes/builder/$resumeId/route.tsx
index 5733830a8..a6c89b58f 100644
--- a/apps/web/src/routes/builder/$resumeId/route.tsx
+++ b/apps/web/src/routes/builder/$resumeId/route.tsx
@@ -12,7 +12,7 @@ import { getBuilderLayout } from "./-store/sidebar";
export const Route = createFileRoute("/builder/$resumeId")({
component: RouteComponent,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (!context.session) throw redirect({ to: "/auth/login", replace: true });
return { session: context.session };
},
diff --git a/apps/web/src/routes/dashboard/resumes/-components/menus/context-menu.tsx b/apps/web/src/routes/dashboard/resumes/-components/menus/context-menu.tsx
index e62ffc2eb..f3dec853e 100644
--- a/apps/web/src/routes/dashboard/resumes/-components/menus/context-menu.tsx
+++ b/apps/web/src/routes/dashboard/resumes/-components/menus/context-menu.tsx
@@ -1,5 +1,4 @@
import type { RouterOutput } from "@/libs/orpc/client";
-import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import {
CopySimpleIcon,
@@ -9,9 +8,7 @@ import {
PencilSimpleLineIcon,
TrashSimpleIcon,
} from "@phosphor-icons/react";
-import { useMutation } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
-import { toast } from "sonner";
import {
ContextMenu,
ContextMenuContent,
@@ -19,10 +16,7 @@ import {
ContextMenuSeparator,
ContextMenuTrigger,
} from "@reactive-resume/ui/components/context-menu";
-import { useDialogStore } from "@/dialogs/store";
-import { useConfirm } from "@/hooks/use-confirm";
-import { getResumeErrorMessage } from "@/libs/error-message";
-import { orpc } from "@/libs/orpc/client";
+import { useResumeMenuActions } from "./use-resume-menu-actions";
type Props = {
resume: RouterOutput["resume"]["list"][number];
@@ -30,60 +24,7 @@ type Props = {
};
export function ResumeContextMenu({ resume, children }: Props) {
- const confirm = useConfirm();
- const { openDialog } = useDialogStore();
-
- const { mutate: deleteResume } = useMutation(orpc.resume.delete.mutationOptions());
- const { mutate: setLockedResume } = useMutation(orpc.resume.setLocked.mutationOptions());
-
- const handleUpdate = () => {
- openDialog("resume.update", resume);
- };
-
- const handleDuplicate = () => {
- openDialog("resume.duplicate", resume);
- };
-
- const handleToggleLock = async () => {
- if (!resume.isLocked) {
- const confirmation = await confirm(t`Are you sure you want to lock this resume?`, {
- description: t`When locked, the resume cannot be updated or deleted.`,
- });
-
- if (!confirmation) return;
- }
-
- setLockedResume(
- { id: resume.id, isLocked: !resume.isLocked },
- {
- onError: (error) => {
- toast.error(getResumeErrorMessage(error));
- },
- },
- );
- };
-
- const handleDelete = async () => {
- const confirmation = await confirm(t`Are you sure you want to delete this resume?`, {
- description: t`This action cannot be undone.`,
- });
-
- if (!confirmation) return;
-
- const toastId = toast.loading(t`Deleting your resume...`);
-
- deleteResume(
- { id: resume.id },
- {
- onSuccess: () => {
- toast.success(t`Your resume has been deleted successfully.`, { id: toastId });
- },
- onError: (error) => {
- toast.error(getResumeErrorMessage(error), { id: toastId });
- },
- },
- );
- };
+ const { handleDelete, handleDuplicate, handleToggleLock, handleUpdate } = useResumeMenuActions(resume);
return (
<ContextMenu>
diff --git a/apps/web/src/routes/dashboard/resumes/-components/menus/dropdown-menu.tsx b/apps/web/src/routes/dashboard/resumes/-components/menus/dropdown-menu.tsx
index 20469ed45..3137e8d52 100644
--- a/apps/web/src/routes/dashboard/resumes/-components/menus/dropdown-menu.tsx
+++ b/apps/web/src/routes/dashboard/resumes/-components/menus/dropdown-menu.tsx
@@ -1,5 +1,4 @@
import type { RouterOutput } from "@/libs/orpc/client";
-import { t } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import {
CopySimpleIcon,
@@ -9,9 +8,7 @@ import {
PencilSimpleLineIcon,
TrashSimpleIcon,
} from "@phosphor-icons/react";
-import { useMutation } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
-import { toast } from "sonner";
import {
DropdownMenu,
DropdownMenuContent,
@@ -19,10 +16,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@reactive-resume/ui/components/dropdown-menu";
-import { useDialogStore } from "@/dialogs/store";
-import { useConfirm } from "@/hooks/use-confirm";
-import { getResumeErrorMessage } from "@/libs/error-message";
-import { orpc } from "@/libs/orpc/client";
+import { useResumeMenuActions } from "./use-resume-menu-actions";
type Props = Omit<React.ComponentProps<typeof DropdownMenuContent>, "children"> & {
resume: RouterOutput["resume"]["list"][number];
@@ -30,60 +24,7 @@ type Props = Omit<React.ComponentProps<typeof DropdownMenuContent>, "children">
};
export function ResumeDropdownMenu({ resume, children, ...props }: Props) {
- const confirm = useConfirm();
- const { openDialog } = useDialogStore();
-
- const { mutate: deleteResume } = useMutation(orpc.resume.delete.mutationOptions());
- const { mutate: setLockedResume } = useMutation(orpc.resume.setLocked.mutationOptions());
-
- const handleUpdate = () => {
- openDialog("resume.update", resume);
- };
-
- const handleDuplicate = () => {
- openDialog("resume.duplicate", resume);
- };
-
- const handleToggleLock = async () => {
- if (!resume.isLocked) {
- const confirmation = await confirm(t`Are you sure you want to lock this resume?`, {
- description: t`When locked, the resume cannot be updated or deleted.`,
- });
-
- if (!confirmation) return;
- }
-
- setLockedResume(
- { id: resume.id, isLocked: !resume.isLocked },
- {
- onError: (error) => {
- toast.error(getResumeErrorMessage(error));
- },
- },
- );
- };
-
- const handleDelete = async () => {
- const confirmation = await confirm(t`Are you sure you want to delete this resume?`, {
- description: t`This action cannot be undone.`,
- });
-
- if (!confirmation) return;
-
- const toastId = toast.loading(t`Deleting your resume...`);
-
- deleteResume(
- { id: resume.id },
- {
- onSuccess: () => {
- toast.success(t`Your resume has been deleted successfully.`, { id: toastId });
- },
- onError: (error) => {
- toast.error(getResumeErrorMessage(error), { id: toastId });
- },
- },
- );
- };
+ const { handleDelete, handleDuplicate, handleToggleLock, handleUpdate } = useResumeMenuActions(resume);
return (
<DropdownMenu>
diff --git a/apps/web/src/routes/dashboard/resumes/-components/menus/use-resume-menu-actions.ts b/apps/web/src/routes/dashboard/resumes/-components/menus/use-resume-menu-actions.ts
new file mode 100644
index 000000000..d03e505c7
--- /dev/null
+++ b/apps/web/src/routes/dashboard/resumes/-components/menus/use-resume-menu-actions.ts
@@ -0,0 +1,54 @@
+import type { RouterOutput } from "@/libs/orpc/client";
+import { t } from "@lingui/core/macro";
+import { useMutation } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { useDialogStore } from "@/dialogs/store";
+import { useConfirm } from "@/hooks/use-confirm";
+import { getResumeErrorMessage } from "@/libs/error-message";
+import { orpc } from "@/libs/orpc/client";
+
+type Resume = RouterOutput["resume"]["list"][number];
+
+export function useResumeMenuActions(resume: Resume) {
+ const confirm = useConfirm();
+ const { openDialog } = useDialogStore();
+ const { mutate: deleteResume } = useMutation(orpc.resume.delete.mutationOptions());
+ const { mutate: setLockedResume } = useMutation(orpc.resume.setLocked.mutationOptions());
+
+ const handleToggleLock = async () => {
+ if (!resume.isLocked) {
+ const confirmed = await confirm(t`Are you sure you want to lock this resume?`, {
+ description: t`When locked, the resume cannot be updated or deleted.`,
+ });
+ if (!confirmed) return;
+ }
+
+ setLockedResume(
+ { id: resume.id, isLocked: !resume.isLocked },
+ { onError: (error) => toast.error(getResumeErrorMessage(error)) },
+ );
+ };
+
+ const handleDelete = async () => {
+ const confirmed = await confirm(t`Are you sure you want to delete this resume?`, {
+ description: t`This action cannot be undone.`,
+ });
+ if (!confirmed) return;
+
+ const toastId = toast.loading(t`Deleting your resume...`);
+ deleteResume(
+ { id: resume.id },
+ {
+ onSuccess: () => toast.success(t`Your resume has been deleted successfully.`, { id: toastId }),
+ onError: (error) => toast.error(getResumeErrorMessage(error), { id: toastId }),
+ },
+ );
+ };
+
+ return {
+ handleDelete,
+ handleDuplicate: () => openDialog("resume.duplicate", resume),
+ handleToggleLock,
+ handleUpdate: () => openDialog("resume.update", resume),
+ };
+}
diff --git a/apps/web/src/routes/dashboard/route.tsx b/apps/web/src/routes/dashboard/route.tsx
index f844d0fa9..f7f112be7 100644
--- a/apps/web/src/routes/dashboard/route.tsx
+++ b/apps/web/src/routes/dashboard/route.tsx
@@ -7,11 +7,11 @@ import { DashboardSidebar } from "./-components/sidebar";
export const Route = createFileRoute("/dashboard")({
component: RouteComponent,
- beforeLoad: async ({ context }) => {
+ beforeLoad: ({ context }) => {
if (!context.session) throw redirect({ to: "/auth/login", replace: true });
return { session: context.session };
},
- loader: async () => {
+ loader: () => {
const sidebarState = getDashboardSidebarState();
return { sidebarState };
},
diff --git a/biome.json b/biome.json
index 140f73b0d..639985ca7 100644
--- a/biome.json
+++ b/biome.json
@@ -53,7 +53,8 @@
},
"suspicious": {
"noArrayIndexKey": "off",
- "noExplicitAny": "error"
+ "noExplicitAny": "error",
+ "useAwait": "error"
},
"nursery": {
"useSortedClasses": {
diff --git a/packages/api/src/context.ts b/packages/api/src/context.ts
index 197f78730..081c4d6a0 100644
--- a/packages/api/src/context.ts
+++ b/packages/api/src/context.ts
@@ -88,7 +88,7 @@ export const publicProcedure = base.use(async ({ context, next }) => {
});
});
-export const protectedProcedure = publicProcedure.use(async ({ context, next }) => {
+export const protectedProcedure = publicProcedure.use(({ context, next }) => {
if (!context.user) throw new ORPCError("UNAUTHORIZED");
return next({
diff --git a/packages/api/src/dto/application.test.ts b/packages/api/src/dto/application.test.ts
index ed3ad7410..3dac89525 100644
--- a/packages/api/src/dto/application.test.ts
+++ b/packages/api/src/dto/application.test.ts
@@ -19,7 +19,7 @@ describe("applicationDto sourceUrl", () => {
role: "Engineer",
sourceUrl: "javascript:alert(1)",
}),
- ).toThrow();
+ ).toThrow("URL must use http or https.");
});
});
diff --git a/packages/api/src/dto/application.ts b/packages/api/src/dto/application.ts
index 2e544d943..37a2c4ac8 100644
--- a/packages/api/src/dto/application.ts
+++ b/packages/api/src/dto/application.ts
@@ -22,14 +22,7 @@ const applicationDocumentFileSchema = z
const httpUrlSchema = z
.string()
.trim()
- .refine((value) => {
- try {
- const parsed = new URL(value);
- return parsed.protocol === "http:" || parsed.protocol === "https:";
- } catch {
- return false;
- }
- }, "URL must use http or https.");
+ .pipe(z.url({ protocol: /^https?$/, error: "URL must use http or https." }));
const applicationSchema = createSelectSchema(schema.application, {
id: z.string().describe("The ID of the application."),
diff --git a/packages/api/src/features/agent/actions.ts b/packages/api/src/features/agent/actions.ts
index f473a6eb3..38b1fca7c 100644
--- a/packages/api/src/features/agent/actions.ts
+++ b/packages/api/src/features/agent/actions.ts
@@ -14,7 +14,5 @@ export const actionsRouter = {
})
.input(z.object({ id: z.string() }))
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.actions.revert({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => agentService.actions.revert({ id: input.id, userId: context.user.id })),
};
diff --git a/packages/api/src/features/agent/attachments.ts b/packages/api/src/features/agent/attachments.ts
index 302b8b632..c0be91e98 100644
--- a/packages/api/src/features/agent/attachments.ts
+++ b/packages/api/src/features/agent/attachments.ts
@@ -4,10 +4,6 @@ import { storageUploadRateLimit } from "../../middleware/rate-limit";
import { mapAgentEnvironmentError } from "./routing";
import { agentService } from "./service";
-function base64ToUint8Array(value: string) {
- return Uint8Array.from(Buffer.from(value, "base64"));
-}
-
export const attachmentsRouter = {
create: protectedProcedure
.route({
@@ -27,15 +23,15 @@ export const attachmentsRouter = {
)
.use(storageUploadRateLimit)
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.attachments.create({
+ .handler(({ context, input }) =>
+ agentService.attachments.create({
userId: context.user.id,
threadId: input.threadId,
filename: input.filename,
mediaType: input.mediaType,
- data: base64ToUint8Array(input.data),
- });
- }),
+ data: Uint8Array.from(Buffer.from(input.data, "base64")),
+ }),
+ ),
delete: protectedProcedure
.route({
@@ -48,7 +44,5 @@ export const attachmentsRouter = {
.input(z.object({ id: z.string() }))
.output(z.void())
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- await agentService.attachments.delete({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => agentService.attachments.delete({ id: input.id, userId: context.user.id })),
};
diff --git a/packages/api/src/features/agent/messages.ts b/packages/api/src/features/agent/messages.ts
index 89c982556..e1adc1f4e 100644
--- a/packages/api/src/features/agent/messages.ts
+++ b/packages/api/src/features/agent/messages.ts
@@ -23,14 +23,14 @@ export const messagesRouter = {
)
.use(aiRequestRateLimit)
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.messages.send({
+ .handler(({ context, input }) =>
+ agentService.messages.send({
userId: context.user.id,
threadId: input.threadId,
message: input.message,
...(input.attachmentIds ? { attachmentIds: input.attachmentIds } : {}),
- });
- }),
+ }),
+ ),
stop: protectedProcedure
.route({
@@ -48,13 +48,13 @@ export const messagesRouter = {
)
.output(z.void())
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- await agentService.messages.stop({
+ .handler(({ context, input }) =>
+ agentService.messages.stop({
userId: context.user.id,
threadId: input.threadId,
...(input.partialMessage ? { partialMessage: input.partialMessage } : {}),
- });
- }),
+ }),
+ ),
resume: protectedProcedure
.route({
@@ -66,7 +66,7 @@ export const messagesRouter = {
})
.input(z.object({ threadId: z.string() }))
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.messages.resume({ userId: context.user.id, threadId: input.threadId });
- }),
+ .handler(({ context, input }) =>
+ agentService.messages.resume({ userId: context.user.id, threadId: input.threadId }),
+ ),
};
diff --git a/packages/api/src/features/agent/service.ts b/packages/api/src/features/agent/service.ts
index 2bbd878d3..6e0b35537 100644
--- a/packages/api/src/features/agent/service.ts
+++ b/packages/api/src/features/agent/service.ts
@@ -332,20 +332,11 @@ function uniqueAttachmentIds(ids: unknown) {
throw new ORPCError("BAD_REQUEST", { message: "Attachment IDs must be unique." });
}
- if (unique.size > MAX_ATTACHMENTS_PER_MESSAGE) {
- throw new ORPCError("BAD_REQUEST", { message: "Too many attachments for one message." });
- }
-
- return Array.from(unique);
-}
-
-function normalizeAttachmentIds(ids: unknown) {
- const unique = uniqueAttachmentIds(ids);
- return unique;
+ return [...unique];
}
async function getUnlinkedMessageAttachments(input: { ids: unknown; threadId: string; userId: string }) {
- const ids = normalizeAttachmentIds(input.ids);
+ const ids = uniqueAttachmentIds(input.ids);
if (ids.length === 0) return [];
const attachments = await db
@@ -406,9 +397,9 @@ async function linkAttachmentsToMessage(input: {
}
}
-async function readAttachmentModelInputs(attachments: AgentAttachmentRecord[]): Promise<AttachmentModelInput[]> {
+function readAttachmentModelInputs(attachments: AgentAttachmentRecord[]): Promise<AttachmentModelInput[]> {
const storage = getStorageService();
- const inputs = await Promise.all(
+ return Promise.all(
attachments.map(async (attachment) => {
const stored = await storage.read(attachment.storageKey);
if (!stored) {
@@ -418,8 +409,6 @@ async function readAttachmentModelInputs(attachments: AgentAttachmentRecord[]):
return { attachment, data: stored.data };
}),
);
-
- return inputs;
}
function attachModelPartsToLatestUserMessage(
@@ -643,7 +632,7 @@ function buildThreadTitle(message: UIMessage, fallback: string) {
return text.length > 60 ? `${text.slice(0, 57)}...` : text;
}
-async function listThreadMessages(input: { threadId: string; userId: string }) {
+function listThreadMessages(input: { threadId: string; userId: string }) {
return db
.select()
.from(schema.agentMessage)
diff --git a/packages/api/src/features/agent/threads.ts b/packages/api/src/features/agent/threads.ts
index 9a3371c0a..ca48899fe 100644
--- a/packages/api/src/features/agent/threads.ts
+++ b/packages/api/src/features/agent/threads.ts
@@ -13,9 +13,7 @@ export const threadsRouter = {
summary: "List agent threads",
})
.use(mapAgentEnvironmentError)
- .handler(async ({ context }) => {
- return await agentService.threads.list({ userId: context.user.id });
- }),
+ .handler(({ context }) => agentService.threads.list({ userId: context.user.id })),
create: protectedProcedure
.route({
@@ -27,14 +25,14 @@ export const threadsRouter = {
})
.input(z.object({ aiProviderId: z.string().optional(), sourceResumeId: z.string().optional() }))
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.threads.create({
+ .handler(({ context, input }) =>
+ agentService.threads.create({
userId: context.user.id,
locale: context.locale,
...(input.aiProviderId ? { aiProviderId: input.aiProviderId } : {}),
...(input.sourceResumeId ? { sourceResumeId: input.sourceResumeId } : {}),
- });
- }),
+ }),
+ ),
getOrCreateForResume: protectedProcedure
.route({
@@ -46,13 +44,13 @@ export const threadsRouter = {
})
.input(z.object({ resumeId: z.string(), aiProviderId: z.string().optional() }))
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.threads.getOrCreateForResume({
+ .handler(({ context, input }) =>
+ agentService.threads.getOrCreateForResume({
userId: context.user.id,
resumeId: input.resumeId,
...(input.aiProviderId ? { aiProviderId: input.aiProviderId } : {}),
- });
- }),
+ }),
+ ),
get: protectedProcedure
.route({
@@ -64,9 +62,7 @@ export const threadsRouter = {
})
.input(z.object({ id: z.string() }))
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- return await agentService.threads.get({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => agentService.threads.get({ id: input.id, userId: context.user.id })),
archive: protectedProcedure
.route({
@@ -79,9 +75,7 @@ export const threadsRouter = {
.input(z.object({ id: z.string() }))
.output(z.void())
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- await agentService.threads.archive({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => agentService.threads.archive({ id: input.id, userId: context.user.id })),
delete: protectedProcedure
.route({
@@ -94,7 +88,5 @@ export const threadsRouter = {
.input(z.object({ id: z.string() }))
.output(z.void())
.use(mapAgentEnvironmentError)
- .handler(async ({ context, input }) => {
- await agentService.threads.delete({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => agentService.threads.delete({ id: input.id, userId: context.user.id })),
};
diff --git a/packages/api/src/features/ai-providers/router.ts b/packages/api/src/features/ai-providers/router.ts
index fd2d767d4..9c5d4de69 100644
--- a/packages/api/src/features/ai-providers/router.ts
+++ b/packages/api/src/features/ai-providers/router.ts
@@ -7,16 +7,6 @@ import { aiRequestRateLimit } from "../../middleware/rate-limit";
import { providerInput, updateProviderInput } from "./inputs";
import { aiProvidersService } from "./service";
-function isAgentEnvironmentUnavailable(error: unknown) {
- return error instanceof Error && error.message === "AGENT_ENVIRONMENT_UNAVAILABLE";
-}
-
-function throwUnavailable(): never {
- throw new ORPCError("PRECONDITION_FAILED", {
- message: "AI agent workspace is unavailable because REDIS_URL or ENCRYPTION_SECRET is not configured.",
- });
-}
-
function isInvalidAiBaseUrl(error: unknown) {
return error instanceof Error && error.message === "INVALID_AI_BASE_URL";
}
@@ -39,14 +29,7 @@ export const aiProvidersRouter = {
.errors({
PRECONDITION_FAILED: { message: "AI agent workspace is not configured.", status: 412 },
})
- .handler(async ({ context }) => {
- try {
- return await aiProvidersService.list({ userId: context.user.id });
- } catch (error) {
- if (isAgentEnvironmentUnavailable(error)) throwUnavailable();
- throw error;
- }
- }),
+ .handler(({ context }) => aiProvidersService.list({ userId: context.user.id })),
create: protectedProcedure
.route({
@@ -74,7 +57,6 @@ export const aiProvidersRouter = {
apiKey: input.apiKey,
});
} catch (error) {
- if (isAgentEnvironmentUnavailable(error)) throwUnavailable();
if (isInvalidAiBaseUrl(error)) throwInvalidProviderConfig();
throw error;
}
@@ -110,7 +92,6 @@ export const aiProvidersRouter = {
...(input.enabled !== undefined ? { enabled: input.enabled } : {}),
});
} catch (error) {
- if (isAgentEnvironmentUnavailable(error)) throwUnavailable();
if (isInvalidAiBaseUrl(error)) throwInvalidProviderConfig();
throw error;
}
@@ -130,14 +111,7 @@ export const aiProvidersRouter = {
.errors({
PRECONDITION_FAILED: { message: "AI agent workspace is not configured.", status: 412 },
})
- .handler(async ({ context, input }) => {
- try {
- await aiProvidersService.delete({ id: input.id, userId: context.user.id });
- } catch (error) {
- if (isAgentEnvironmentUnavailable(error)) throwUnavailable();
- throw error;
- }
- }),
+ .handler(({ context, input }) => aiProvidersService.delete({ id: input.id, userId: context.user.id })),
test: protectedProcedure
.route({
@@ -161,7 +135,6 @@ export const aiProvidersRouter = {
try {
return await aiProvidersService.test({ id: input.id, userId: context.user.id });
} catch (error) {
- if (isAgentEnvironmentUnavailable(error)) throwUnavailable();
if (isInvalidAiBaseUrl(error)) throwInvalidProviderConfig();
if (error instanceof ORPCError) throw error;
throw new ORPCError("BAD_GATEWAY", { message: "Could not reach the AI provider." });
diff --git a/packages/api/src/features/ai-providers/service.ts b/packages/api/src/features/ai-providers/service.ts
index 527e0acd6..fffbb8200 100644
--- a/packages/api/src/features/ai-providers/service.ts
+++ b/packages/api/src/features/ai-providers/service.ts
@@ -86,10 +86,6 @@ function normalizeBaseUrl(input: { provider: AIProvider; baseURL?: string | null
return resolveAiBaseUrl({ provider: input.provider, baseURL: trimmed });
}
-function orderByLastUsedAtDescNullsLast() {
- return desc(sql<Date>`coalesce(${schema.aiProvider.lastUsedAt}, '1970-01-01T00:00:00.000Z'::timestamptz)`);
-}
-
async function getOwnedProvider(input: { id: string; userId: string }) {
const [provider] = await db
.select()
@@ -110,7 +106,10 @@ export const aiProvidersService = {
.select()
.from(schema.aiProvider)
.where(eq(schema.aiProvider.userId, input.userId))
- .orderBy(orderByLastUsedAtDescNullsLast(), asc(schema.aiProvider.createdAt));
+ .orderBy(
+ desc(sql<Date>`coalesce(${schema.aiProvider.lastUsedAt}, '1970-01-01T00:00:00.000Z'::timestamptz)`),
+ asc(schema.aiProvider.createdAt),
+ );
return providers.map(toResponse);
},
@@ -250,7 +249,7 @@ export const aiProvidersService = {
if (!updated) throw new ORPCError("NOT_FOUND");
return toResponse(updated);
} catch (error) {
- const [updated] = await db
+ await db
.update(schema.aiProvider)
.set({
enabled: false,
@@ -258,10 +257,8 @@ export const aiProvidersService = {
testError: error instanceof Error ? error.message : "Failed to test provider.",
lastTestedAt: new Date(),
})
- .where(and(eq(schema.aiProvider.id, input.id), eq(schema.aiProvider.userId, input.userId)))
- .returning();
+ .where(and(eq(schema.aiProvider.id, input.id), eq(schema.aiProvider.userId, input.userId)));
- if (!updated) throw error;
throw error;
}
},
diff --git a/packages/api/src/features/ai/capabilities.ts b/packages/api/src/features/ai/capabilities.ts
index 1a690be13..9724e9239 100644
--- a/packages/api/src/features/ai/capabilities.ts
+++ b/packages/api/src/features/ai/capabilities.ts
@@ -80,9 +80,7 @@ export function supportsOpenAIWebSearch(model: string) {
if (OPENAI_WEB_SEARCH_RESPONSES_MODEL_IDS.has(normalized)) return true;
- return Array.from(OPENAI_WEB_SEARCH_RESPONSES_MODEL_IDS).some((modelId) =>
- isDateSnapshotForModel(normalized, modelId),
- );
+ return [...OPENAI_WEB_SEARCH_RESPONSES_MODEL_IDS].some((modelId) => isDateSnapshotForModel(normalized, modelId));
}
export function supportsProviderNativeWebSearch(provider: AiProviderCapabilityInput) {
diff --git a/packages/api/src/features/ai/service.test.ts b/packages/api/src/features/ai/service.test.ts
index a2c623f63..471e0436a 100644
--- a/packages/api/src/features/ai/service.test.ts
+++ b/packages/api/src/features/ai/service.test.ts
@@ -15,7 +15,7 @@ afterEach(() => {
function stubOpenAICompatibleResponse(response?: { content?: string; finishReason?: string }) {
let requestBody: unknown;
- const fetchMock = vi.fn(async (_input: unknown, init?: { body?: unknown }) => {
+ const fetchMock = vi.fn((_input: unknown, init?: { body?: unknown }) => {
const body = JSON.parse(String(init?.body ?? "{}")) as { max_tokens?: number };
requestBody = body;
const hasEnoughOutputTokens = (body.max_tokens ?? 0) >= 128;
diff --git a/packages/api/src/features/ai/service.ts b/packages/api/src/features/ai/service.ts
index 98f50cb3b..b09bdd04f 100644
--- a/packages/api/src/features/ai/service.ts
+++ b/packages/api/src/features/ai/service.ts
@@ -361,7 +361,7 @@ async function chat(input: ChatInput) {
"Return one or more cohesive resume change proposals. Each proposal must include a title, optional summary, and valid JSON Patch operations against the current resume data. The tool validates but does not apply changes.",
inputSchema: resumePatchProposalToolInputSchema,
outputSchema: resumePatchProposalToolOutputSchema,
- execute: async (toolInput) => {
+ execute: (toolInput) => {
const proposals = normalizeResumePatchProposals(toolInput, input.resumeUpdatedAt);
for (const proposal of proposals) {
diff --git a/packages/api/src/features/applications/ai.ts b/packages/api/src/features/applications/ai.ts
index d78d7b9e9..f3074210b 100644
--- a/packages/api/src/features/applications/ai.ts
+++ b/packages/api/src/features/applications/ai.ts
@@ -348,7 +348,7 @@ async function fetchLinkedInJobPostingText(jobId: string): Promise<string> {
// Best-effort fetch + strip of a job posting page. http(s) only, size/time capped.
export async function fetchJobPostingText(url: string): Promise<string> {
const jobId = linkedInJobId(url);
- if (jobId) return await fetchLinkedInJobPostingText(jobId);
+ if (jobId) return fetchLinkedInJobPostingText(jobId);
if (isLinkedInUrl(url)) {
throw new ORPCError("BAD_REQUEST", { message: "The LinkedIn job URL must include a job posting ID." });
}
diff --git a/packages/api/src/features/applications/crud.ts b/packages/api/src/features/applications/crud.ts
index f880f859a..50c4c2db0 100644
--- a/packages/api/src/features/applications/crud.ts
+++ b/packages/api/src/features/applications/crud.ts
@@ -17,14 +17,14 @@ export const crudRouter = {
})
.input(applicationDto.list.input)
.output(applicationDto.list.output)
- .handler(async ({ input, context }) => {
- return applicationService.list({
+ .handler(({ input, context }) =>
+ applicationService.list({
userId: context.user.id,
...(input.status ? { status: input.status } : {}),
...(input.tags ? { tags: input.tags } : {}),
includeArchived: input.includeArchived,
- });
- }),
+ }),
+ ),
getById: protectedProcedure
.route({
@@ -39,9 +39,7 @@ export const crudRouter = {
})
.input(applicationDto.getById.input)
.output(applicationDto.getById.output)
- .handler(async ({ input, context }) => {
- return applicationService.getById({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ input, context }) => applicationService.getById({ id: input.id, userId: context.user.id })),
create: protectedProcedure
.route({
@@ -57,9 +55,7 @@ export const crudRouter = {
.input(applicationDto.create.input)
.use(resumeMutationRateLimit)
.output(applicationDto.create.output)
- .handler(async ({ input, context }) => {
- return applicationService.create({ userId: context.user.id, ...input });
- }),
+ .handler(({ input, context }) => applicationService.create({ userId: context.user.id, ...input })),
import: protectedProcedure
.route({
@@ -75,9 +71,7 @@ export const crudRouter = {
.input(applicationDto.import.input)
.use(resumeMutationRateLimit)
.output(applicationDto.import.output)
- .handler(async ({ input, context }) => {
- return applicationService.importMany({ userId: context.user.id, items: input.items });
- }),
+ .handler(({ input, context }) => applicationService.importMany({ userId: context.user.id, items: input.items })),
update: protectedProcedure
.route({
@@ -93,9 +87,7 @@ export const crudRouter = {
.input(applicationDto.update.input)
.use(resumeMutationRateLimit)
.output(applicationDto.update.output)
- .handler(async ({ input, context }) => {
- return applicationService.update({ userId: context.user.id, ...input });
- }),
+ .handler(({ input, context }) => applicationService.update({ userId: context.user.id, ...input })),
attachDocument: protectedProcedure
.route({
@@ -153,9 +145,9 @@ export const crudRouter = {
.input(applicationDto.removeDocument.input)
.use(resumeMutationRateLimit)
.output(applicationDto.removeDocument.output)
- .handler(async ({ input, context }) => {
- return applicationService.removeDocument({ id: input.id, userId: context.user.id, kind: input.kind });
- }),
+ .handler(({ input, context }) =>
+ applicationService.removeDocument({ id: input.id, userId: context.user.id, kind: input.kind }),
+ ),
addNote: protectedProcedure
.route({
@@ -170,9 +162,14 @@ export const crudRouter = {
.input(applicationDto.addNote.input)
.use(resumeMutationRateLimit)
.output(applicationDto.addNote.output)
- .handler(async ({ input, context }) => {
- return applicationService.addNote({ id: input.id, userId: context.user.id, text: input.text, date: input.date });
- }),
+ .handler(({ input, context }) =>
+ applicationService.addNote({
+ id: input.id,
+ userId: context.user.id,
+ text: input.text,
+ date: input.date,
+ }),
+ ),
updateTimelineEntry: protectedProcedure
.route({
@@ -187,9 +184,7 @@ export const crudRouter = {
.input(applicationDto.updateTimelineEntry.input)
.use(resumeMutationRateLimit)
.output(applicationDto.updateTimelineEntry.output)
- .handler(async ({ input, context }) => {
- return applicationService.updateTimelineEntry({ ...input, userId: context.user.id });
- }),
+ .handler(({ input, context }) => applicationService.updateTimelineEntry({ ...input, userId: context.user.id })),
deleteTimelineEntry: protectedProcedure
.route({
@@ -205,9 +200,7 @@ export const crudRouter = {
.input(applicationDto.deleteTimelineEntry.input)
.use(resumeMutationRateLimit)
.output(applicationDto.deleteTimelineEntry.output)
- .handler(async ({ input, context }) => {
- return applicationService.deleteTimelineEntry({ ...input, userId: context.user.id });
- }),
+ .handler(({ input, context }) => applicationService.deleteTimelineEntry({ ...input, userId: context.user.id })),
delete: protectedProcedure
.route({
@@ -222,9 +215,7 @@ export const crudRouter = {
.input(applicationDto.delete.input)
.use(resumeMutationRateLimit)
.output(applicationDto.delete.output)
- .handler(async ({ input, context }) => {
- return applicationService.delete({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ input, context }) => applicationService.delete({ id: input.id, userId: context.user.id })),
bulkUpdate: protectedProcedure
.route({
@@ -240,9 +231,7 @@ export const crudRouter = {
.input(applicationDto.bulkUpdate.input)
.use(resumeMutationRateLimit)
.output(applicationDto.bulkUpdate.output)
- .handler(async ({ input, context }) => {
- return applicationService.bulkUpdate({ userId: context.user.id, ...input });
- }),
+ .handler(({ input, context }) => applicationService.bulkUpdate({ userId: context.user.id, ...input })),
bulkDelete: protectedProcedure
.route({
@@ -257,9 +246,7 @@ export const crudRouter = {
.input(applicationDto.bulkDelete.input)
.use(resumeMutationRateLimit)
.output(applicationDto.bulkDelete.output)
- .handler(async ({ input, context }) => {
- return applicationService.bulkDelete({ userId: context.user.id, ids: input.ids });
- }),
+ .handler(({ input, context }) => applicationService.bulkDelete({ userId: context.user.id, ids: input.ids })),
stats: protectedProcedure
.route({
@@ -273,9 +260,7 @@ export const crudRouter = {
})
.input(applicationDto.stats.input)
.output(applicationDto.stats.output)
- .handler(async ({ context }) => {
- return applicationService.stats({ userId: context.user.id });
- }),
+ .handler(({ context }) => applicationService.stats({ userId: context.user.id })),
tags: protectedProcedure
.route({
@@ -288,7 +273,5 @@ export const crudRouter = {
successDescription: "Distinct tags.",
})
.output(applicationDto.tags.output)
- .handler(async ({ context }) => {
- return applicationService.listTags({ userId: context.user.id });
- }),
+ .handler(({ context }) => applicationService.listTags({ userId: context.user.id })),
};
diff --git a/packages/api/src/features/applications/service.ts b/packages/api/src/features/applications/service.ts
index 5ac1f9361..00d4df106 100644
--- a/packages/api/src/features/applications/service.ts
+++ b/packages/api/src/features/applications/service.ts
@@ -47,16 +47,12 @@ function noteEntry(text: string, date?: string): ApplicationTimelineEntry {
return { id: generateId(), type: "note", text, at: date ? atFromDateString(date) : new Date() };
}
-function byNewest(a: ApplicationTimelineEntry, b: ApplicationTimelineEntry) {
- return new Date(b.at).getTime() - new Date(a.at).getTime();
-}
-
function timelineDay(value: Date | string) {
return timelineDate(value).toISOString().slice(0, 10);
}
function sortTimeline(activity: ApplicationTimelineEntry[]): ApplicationTimelineEntry[] {
- return [...activity].sort(byNewest);
+ return [...activity].sort((a, b) => new Date(b.at).getTime() - new Date(a.at).getTime());
}
function currentStageAnchor(activity: ApplicationTimelineEntry[], status: ApplicationStatus) {
@@ -423,7 +419,7 @@ export const applicationService = {
return stripUserId(updated);
},
- updateTimelineEntry: async (input: {
+ updateTimelineEntry: (input: {
id: string;
userId: string;
entryId: string;
@@ -474,7 +470,7 @@ export const applicationService = {
});
},
- deleteTimelineEntry: async (input: { id: string; userId: string; entryId: string }) => {
+ deleteTimelineEntry: (input: { id: string; userId: string; entryId: string }) => {
return db.transaction(async (tx) => {
await tx.execute(sql`
select 1 from ${schema.application}
diff --git a/packages/api/src/features/auth/router.ts b/packages/api/src/features/auth/router.ts
index 68ed99964..44a6721f4 100644
--- a/packages/api/src/features/auth/router.ts
+++ b/packages/api/src/features/auth/router.ts
@@ -15,9 +15,7 @@ export const authRouter = {
"Returns a list of all authentication providers enabled on this Reactive Resume instance, along with their display names. Possible providers include password-based credentials, Google, GitHub, LinkedIn, and custom OAuth. No authentication required.",
successDescription: "A map of enabled authentication provider identifiers to their display names.",
})
- .handler((): ProviderList => {
- return authService.providers.list();
- }),
+ .handler((): ProviderList => authService.providers.list()),
},
exportData: protectedProcedure
@@ -31,9 +29,7 @@ export const authRouter = {
"Returns a JSON-serializable export of the authenticated user's data, including their public profile fields and all of their resumes. Secrets such as password hashes, tokens, and API keys are never included. Requires authentication.",
successDescription: "The user's exported account data.",
})
- .handler(async ({ context }) => {
- return await authService.exportData({ userId: context.user.id });
- }),
+ .handler(({ context }) => authService.exportData({ userId: context.user.id })),
deleteAccount: protectedProcedure
.route({
@@ -46,7 +42,5 @@ export const authRouter = {
"Permanently deletes the authenticated user's account, including all resumes, uploaded files (profile pictures, screenshots, PDFs), and associated data. This action is irreversible. Requires authentication.",
successDescription: "The user account and all associated data have been successfully deleted.",
})
- .handler(async ({ context }): Promise<void> => {
- return await authService.deleteAccount({ userId: context.user.id });
- }),
+ .handler(({ context }) => authService.deleteAccount({ userId: context.user.id })),
};
diff --git a/packages/api/src/features/resume/analysis.ts b/packages/api/src/features/resume/analysis.ts
index c67ff6cd8..7bcfbcc93 100644
--- a/packages/api/src/features/resume/analysis.ts
+++ b/packages/api/src/features/resume/analysis.ts
@@ -17,7 +17,5 @@ export const analysisRouter = {
})
.input(z.object({ id: z.string().describe("The unique identifier of the resume.") }))
.output(storedResumeAnalysisSchema.nullable())
- .handler(async ({ context, input }) => {
- return resumeService.analysis.getById({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => resumeService.analysis.getById({ id: input.id, userId: context.user.id })),
};
diff --git a/packages/api/src/features/resume/crud.ts b/packages/api/src/features/resume/crud.ts
index 3520f703f..9dffcb7ba 100644
--- a/packages/api/src/features/resume/crud.ts
+++ b/packages/api/src/features/resume/crud.ts
@@ -19,13 +19,13 @@ export const crudRouter = {
})
.input(resumeDto.list.input.optional().default({ tags: [], sort: "lastUpdatedAt" }))
.output(resumeDto.list.output)
- .handler(async ({ input, context }) => {
- return resumeService.list({
+ .handler(({ input, context }) =>
+ resumeService.list({
userId: context.user.id,
tags: input.tags,
sort: input.sort,
- });
- }),
+ }),
+ ),
getById: protectedProcedure
.route({
@@ -40,9 +40,7 @@ export const crudRouter = {
})
.input(resumeDto.getById.input)
.output(resumeDto.getById.output)
- .handler(async ({ context, input }) => {
- return resumeService.getById({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => resumeService.getById({ id: input.id, userId: context.user.id })),
create: protectedProcedure
.route({
@@ -64,16 +62,16 @@ export const crudRouter = {
status: 400,
},
})
- .handler(async ({ context, input }) => {
- return resumeService.create({
+ .handler(({ context, input }) =>
+ resumeService.create({
name: input.name,
slug: input.slug,
tags: input.tags,
locale: context.locale,
userId: context.user.id,
...(input.withSampleData ? { data: createSampleResumeData(input.name) } : {}),
- });
- }),
+ }),
+ ),
import: protectedProcedure
.route({
@@ -139,8 +137,8 @@ export const crudRouter = {
status: 400,
},
})
- .handler(async ({ context, input }) => {
- return resumeService.update({
+ .handler(({ context, input }) =>
+ resumeService.update({
id: input.id,
userId: context.user.id,
...(input.name !== undefined ? { name: input.name } : {}),
@@ -148,8 +146,8 @@ export const crudRouter = {
...(input.tags !== undefined ? { tags: input.tags } : {}),
...(input.data !== undefined ? { data: input.data } : {}),
...(input.isPublic !== undefined ? { isPublic: input.isPublic } : {}),
- });
- }),
+ }),
+ ),
patch: protectedProcedure
.route({
@@ -175,14 +173,14 @@ export const crudRouter = {
status: 409,
},
})
- .handler(async ({ context, input }) => {
- return resumeService.patch({
+ .handler(({ context, input }) =>
+ resumeService.patch({
id: input.id,
userId: context.user.id,
operations: input.operations,
...(input.expectedUpdatedAt ? { expectedUpdatedAt: input.expectedUpdatedAt } : {}),
- });
- }),
+ }),
+ ),
setLocked: protectedProcedure
.route({
@@ -198,13 +196,13 @@ export const crudRouter = {
.input(resumeDto.setLocked.input)
.use(resumeMutationRateLimit)
.output(resumeDto.setLocked.output)
- .handler(async ({ context, input }) => {
- return resumeService.setLocked({
+ .handler(({ context, input }) =>
+ resumeService.setLocked({
id: input.id,
userId: context.user.id,
isLocked: input.isLocked,
- });
- }),
+ }),
+ ),
duplicate: protectedProcedure
.route({
@@ -247,7 +245,5 @@ export const crudRouter = {
.input(resumeDto.delete.input)
.use(resumeMutationRateLimit)
.output(resumeDto.delete.output)
- .handler(async ({ context, input }) => {
- return resumeService.delete({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => resumeService.delete({ id: input.id, userId: context.user.id })),
};
diff --git a/packages/api/src/features/resume/export.ts b/packages/api/src/features/resume/export.ts
index 8125dfd2e..7b10b9953 100644
--- a/packages/api/src/features/resume/export.ts
+++ b/packages/api/src/features/resume/export.ts
@@ -75,10 +75,10 @@ export const downloadResumePdfProcedure = protectedProcedure
}),
)
.use(pdfExportRateLimit)
- .handler(async ({ context, input }) => {
- return createResumePdfDownload({
+ .handler(({ context, input }) =>
+ createResumePdfDownload({
id: input.id,
userId: context.user.id,
...(input.target ? { target: input.target } : {}),
- });
- });
+ }),
+ );
diff --git a/packages/api/src/features/resume/service.ts b/packages/api/src/features/resume/service.ts
index 909b13259..1ad489605 100644
--- a/packages/api/src/features/resume/service.ts
+++ b/packages/api/src/features/resume/service.ts
@@ -165,10 +165,7 @@ const tags = {
.from(schema.resume)
.where(eq(schema.resume.userId, input.userId));
- const uniqueTags = new Set(result.flatMap((tag) => tag.tags));
- const sortedTags = Array.from(uniqueTags).sort((a, b) => a.localeCompare(b));
-
- return sortedTags;
+ return [...new Set(result.flatMap((tag) => tag.tags))].sort((a, b) => a.localeCompare(b));
},
};
@@ -422,8 +419,8 @@ export const resumeService = {
},
},
- list: async (input: { userId: string; tags: string[]; sort: "lastUpdatedAt" | "createdAt" | "name" }) => {
- return await db
+ list: (input: { userId: string; tags: string[]; sort: "lastUpdatedAt" | "createdAt" | "name" }) =>
+ db
.select({
id: schema.resume.id,
name: schema.resume.name,
@@ -449,8 +446,7 @@ export const resumeService = {
.with("createdAt", () => asc(schema.resume.createdAt))
.with("name", () => asc(schema.resume.name))
.exhaustive(),
- );
- },
+ ),
getById: async (input: { id: string; userId: string }) => {
const [resume] = await db
diff --git a/packages/api/src/features/resume/sharing.ts b/packages/api/src/features/resume/sharing.ts
index 00718f98d..ccf2b9934 100644
--- a/packages/api/src/features/resume/sharing.ts
+++ b/packages/api/src/features/resume/sharing.ts
@@ -18,13 +18,13 @@ export const sharingRouter = {
})
.input(resumeDto.getBySlug.input)
.output(resumeDto.getBySlug.output)
- .handler(async ({ input, context }) => {
- return resumeService.getBySlug({
+ .handler(({ input, context }) =>
+ resumeService.getBySlug({
...input,
requestHeaders: context.reqHeaders,
...(context.user?.id ? { currentUserId: context.user.id } : {}),
- });
- }),
+ }),
+ ),
setPassword: protectedProcedure
.route({
@@ -40,13 +40,13 @@ export const sharingRouter = {
.input(resumeDto.setPassword.input)
.use(resumeMutationRateLimit)
.output(resumeDto.setPassword.output)
- .handler(async ({ context, input }) => {
- return resumeService.setPassword({
+ .handler(({ context, input }) =>
+ resumeService.setPassword({
id: input.id,
userId: context.user.id,
password: input.password,
- });
- }),
+ }),
+ ),
verifyPassword: publicProcedure
.route({
@@ -68,14 +68,15 @@ export const sharingRouter = {
)
.use(resumePasswordRateLimit)
.output(z.boolean())
- .handler(async ({ context, input }): Promise<boolean> => {
- return resumeService.verifyPassword({
- username: input.username,
- slug: input.slug,
- password: input.password,
- ...(context.resHeaders ? { responseHeaders: context.resHeaders } : {}),
- });
- }),
+ .handler(
+ ({ context, input }): Promise<boolean> =>
+ resumeService.verifyPassword({
+ username: input.username,
+ slug: input.slug,
+ password: input.password,
+ ...(context.resHeaders ? { responseHeaders: context.resHeaders } : {}),
+ }),
+ ),
removePassword: protectedProcedure
.route({
@@ -91,10 +92,10 @@ export const sharingRouter = {
.input(resumeDto.removePassword.input)
.use(resumeMutationRateLimit)
.output(resumeDto.removePassword.output)
- .handler(async ({ context, input }) => {
- return resumeService.removePassword({
+ .handler(({ context, input }) =>
+ resumeService.removePassword({
id: input.id,
userId: context.user.id,
- });
- }),
+ }),
+ ),
};
diff --git a/packages/api/src/features/resume/statistics.ts b/packages/api/src/features/resume/statistics.ts
index 6ced689d1..64727716e 100644
--- a/packages/api/src/features/resume/statistics.ts
+++ b/packages/api/src/features/resume/statistics.ts
@@ -24,9 +24,7 @@ export const resumeStatisticsRouter = {
lastDownloadedAt: z.date().nullable().describe("Timestamp of the last download, or null if never downloaded."),
}),
)
- .handler(async ({ context, input }) => {
- return resumeService.statistics.getById({ id: input.id, userId: context.user.id });
- }),
+ .handler(({ context, input }) => resumeService.statistics.getById({ id: input.id, userId: context.user.id })),
getDailyById: protectedProcedure
.route({
@@ -54,7 +52,11 @@ export const resumeStatisticsRouter = {
}),
),
)
- .handler(async ({ context, input }) => {
- return resumeService.statistics.getDailySeries({ id: input.id, userId: context.user.id, days: input.days });
- }),
+ .handler(({ context, input }) =>
+ resumeService.statistics.getDailySeries({
+ id: input.id,
+ userId: context.user.id,
+ days: input.days,
+ }),
+ ),
};
diff --git a/packages/api/src/features/resume/tags.ts b/packages/api/src/features/resume/tags.ts
index 057b87768..19ac62492 100644
--- a/packages/api/src/features/resume/tags.ts
+++ b/packages/api/src/features/resume/tags.ts
@@ -15,7 +15,5 @@ export const tagsRouter = {
successDescription: "A sorted array of unique tag strings.",
})
.output(z.array(z.string()))
- .handler(async ({ context }) => {
- return resumeService.tags.list({ userId: context.user.id });
- }),
+ .handler(({ context }) => resumeService.tags.list({ userId: context.user.id })),
};
diff --git a/packages/api/src/features/resume/versions.ts b/packages/api/src/features/resume/versions.ts
index 706cb4dc6..c515a1f5f 100644
--- a/packages/api/src/features/resume/versions.ts
+++ b/packages/api/src/features/resume/versions.ts
@@ -17,9 +17,9 @@ export const versionsRouter = {
})
.input(resumeDto.listVersions.input)
.output(resumeDto.listVersions.output)
- .handler(async ({ context, input }) => {
- return resumeService.versions.list({ resumeId: input.resumeId, userId: context.user.id });
- }),
+ .handler(({ context, input }) =>
+ resumeService.versions.list({ resumeId: input.resumeId, userId: context.user.id }),
+ ),
restoreVersion: protectedProcedure
.route({
@@ -35,11 +35,11 @@ export const versionsRouter = {
.input(resumeDto.restoreVersion.input)
.use(resumeMutationRateLimit)
.output(resumeDto.restoreVersion.output)
- .handler(async ({ context, input }) => {
- return resumeService.versions.restore({
+ .handler(({ context, input }) =>
+ resumeService.versions.restore({
resumeId: input.resumeId,
versionId: input.versionId,
userId: context.user.id,
- });
- }),
+ }),
+ ),
};
diff --git a/packages/api/src/features/statistics/router.ts b/packages/api/src/features/statistics/router.ts
index 2851a7e71..49c9094b5 100644
--- a/packages/api/src/features/statistics/router.ts
+++ b/packages/api/src/features/statistics/router.ts
@@ -15,9 +15,7 @@ const userRouter = {
successDescription: "The total number of registered users.",
})
.output(z.number().describe("The total number of registered users."))
- .handler(async (): Promise<number> => {
- return await statisticsService.user.getCount();
- }),
+ .handler(() => statisticsService.user.getCount()),
};
const resumeRouter = {
@@ -33,9 +31,7 @@ const resumeRouter = {
successDescription: "The total number of resumes created.",
})
.output(z.number().describe("The total number of resumes created."))
- .handler(async (): Promise<number> => {
- return await statisticsService.resume.getCount();
- }),
+ .handler(() => statisticsService.resume.getCount()),
};
const githubRouter = {
@@ -51,9 +47,7 @@ const githubRouter = {
successDescription: "The number of GitHub stars for the Reactive Resume repository.",
})
.output(z.number().describe("The number of GitHub stars."))
- .handler(async (): Promise<number> => {
- return await statisticsService.github.getStarCount();
- }),
+ .handler(() => statisticsService.github.getStarCount()),
};
export const statisticsRouter = {
diff --git a/packages/api/src/features/storage/service.ts b/packages/api/src/features/storage/service.ts
index 55f3838e0..63905cb87 100644
--- a/packages/api/src/features/storage/service.ts
+++ b/packages/api/src/features/storage/service.ts
@@ -321,20 +321,13 @@ class S3StorageService implements StorageService {
}
}
-function createStorageService(): StorageService {
- if (env.S3_ACCESS_KEY_ID && env.S3_SECRET_ACCESS_KEY && env.S3_BUCKET) {
- return new S3StorageService();
- }
-
- return new LocalStorageService();
-}
-
let cachedService: StorageService | null = null;
export function getStorageService(): StorageService {
- if (cachedService) return cachedService;
-
- cachedService = createStorageService();
+ cachedService ??=
+ env.S3_ACCESS_KEY_ID && env.S3_SECRET_ACCESS_KEY && env.S3_BUCKET
+ ? new S3StorageService()
+ : new LocalStorageService();
return cachedService;
}
diff --git a/packages/auth/src/config.ts b/packages/auth/src/config.ts
index 8089f92a3..736844735 100644
--- a/packages/auth/src/config.ts
+++ b/packages/auth/src/config.ts
@@ -28,16 +28,16 @@ import { getTrustedOrigins } from "./trusted-origins";
const authBaseUrl = env.APP_URL;
const isRateLimitEnabled = process.env.NODE_ENV === "production" && !env.FLAG_DISABLE_API_RATE_LIMIT;
-function getOAuthAudiences(): string[] {
- const base = authBaseUrl.replace(/\/$/, "");
+const oauthAudienceBase = authBaseUrl.replace(/\/$/, "");
+const OAUTH_AUDIENCES = [
+ oauthAudienceBase,
+ `${oauthAudienceBase}/`,
+ `${oauthAudienceBase}/mcp`,
+ `${oauthAudienceBase}/mcp/`,
+];
- return [base, `${base}/`, `${base}/mcp`, `${base}/mcp/`];
-}
-
-const OAUTH_AUDIENCES = getOAuthAudiences();
-
-export async function verifyOAuthToken(token: string): Promise<JWTPayload> {
- return await verifyAccessToken(token, {
+export function verifyOAuthToken(token: string): Promise<JWTPayload> {
+ return verifyAccessToken(token, {
jwksUrl: `${authBaseUrl}/api/auth/jwks`,
verifyOptions: {
issuer: `${authBaseUrl}/api/auth`,
@@ -105,6 +105,7 @@ const getAuthConfig = () => {
},
hooks: {
+ // biome-ignore lint/suspicious/useAwait: Better Auth requires middleware callbacks to return a Promise.
before: createAuthMiddleware(async (ctx) => {
if (!ctx.path.includes("/oauth2/register")) return;
diff --git a/packages/auth/src/trusted-origins.ts b/packages/auth/src/trusted-origins.ts
index fa5372692..b0d113078 100644
--- a/packages/auth/src/trusted-origins.ts
+++ b/packages/auth/src/trusted-origins.ts
@@ -11,5 +11,5 @@ export function getTrustedOrigins(appUrl: string): string[] {
trustedOrigins.add(normalizeOrigin(configuredUrl.origin));
}
- return Array.from(trustedOrigins);
+ return [...trustedOrigins];
}
diff --git a/packages/db/src/client.ts b/packages/db/src/client.ts
index 591d4a719..cc12c0444 100644
--- a/packages/db/src/client.ts
+++ b/packages/db/src/client.ts
@@ -1,12 +1,10 @@
-import type { NodePgDatabase } from "drizzle-orm/node-postgres";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import { env } from "@reactive-resume/env/server";
-import { relations } from "./relations";
declare global {
var __pool: Pool | undefined;
- var __drizzle: NodePgDatabase<typeof relations> | undefined;
+ var __drizzle: ReturnType<typeof drizzle> | undefined;
}
export function getPool() {
@@ -31,5 +29,5 @@ export function getPool() {
}
// ponytail: two private fns collapsed; getPool() is already a singleton, global cache preserved
-globalThis.__drizzle ??= drizzle({ client: getPool(), relations });
+globalThis.__drizzle ??= drizzle({ client: getPool() });
export const db = globalThis.__drizzle;
diff --git a/packages/db/src/relations.ts b/packages/db/src/relations.ts
deleted file mode 100644
index e96b635ee..000000000
--- a/packages/db/src/relations.ts
+++ /dev/null
@@ -1,221 +0,0 @@
-import { defineRelations } from "drizzle-orm";
-import * as schema from "./schema";
-
-export const relations = defineRelations(schema, (r) => ({
- user: {
- sessions: r.many.session(),
- accounts: r.many.account(),
- twoFactors: r.many.twoFactor(),
- passkeys: r.many.passkey(),
- resumes: r.many.resume(),
- aiProviders: r.many.aiProvider(),
- agentThreads: r.many.agentThread(),
- agentMessages: r.many.agentMessage(),
- agentAttachments: r.many.agentAttachment(),
- agentActions: r.many.agentAction(),
- apiKeys: r.many.apikey(),
- oauthClients: r.many.oauthClient(),
- oauthRefreshTokens: r.many.oauthRefreshToken(),
- oauthAccessTokens: r.many.oauthAccessToken(),
- oauthConsents: r.many.oauthConsent(),
- },
- session: {
- user: r.one.user({
- from: r.session.userId,
- to: r.user.id,
- }),
- oauthRefreshTokens: r.many.oauthRefreshToken({
- from: r.session.id,
- to: r.oauthRefreshToken.sessionId,
- }),
- oauthAccessTokens: r.many.oauthAccessToken({
- from: r.session.id,
- to: r.oauthAccessToken.sessionId,
- }),
- },
- account: {
- user: r.one.user({
- from: r.account.userId,
- to: r.user.id,
- }),
- },
- twoFactor: {
- user: r.one.user({
- from: r.twoFactor.userId,
- to: r.user.id,
- }),
- },
- passkey: {
- user: r.one.user({
- from: r.passkey.userId,
- to: r.user.id,
- }),
- },
- resume: {
- user: r.one.user({
- from: r.resume.userId,
- to: r.user.id,
- }),
- statistics: r.one.resumeStatistics({
- from: r.resume.id,
- to: r.resumeStatistics.resumeId,
- }),
- analysis: r.one.resumeAnalysis({
- from: r.resume.id,
- to: r.resumeAnalysis.resumeId,
- }),
- sourceAgentThreads: r.many.agentThread({
- from: r.resume.id,
- to: r.agentThread.sourceResumeId,
- }),
- workingAgentThreads: r.many.agentThread({
- from: r.resume.id,
- to: r.agentThread.workingResumeId,
- }),
- agentActions: r.many.agentAction({
- from: r.resume.id,
- to: r.agentAction.resumeId,
- }),
- },
- resumeStatistics: {
- resume: r.one.resume({
- from: r.resumeStatistics.resumeId,
- to: r.resume.id,
- }),
- },
- resumeAnalysis: {
- resume: r.one.resume({
- from: r.resumeAnalysis.resumeId,
- to: r.resume.id,
- }),
- },
- aiProvider: {
- user: r.one.user({
- from: r.aiProvider.userId,
- to: r.user.id,
- }),
- threads: r.many.agentThread({
- from: r.aiProvider.id,
- to: r.agentThread.aiProviderId,
- }),
- },
- agentThread: {
- user: r.one.user({
- from: r.agentThread.userId,
- to: r.user.id,
- }),
- aiProvider: r.one.aiProvider({
- from: r.agentThread.aiProviderId,
- to: r.aiProvider.id,
- }),
- sourceResume: r.one.resume({
- from: r.agentThread.sourceResumeId,
- to: r.resume.id,
- }),
- workingResume: r.one.resume({
- from: r.agentThread.workingResumeId,
- to: r.resume.id,
- }),
- messages: r.many.agentMessage(),
- attachments: r.many.agentAttachment(),
- actions: r.many.agentAction(),
- },
- agentMessage: {
- user: r.one.user({
- from: r.agentMessage.userId,
- to: r.user.id,
- }),
- thread: r.one.agentThread({
- from: r.agentMessage.threadId,
- to: r.agentThread.id,
- }),
- attachments: r.many.agentAttachment(),
- actions: r.many.agentAction(),
- },
- agentAttachment: {
- user: r.one.user({
- from: r.agentAttachment.userId,
- to: r.user.id,
- }),
- thread: r.one.agentThread({
- from: r.agentAttachment.threadId,
- to: r.agentThread.id,
- }),
- message: r.one.agentMessage({
- from: r.agentAttachment.messageId,
- to: r.agentMessage.id,
- }),
- },
- agentAction: {
- user: r.one.user({
- from: r.agentAction.userId,
- to: r.user.id,
- }),
- thread: r.one.agentThread({
- from: r.agentAction.threadId,
- to: r.agentThread.id,
- }),
- message: r.one.agentMessage({
- from: r.agentAction.messageId,
- to: r.agentMessage.id,
- }),
- resume: r.one.resume({
- from: r.agentAction.resumeId,
- to: r.resume.id,
- }),
- },
- apikey: {
- user: r.one.user({
- from: r.apikey.referenceId,
- to: r.user.id,
- }),
- },
- oauthClient: {
- user: r.one.user({
- from: r.oauthClient.userId,
- to: r.user.id,
- }),
- oauthRefreshTokens: r.many.oauthRefreshToken({
- from: r.oauthClient.clientId,
- to: r.oauthRefreshToken.clientId,
- }),
- oauthAccessTokens: r.many.oauthAccessToken({
- from: r.oauthClient.clientId,
- to: r.oauthAccessToken.clientId,
- }),
- oauthConsents: r.many.oauthConsent({
- from: r.oauthClient.clientId,
- to: r.oauthConsent.clientId,
- }),
- },
- oauthRefreshToken: {
- user: r.one.user({
- from: r.oauthRefreshToken.userId,
- to: r.user.id,
- }),
- session: r.one.session({
- from: r.oauthRefreshToken.sessionId,
- to: r.session.id,
- }),
- },
- oauthAccessToken: {
- user: r.one.user({
- from: r.oauthAccessToken.userId,
- to: r.user.id,
- }),
- session: r.one.session({
- from: r.oauthAccessToken.sessionId,
- to: r.session.id,
- }),
- refreshToken: r.one.oauthRefreshToken({
- from: r.oauthAccessToken.refreshId,
- to: r.oauthRefreshToken.id,
- }),
- },
- oauthConsent: {
- user: r.one.user({
- from: r.oauthConsent.userId,
- to: r.user.id,
- }),
- },
-}));
diff --git a/packages/docx/src/builder.ts b/packages/docx/src/builder.ts
index 697130a23..e79630032 100644
--- a/packages/docx/src/builder.ts
+++ b/packages/docx/src/builder.ts
@@ -43,27 +43,9 @@ function ptToTwips(pt: number): number {
return Math.round(pt * 20);
}
-// --- Page size constants (in mm) ---
-
-interface PageSize {
- width: number;
- height: number;
-}
-
-const DEFAULT_PAGE_SIZE: PageSize = { width: 210, height: 297 };
-
-const PAGE_SIZES = {
- a4: DEFAULT_PAGE_SIZE,
- letter: { width: 215.9, height: 279.4 },
-} satisfies Record<string, PageSize>;
-
-type DocxPageFormat = keyof typeof PAGE_SIZES;
-
-const resolveDocxPageFormat = (format: ResumeData["metadata"]["page"]["format"]): DocxPageFormat => {
- if (format === "letter") return "letter";
-
- return "a4";
-};
+// DOCX has fixed pages; free-form resumes intentionally fall back to A4.
+const A4_PAGE_SIZE = { width: 210, height: 297 };
+const LETTER_PAGE_SIZE = { width: 215.9, height: 279.4 };
// --- Invisible border preset for table cells ---
@@ -103,12 +85,6 @@ const TEMPLATE_CONFIGS: Record<Template, TemplateConfig> = {
scizor: { sidebarSide: "left", sidebarBackground: "none", headerPosition: "full-width" },
};
-const DEFAULT_TEMPLATE_CONFIG: TemplateConfig = {
- sidebarSide: "left",
- sidebarBackground: "none",
- headerPosition: "full-width",
-};
-
/**
* Blends a hex color toward white at the given opacity (0-1).
* Used to approximate CSS `background-color: rgba(r,g,b, 0.2)` on a white background.
@@ -376,7 +352,7 @@ export function buildDocument(data: ResumeData, resolveTitle?: SectionTitleResol
const lineSpacing = Math.round(data.metadata.typography.body.lineHeight * 240);
const { page } = data.metadata;
- const pageSize = PAGE_SIZES[resolveDocxPageFormat(page.format)];
+ const pageSize = page.format === "letter" ? LETTER_PAGE_SIZE : A4_PAGE_SIZE;
// Margins and gaps are defined in points (pt), not mm
const marginXTwips = ptToTwips(page.marginX);
const marginYTwips = ptToTwips(page.marginY);
@@ -385,7 +361,7 @@ export function buildDocument(data: ResumeData, resolveTitle?: SectionTitleResol
const sidebarWidth = data.metadata.layout.sidebarWidth;
// Template-aware layout config
- const templateConfig = TEMPLATE_CONFIGS[data.metadata.template] ?? DEFAULT_TEMPLATE_CONFIG;
+ const templateConfig = TEMPLATE_CONFIGS[data.metadata.template];
// Compute sidebar background shading hex
let sidebarShadingHex: string | undefined;
diff --git a/packages/docx/src/index.test.ts b/packages/docx/src/index.test.ts
index c914a7d98..b5b68a591 100644
--- a/packages/docx/src/index.test.ts
+++ b/packages/docx/src/index.test.ts
@@ -20,4 +20,11 @@ describe("buildDocx", () => {
const blob = await buildDocx(data);
expect(blob.size).toBeGreaterThan(0);
});
+
+ it("returns a rejected Promise when document building fails synchronously", async () => {
+ const promise = buildDocx(undefined as never);
+
+ expect(promise).toBeInstanceOf(Promise);
+ await expect(promise).rejects.toThrow();
+ });
});
diff --git a/packages/docx/src/index.ts b/packages/docx/src/index.ts
index 0139229cc..25bae2697 100644
--- a/packages/docx/src/index.ts
+++ b/packages/docx/src/index.ts
@@ -7,6 +7,7 @@ import { buildDocument } from "./builder";
* Builds a DOCX file from resume data and returns it as a Blob. Pass `resolveTitle` to fill in
* locale-aware section headings (titles are stored empty and resolved at render time).
*/
+// biome-ignore lint/suspicious/useAwait: keep synchronous renderer errors on the public Promise rejection path.
export async function buildDocx(data: ResumeData, resolveTitle?: SectionTitleResolver): Promise<Blob> {
const doc = buildDocument(data, resolveTitle);
return Packer.toBlob(doc);
diff --git a/packages/email/src/templates/reset-password.tsx b/packages/email/src/templates/reset-password.tsx
index 8864a1a18..0825b0473 100644
--- a/packages/email/src/templates/reset-password.tsx
+++ b/packages/email/src/templates/reset-password.tsx
@@ -1,15 +1,7 @@
import { ResetPasswordEmail } from "./auth";
-interface ResetPasswordTemplateProps {
- url: string;
-}
-
-const ResetPasswordTemplate = ({ url }: ResetPasswordTemplateProps) => {
- return <ResetPasswordEmail url={url} />;
-};
-
-export default Object.assign(ResetPasswordTemplate, {
+export default Object.assign(ResetPasswordEmail, {
PreviewProps: {
url: "https://localhost:3000/auth/reset-password?token=example-token",
- } satisfies ResetPasswordTemplateProps,
+ } satisfies Parameters<typeof ResetPasswordEmail>[0],
});
diff --git a/packages/email/src/templates/verify-email-change.tsx b/packages/email/src/templates/verify-email-change.tsx
index 6d7b4be8e..32620ca9d 100644
--- a/packages/email/src/templates/verify-email-change.tsx
+++ b/packages/email/src/templates/verify-email-change.tsx
@@ -1,19 +1,9 @@
import { VerifyEmailChange } from "./auth";
-interface VerifyEmailChangeTemplateProps {
- url: string;
- previousEmail: string;
- newEmail: string;
-}
-
-const VerifyEmailChangeTemplate = ({ url, previousEmail, newEmail }: VerifyEmailChangeTemplateProps) => {
- return <VerifyEmailChange url={url} previousEmail={previousEmail} newEmail={newEmail} />;
-};
-
-export default Object.assign(VerifyEmailChangeTemplate, {
+export default Object.assign(VerifyEmailChange, {
PreviewProps: {
url: "https://localhost:3000/auth/verify-email-change?token=example-token",
previousEmail: "[email protected]",
newEmail: "[email protected]",
- } satisfies VerifyEmailChangeTemplateProps,
+ } satisfies Parameters<typeof VerifyEmailChange>[0],
});
diff --git a/packages/email/src/templates/verify-email.tsx b/packages/email/src/templates/verify-email.tsx
index 35798fbff..a325678e4 100644
--- a/packages/email/src/templates/verify-email.tsx
+++ b/packages/email/src/templates/verify-email.tsx
@@ -1,15 +1,7 @@
import { VerifyEmail } from "./auth";
-interface VerifyEmailTemplateProps {
- url: string;
-}
-
-const VerifyEmailTemplate = ({ url }: VerifyEmailTemplateProps) => {
- return <VerifyEmail url={url} />;
-};
-
-export default Object.assign(VerifyEmailTemplate, {
+export default Object.assign(VerifyEmail, {
PreviewProps: {
url: "https://localhost:3000/auth/verify-email?token=example-token",
- } satisfies VerifyEmailTemplateProps,
+ } satisfies Parameters<typeof VerifyEmail>[0],
});
diff --git a/packages/email/src/transport.ts b/packages/email/src/transport.ts
index e072546e1..668ca02ff 100644
--- a/packages/email/src/transport.ts
+++ b/packages/email/src/transport.ts
@@ -13,17 +13,14 @@ type SendEmailOptions = {
from?: string;
};
-const isSmtpEnabled = () => {
- return !!env.SMTP_HOST && !!env.SMTP_USER && !!env.SMTP_PASS && !!env.SMTP_FROM;
-};
+const isSmtpEnabled = () => !!env.SMTP_HOST && !!env.SMTP_USER && !!env.SMTP_PASS && !!env.SMTP_FROM;
let cachedTransport: Transporter | undefined;
const getTransport = () => {
if (!isSmtpEnabled()) return;
- if (cachedTransport) return cachedTransport;
- cachedTransport = nodemailer.createTransport({
+ cachedTransport ??= nodemailer.createTransport({
host: env.SMTP_HOST,
port: env.SMTP_PORT,
secure: env.SMTP_SECURE,
diff --git a/packages/fonts/src/index.ts b/packages/fonts/src/index.ts
index 07b0c89a1..de131e471 100644
--- a/packages/fonts/src/index.ts
+++ b/packages/fonts/src/index.ts
@@ -91,13 +91,9 @@ export const standardFontList = standardPdfFontList.filter((font) => !webFontMap
const fontMap = new Map<string, FontRecord>();
const chinesePrioritySet = new Set<string>(preferredChineseFontFamilies);
-function orderFonts(fonts: FontRecord[]) {
- return [...fonts].sort((a, b) => {
- return a.family.localeCompare(b.family, undefined, { sensitivity: "base" });
- });
-}
-
-export const fontList = orderFonts([...standardFontList, ...webFontList]);
+export const fontList = [...standardFontList, ...webFontList].sort((a, b) =>
+ a.family.localeCompare(b.family, undefined, { sensitivity: "base" }),
+);
for (const font of fontList) {
fontMap.set(font.family, font);
@@ -127,10 +123,6 @@ export function getFont(family: string) {
return alias ? fontMap.get(alias) : undefined;
}
-function getFontCategory(family: string): FontCategory | null {
- return getFont(family)?.category ?? null;
-}
-
export function getFontDisplayName(family: string) {
return fontDisplayNames[family] ?? family;
}
@@ -185,7 +177,7 @@ export function getPdfFallbackFontFamilies(
family: string,
options: { locale?: Locale; scripts?: Iterable<Script> } = {},
): string[] {
- const category = getFontCategory(family);
+ const category = getFont(family)?.category ?? null;
const ordered: Script[] = [];
const localeScript = getLocaleScript(options.locale);
diff --git a/packages/import/src/json-resume.tsx b/packages/import/src/json-resume.tsx
index 9b050cdc9..9a8ac661c 100644
--- a/packages/import/src/json-resume.tsx
+++ b/packages/import/src/json-resume.tsx
@@ -162,19 +162,6 @@ const jsonResumeSchema = z.looseObject({
});
type JSONResume = z.infer<typeof jsonResumeSchema>;
-type JSONResumeLocation = z.infer<typeof locationSchema>;
-
-// Helper function to format location object to string
-function formatLocation(location?: JSONResumeLocation): string {
- if (!location) return "";
-
- const parts: string[] = [];
- if (location.city) parts.push(location.city);
- if (location.region) parts.push(location.region);
- if (location.countryCode) parts.push(location.countryCode);
-
- return parts.join(", ");
-}
// ponytail: stateless two-method class → two plain functions
function convertJSONResume(jsonResume: JSONResume): ResumeData {
@@ -190,7 +177,9 @@ function convertJSONResume(jsonResume: JSONResume): ResumeData {
headline: basics.label || "",
email: basics.email || "",
phone: basics.phone || "",
- location: basics.location ? formatLocation(basics.location) : "",
+ location: [basics.location?.city, basics.location?.region, basics.location?.countryCode]
+ .filter(Boolean)
+ .join(", "),
website: createUrl(basics.url),
customFields: [],
};
diff --git a/packages/mcp/package.json b/packages/mcp/package.json
index 98a402f87..deed73432 100644
--- a/packages/mcp/package.json
+++ b/packages/mcp/package.json
@@ -5,11 +5,7 @@
"private": true,
"exports": {
".": "./src/index.ts",
- "./server-card": "./src/mcp-server-card.ts",
- "./tool-names": "./src/mcp-tool-names.ts",
- "./tools": "./src/tools.ts",
- "./prompts": "./src/prompts.ts",
- "./resources": "./src/resources.ts"
+ "./server-card": "./src/mcp-server-card.ts"
},
"scripts": {
"typecheck": "tsgo --noEmit",
diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts
index 837d42d77..7b75163d7 100644
--- a/packages/mcp/src/index.ts
+++ b/packages/mcp/src/index.ts
@@ -1,4 +1,3 @@
-export { buildMcpServerCard } from "./mcp-server-card";
export { MCP_TOOL_NAME } from "./mcp-tool-names";
export { registerPrompts } from "./prompts";
export { registerResources } from "./resources";
diff --git a/packages/mcp/src/mcp-server-card.test.ts b/packages/mcp/src/mcp-server-card.test.ts
index e7f47a1f3..21a90cd36 100644
--- a/packages/mcp/src/mcp-server-card.test.ts
+++ b/packages/mcp/src/mcp-server-card.test.ts
@@ -98,9 +98,9 @@ describe("buildMcpServerCard", () => {
true,
);
expect(autofill.safeParse({ sourceUrl: "http://example.com/job" }).success).toBe(true);
- expect(create.safeParse({ company: "Acme", role: "Engineer", sourceUrl: "ftp://example.com/job" }).success).toBe(
- false,
- );
+ const invalidUrl = create.safeParse({ company: "Acme", role: "Engineer", sourceUrl: "ftp://example.com/job" });
+ expect(invalidUrl.success).toBe(false);
+ if (!invalidUrl.success) expect(invalidUrl.error.issues[0]?.message).toBe("URL must use http or https.");
expect(autofill.safeParse({ sourceUrl: "javascript:alert(1)" }).success).toBe(false);
});
diff --git a/packages/mcp/src/prompts.ts b/packages/mcp/src/prompts.ts
index 3495e5510..33e727e5a 100644
--- a/packages/mcp/src/prompts.ts
+++ b/packages/mcp/src/prompts.ts
@@ -72,7 +72,7 @@ export function registerPrompts(server: McpServer) {
description: "Guide the user step-by-step through building a resume from scratch, section by section.",
argsSchema: { id: resumeIdArg },
},
- async ({ id }) => ({
+ ({ id }) => ({
messages: [
...resumeContext(id),
{
@@ -113,7 +113,7 @@ export function registerPrompts(server: McpServer) {
description: "Review resume content and suggest concrete improvements to wording, impact, and structure.",
argsSchema: { id: resumeIdArg },
},
- async ({ id }) => ({
+ ({ id }) => ({
messages: [
...resumeContext(id),
{
@@ -158,7 +158,7 @@ export function registerPrompts(server: McpServer) {
"Get a structured, professional critique with a scorecard and prioritized recommendations. Read-only — no changes are made.",
argsSchema: { id: resumeIdArg },
},
- async ({ id }) => ({
+ ({ id }) => ({
messages: [
...resumeContext(id),
{
diff --git a/packages/mcp/src/resources.ts b/packages/mcp/src/resources.ts
index 54770adce..de19db693 100644
--- a/packages/mcp/src/resources.ts
+++ b/packages/mcp/src/resources.ts
@@ -58,7 +58,7 @@ export function registerResources(server: McpServer, client: RouterClient<typeof
"custom sections, and metadata (template, layout, typography, colors, CSS).",
].join(" "),
},
- async (uri: URL) => ({
+ (uri: URL) => ({
contents: [
{
uri: uri.href,
diff --git a/packages/mcp/src/tool-annotations.test.ts b/packages/mcp/src/tool-annotations.test.ts
index deb89c299..3c78c6f4d 100644
--- a/packages/mcp/src/tool-annotations.test.ts
+++ b/packages/mcp/src/tool-annotations.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { MCP_TOOL_NAME } from "./mcp-tool-names";
-import { TOOL_ANNOTATIONS } from "./tool-annotations";
+import { TOOL_META } from "./tool-meta";
describe("MCP_TOOL_NAME", () => {
it("uses canonical unprefixed snake_case tool names", () => {
@@ -29,10 +29,10 @@ describe("MCP_TOOL_NAME", () => {
});
});
-describe("TOOL_ANNOTATIONS", () => {
+describe("tool annotations", () => {
it("provides annotations for every registered tool", () => {
for (const name of Object.values(MCP_TOOL_NAME)) {
- expect(TOOL_ANNOTATIONS[name]).toBeDefined();
+ expect(TOOL_META[name].annotations).toBeDefined();
}
});
@@ -49,7 +49,7 @@ describe("TOOL_ANNOTATIONS", () => {
MCP_TOOL_NAME.getApplicationStats,
];
for (const name of readOnlyTools) {
- const annotations = TOOL_ANNOTATIONS[name];
+ const annotations = TOOL_META[name].annotations;
expect(annotations.readOnlyHint, name).toBe(true);
expect(annotations.destructiveHint, name).toBe(false);
expect(annotations.idempotentHint, name).toBe(true);
@@ -57,14 +57,14 @@ describe("TOOL_ANNOTATIONS", () => {
});
it("marks PDF download URL generation as read-only but non-idempotent", () => {
- const annotations = TOOL_ANNOTATIONS[MCP_TOOL_NAME.downloadResumePdf];
+ const annotations = TOOL_META[MCP_TOOL_NAME.downloadResumePdf].annotations;
expect(annotations.readOnlyHint).toBe(true);
expect(annotations.idempotentHint).toBe(false);
expect(annotations.destructiveHint).toBe(false);
});
it("marks deleteResume as destructive (but still idempotent)", () => {
- const annotations = TOOL_ANNOTATIONS[MCP_TOOL_NAME.deleteResume];
+ const annotations = TOOL_META[MCP_TOOL_NAME.deleteResume].annotations;
expect(annotations.destructiveHint).toBe(true);
expect(annotations.idempotentHint).toBe(true);
expect(annotations.readOnlyHint).toBe(false);
@@ -72,7 +72,7 @@ describe("TOOL_ANNOTATIONS", () => {
it("marks application delete tools as destructive", () => {
for (const name of [MCP_TOOL_NAME.deleteApplication, MCP_TOOL_NAME.bulkDeleteApplications]) {
- const annotations = TOOL_ANNOTATIONS[name];
+ const annotations = TOOL_META[name].annotations;
expect(annotations.readOnlyHint, name).toBe(false);
expect(annotations.destructiveHint, name).toBe(true);
}
@@ -86,7 +86,7 @@ describe("TOOL_ANNOTATIONS", () => {
MCP_TOOL_NAME.patchResume,
MCP_TOOL_NAME.updateResume,
]) {
- const annotations = TOOL_ANNOTATIONS[name];
+ const annotations = TOOL_META[name].annotations;
expect(annotations.readOnlyHint, name).toBe(false);
expect(annotations.idempotentHint, name).toBe(false);
expect(annotations.destructiveHint, name).toBe(false);
@@ -95,7 +95,7 @@ describe("TOOL_ANNOTATIONS", () => {
it("marks lockResume / unlockResume as idempotent and non-destructive", () => {
for (const name of [MCP_TOOL_NAME.lockResume, MCP_TOOL_NAME.unlockResume]) {
- const annotations = TOOL_ANNOTATIONS[name];
+ const annotations = TOOL_META[name].annotations;
expect(annotations.idempotentHint, name).toBe(true);
expect(annotations.destructiveHint, name).toBe(false);
expect(annotations.readOnlyHint, name).toBe(false);
@@ -103,11 +103,11 @@ describe("TOOL_ANNOTATIONS", () => {
});
it("marks only job-posting autofill as open-world", () => {
- expect(TOOL_ANNOTATIONS[MCP_TOOL_NAME.autofillApplicationFromJob].openWorldHint).toBe(true);
+ expect(TOOL_META[MCP_TOOL_NAME.autofillApplicationFromJob].annotations.openWorldHint).toBe(true);
});
it("declares no tools as open-world by default", () => {
- for (const [name, annotations] of Object.entries(TOOL_ANNOTATIONS)) {
+ for (const [name, { annotations }] of Object.entries(TOOL_META)) {
if (name === MCP_TOOL_NAME.autofillApplicationFromJob) continue;
expect(annotations.openWorldHint).toBe(false);
}
diff --git a/packages/mcp/src/tool-annotations.ts b/packages/mcp/src/tool-annotations.ts
deleted file mode 100644
index 6ba065b8b..000000000
--- a/packages/mcp/src/tool-annotations.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
-import { MCP_TOOL_NAME } from "./mcp-tool-names";
-
-type McpRegisteredToolName = (typeof MCP_TOOL_NAME)[keyof typeof MCP_TOOL_NAME];
-
-// ponytail: 5 distinct annotation shapes shared across 14 tools
-const READ_IDEMPOTENT: ToolAnnotations = {
- readOnlyHint: true,
- destructiveHint: false,
- idempotentHint: true,
- openWorldHint: false,
-};
-const READ_NON_IDEMPOTENT: ToolAnnotations = {
- readOnlyHint: true,
- destructiveHint: false,
- idempotentHint: false,
- openWorldHint: false,
-};
-const READ_OPEN_WORLD_NON_IDEMPOTENT: ToolAnnotations = {
- readOnlyHint: true,
- destructiveHint: false,
- idempotentHint: false,
- openWorldHint: true,
-};
-const WRITE_NON_IDEMPOTENT: ToolAnnotations = {
- readOnlyHint: false,
- destructiveHint: false,
- idempotentHint: false,
- openWorldHint: false,
-};
-const WRITE_DESTRUCTIVE: ToolAnnotations = {
- readOnlyHint: false,
- destructiveHint: true,
- idempotentHint: true,
- openWorldHint: false,
-};
-const WRITE_IDEMPOTENT: ToolAnnotations = {
- readOnlyHint: false,
- destructiveHint: false,
- idempotentHint: true,
- openWorldHint: false,
-};
-
-/** Tool behavior hints for MCP `tools/list` and the static server card. */
-export const TOOL_ANNOTATIONS: Record<McpRegisteredToolName, ToolAnnotations> = {
- [MCP_TOOL_NAME.listResumes]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.listResumeTags]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.getResume]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.getResumeAnalysis]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.downloadResumePdf]: READ_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.createResume]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.importResume]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.duplicateResume]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.patchResume]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.updateResume]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.deleteResume]: WRITE_DESTRUCTIVE,
- [MCP_TOOL_NAME.lockResume]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.unlockResume]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.getResumeStatistics]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.listApplications]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.readApplication]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.listApplicationTags]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.getApplicationStats]: READ_IDEMPOTENT,
- [MCP_TOOL_NAME.createApplication]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.updateApplication]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.addApplicationNote]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.updateApplicationTimelineEntry]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.deleteApplicationTimelineEntry]: WRITE_DESTRUCTIVE,
- [MCP_TOOL_NAME.deleteApplication]: WRITE_DESTRUCTIVE,
- [MCP_TOOL_NAME.bulkUpdateApplications]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.bulkDeleteApplications]: WRITE_DESTRUCTIVE,
- [MCP_TOOL_NAME.importApplications]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.attachApplicationDocument]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.removeApplicationDocument]: WRITE_IDEMPOTENT,
- [MCP_TOOL_NAME.autofillApplicationFromJob]: READ_OPEN_WORLD_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.scoreApplicationMatch]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.tailorResumeForApplication]: WRITE_NON_IDEMPOTENT,
- [MCP_TOOL_NAME.draftApplicationMessage]: READ_NON_IDEMPOTENT,
-};
diff --git a/packages/mcp/src/tool-meta.ts b/packages/mcp/src/tool-meta.ts
index a2d642b9b..db75658ef 100644
--- a/packages/mcp/src/tool-meta.ts
+++ b/packages/mcp/src/tool-meta.ts
@@ -2,13 +2,49 @@
* Canonical tool metadata (title, description, inputSchema, annotations) declared once.
* Consumed by both `registerTools` (raw Zod) and `buildMcpServerCard` (toJsonSchemaCompat).
*/
+import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
import z from "zod";
import { resumePatchOperationsSchema } from "@reactive-resume/ai/tools/resume-tool-contracts";
import { applicationStatusSchema, contactSchema } from "@reactive-resume/schema/applications/data";
import { MCP_TOOL_NAME as T } from "./mcp-tool-names";
-import { TOOL_ANNOTATIONS } from "./tool-annotations";
const MAX_APPLICATION_DOCUMENT_BYTES = 10 * 1024 * 1024;
+const READ_IDEMPOTENT: ToolAnnotations = {
+ readOnlyHint: true,
+ destructiveHint: false,
+ idempotentHint: true,
+ openWorldHint: false,
+};
+const READ_NON_IDEMPOTENT: ToolAnnotations = {
+ readOnlyHint: true,
+ destructiveHint: false,
+ idempotentHint: false,
+ openWorldHint: false,
+};
+const READ_OPEN_WORLD_NON_IDEMPOTENT: ToolAnnotations = {
+ readOnlyHint: true,
+ destructiveHint: false,
+ idempotentHint: false,
+ openWorldHint: true,
+};
+const WRITE_NON_IDEMPOTENT: ToolAnnotations = {
+ readOnlyHint: false,
+ destructiveHint: false,
+ idempotentHint: false,
+ openWorldHint: false,
+};
+const WRITE_DESTRUCTIVE: ToolAnnotations = {
+ readOnlyHint: false,
+ destructiveHint: true,
+ idempotentHint: true,
+ openWorldHint: false,
+};
+const WRITE_IDEMPOTENT: ToolAnnotations = {
+ readOnlyHint: false,
+ destructiveHint: false,
+ idempotentHint: true,
+ openWorldHint: false,
+};
// ponytail: shared schema fragment; exported so server-card can re-use without re-importing
const resumeIdSchema = z.string().min(1).describe(`Resume ID. Use \`${T.listResumes}\` to find valid IDs.`);
@@ -22,14 +58,7 @@ const timelineDateSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "Date must us
const httpUrlSchema = z
.string()
.trim()
- .refine((value) => {
- try {
- const parsed = new URL(value);
- return parsed.protocol === "http:" || parsed.protocol === "https:";
- } catch {
- return false;
- }
- }, "URL must use http or https.");
+ .pipe(z.url({ protocol: /^https?$/, error: "URL must use http or https." }));
const pdfBase64Schema = z
.string()
.min(1)
@@ -98,7 +127,7 @@ export const TOOL_META = {
.default("lastUpdatedAt")
.describe("Sort order for results. Default: lastUpdatedAt."),
}),
- annotations: TOOL_ANNOTATIONS[T.listResumes],
+ annotations: READ_IDEMPOTENT,
},
[T.listResumeTags]: {
title: "List Resume Tags",
@@ -107,7 +136,7 @@ export const TOOL_META = {
"Useful for choosing tag filters when calling list tools or keeping naming consistent.",
].join("\n"),
inputSchema: z.object({}),
- annotations: TOOL_ANNOTATIONS[T.listResumeTags],
+ annotations: READ_IDEMPOTENT,
},
[T.getResume]: {
title: "Read Resume",
@@ -122,7 +151,7 @@ export const TOOL_META = {
"The `resume://_meta/schema` resource describes the full data structure for JSON Patch paths.",
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.getResume],
+ annotations: READ_IDEMPOTENT,
},
[T.getResumeAnalysis]: {
title: "Get Resume Analysis",
@@ -132,7 +161,7 @@ export const TOOL_META = {
`Returns JSON or a short message if none exists. Use \`${T.listResumes}\` to find resume IDs.`,
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.getResumeAnalysis],
+ annotations: READ_IDEMPOTENT,
},
[T.downloadResumePdf]: {
title: "Download Resume PDF",
@@ -143,7 +172,7 @@ export const TOOL_META = {
`Use \`${T.listResumes}\` first to find valid IDs.`,
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.downloadResumePdf],
+ annotations: READ_NON_IDEMPOTENT,
},
[T.createResume]: {
title: "Create Resume",
@@ -168,7 +197,7 @@ export const TOOL_META = {
.describe("Tags to categorize the resume (e.g. ['tech', 'senior'])"),
withSampleData: z.boolean().optional().default(false).describe("Pre-fill with sample data. Default: false."),
}),
- annotations: TOOL_ANNOTATIONS[T.createResume],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.importResume]: {
title: "Import Resume",
@@ -183,7 +212,7 @@ export const TOOL_META = {
.unknown()
.describe("Complete ResumeData JSON (same shape as `read_resume` body or `resume://_meta/schema`)."),
}),
- annotations: TOOL_ANNOTATIONS[T.importResume],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.duplicateResume]: {
title: "Duplicate Resume",
@@ -200,7 +229,7 @@ export const TOOL_META = {
slug: z.string().min(1).max(64).describe("URL-friendly slug for the duplicate (must be unique)"),
tags: z.array(z.string()).optional().default([]).describe("Tags for the duplicate"),
}),
- annotations: TOOL_ANNOTATIONS[T.duplicateResume],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.patchResume]: {
title: "Apply Resume Patch",
@@ -231,7 +260,7 @@ export const TOOL_META = {
id: resumeIdSchema,
operations: resumePatchOperationsSchema,
}),
- annotations: TOOL_ANNOTATIONS[T.patchResume],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.updateResume]: {
title: "Update Resume (metadata)",
@@ -255,7 +284,7 @@ export const TOOL_META = {
"When true, anyone with the link can view the public resume (subject to password if set in the app).",
),
}),
- annotations: TOOL_ANNOTATIONS[T.updateResume],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.deleteResume]: {
title: "Delete Resume",
@@ -266,7 +295,7 @@ export const TOOL_META = {
`Consider using \`${T.duplicateResume}\` to create a backup before deleting.`,
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.deleteResume],
+ annotations: WRITE_DESTRUCTIVE,
},
[T.lockResume]: {
title: "Lock Resume",
@@ -278,13 +307,13 @@ export const TOOL_META = {
`Use \`${T.unlockResume}\` to re-enable editing.`,
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.lockResume],
+ annotations: WRITE_IDEMPOTENT,
},
[T.unlockResume]: {
title: "Unlock Resume",
description: "Unlock a previously locked resume, re-enabling edits, patches, and deletion.",
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.unlockResume],
+ annotations: WRITE_IDEMPOTENT,
},
[T.getResumeStatistics]: {
title: "Get Resume Statistics",
@@ -295,7 +324,7 @@ export const TOOL_META = {
"lastViewedAt (timestamp or null), lastDownloadedAt (timestamp or null).",
].join("\n"),
inputSchema: z.object({ id: resumeIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.getResumeStatistics],
+ annotations: READ_IDEMPOTENT,
},
[T.listApplications]: {
title: "List Applications",
@@ -306,31 +335,31 @@ export const TOOL_META = {
tags: z.array(z.string()).optional().default([]),
includeArchived: z.boolean().optional().default(false),
}),
- annotations: TOOL_ANNOTATIONS[T.listApplications],
+ annotations: READ_IDEMPOTENT,
},
[T.readApplication]: {
title: "Read Application",
description: "Read one full job application, including contacts, document URLs, follow-up details, and timeline.",
inputSchema: z.object({ id: applicationIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.readApplication],
+ annotations: READ_IDEMPOTENT,
},
[T.listApplicationTags]: {
title: "List Application Tags",
description: "Return every distinct tag used across job applications.",
inputSchema: z.object({}),
- annotations: TOOL_ANNOTATIONS[T.listApplicationTags],
+ annotations: READ_IDEMPOTENT,
},
[T.getApplicationStats]: {
title: "Get Application Stats",
description: "Return aggregate application counts by pipeline stage and source for insights.",
inputSchema: z.object({}),
- annotations: TOOL_ANNOTATIONS[T.getApplicationStats],
+ annotations: READ_IDEMPOTENT,
},
[T.createApplication]: {
title: "Create Application",
description: "Create a tracked job application. Company and role are required.",
inputSchema: createApplicationSchema,
- annotations: TOOL_ANNOTATIONS[T.createApplication],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.updateApplication]: {
title: "Update Application",
@@ -341,7 +370,7 @@ export const TOOL_META = {
...applicationMutableFieldsSchema,
archived: z.boolean().optional().describe("Whether the application is hidden from active views."),
}),
- annotations: TOOL_ANNOTATIONS[T.updateApplication],
+ annotations: WRITE_IDEMPOTENT,
},
[T.addApplicationNote]: {
title: "Add Application Note",
@@ -351,7 +380,7 @@ export const TOOL_META = {
text: z.string().min(1),
date: timelineDateSchema.optional().describe("Optional note date in YYYY-MM-DD format."),
}),
- annotations: TOOL_ANNOTATIONS[T.addApplicationNote],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.updateApplicationTimelineEntry]: {
title: "Update Application Timeline Entry",
@@ -364,19 +393,19 @@ export const TOOL_META = {
text: z.string().min(1).optional().describe("Replacement note text. Only note entries can change text."),
})
.refine((value) => value.date !== undefined || value.text !== undefined, "Provide date or text to update."),
- annotations: TOOL_ANNOTATIONS[T.updateApplicationTimelineEntry],
+ annotations: WRITE_IDEMPOTENT,
},
[T.deleteApplicationTimelineEntry]: {
title: "Delete Application Timeline Entry",
description: "Delete a note or older stage entry. The current stage entry cannot be deleted.",
inputSchema: z.object({ id: applicationIdSchema, entryId: applicationTimelineEntryIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.deleteApplicationTimelineEntry],
+ annotations: WRITE_DESTRUCTIVE,
},
[T.deleteApplication]: {
title: "Delete Application",
description: "Permanently delete one job application and its owned uploaded documents.",
inputSchema: z.object({ id: applicationIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.deleteApplication],
+ annotations: WRITE_DESTRUCTIVE,
},
[T.bulkUpdateApplications]: {
title: "Bulk Update Applications",
@@ -387,19 +416,19 @@ export const TOOL_META = {
archived: z.boolean().optional(),
addTags: z.array(z.string()).optional(),
}),
- annotations: TOOL_ANNOTATIONS[T.bulkUpdateApplications],
+ annotations: WRITE_IDEMPOTENT,
},
[T.bulkDeleteApplications]: {
title: "Bulk Delete Applications",
description: "Permanently delete multiple applications.",
inputSchema: z.object({ ids: z.array(z.string()).min(1) }),
- annotations: TOOL_ANNOTATIONS[T.bulkDeleteApplications],
+ annotations: WRITE_DESTRUCTIVE,
},
[T.importApplications]: {
title: "Import Applications",
description: "Bulk-create application rows parsed from CSV or another source. Maximum 500 items.",
inputSchema: z.object({ items: z.array(createApplicationSchema).min(1).max(500) }),
- annotations: TOOL_ANNOTATIONS[T.importApplications],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.attachApplicationDocument]: {
title: "Attach Application Document",
@@ -411,13 +440,13 @@ export const TOOL_META = {
contentType: z.literal("application/pdf"),
dataBase64: pdfBase64Schema,
}),
- annotations: TOOL_ANNOTATIONS[T.attachApplicationDocument],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.removeApplicationDocument]: {
title: "Remove Application Document",
description: "Remove a sent resume or cover-letter PDF from an application.",
inputSchema: z.object({ id: applicationIdSchema, kind: applicationDocumentKindSchema }),
- annotations: TOOL_ANNOTATIONS[T.removeApplicationDocument],
+ annotations: WRITE_IDEMPOTENT,
},
[T.autofillApplicationFromJob]: {
title: "Autofill Application From Job",
@@ -427,24 +456,24 @@ export const TOOL_META = {
sourceUrl: httpUrlSchema.optional(),
jobDescription: z.string().max(20_000).optional(),
}),
- annotations: TOOL_ANNOTATIONS[T.autofillApplicationFromJob],
+ annotations: READ_OPEN_WORLD_NON_IDEMPOTENT,
},
[T.scoreApplicationMatch]: {
title: "Score Application Match",
description: "Score the linked resume against the application's job description and persist match metadata.",
inputSchema: z.object({ id: applicationIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.scoreApplicationMatch],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.tailorResumeForApplication]: {
title: "Tailor Resume For Application",
description: "Create and link a tailored copy of the application's linked resume.",
inputSchema: z.object({ id: applicationIdSchema }),
- annotations: TOOL_ANNOTATIONS[T.tailorResumeForApplication],
+ annotations: WRITE_NON_IDEMPOTENT,
},
[T.draftApplicationMessage]: {
title: "Draft Application Message",
description: "Draft either a cover letter or recruiter follow-up from application and resume context.",
inputSchema: z.object({ id: applicationIdSchema, kind: z.enum(["cover-letter", "follow-up"]) }),
- annotations: TOOL_ANNOTATIONS[T.draftApplicationMessage],
+ annotations: READ_NON_IDEMPOTENT,
},
} as const;
diff --git a/packages/mcp/src/tools.test.ts b/packages/mcp/src/tools.test.ts
index 550f2ab1b..041b95e5e 100644
--- a/packages/mcp/src/tools.test.ts
+++ b/packages/mcp/src/tools.test.ts
@@ -21,7 +21,8 @@ vi.mock("@reactive-resume/env/server", () => ({
},
}));
-const { MCP_TOOL_NAME, registerTools } = await import("./tools");
+const { MCP_TOOL_NAME } = await import("./mcp-tool-names");
+const { registerTools } = await import("./tools");
type ToolHandler = (input: Record<string, unknown>) => Promise<{
content: Array<{ type: "text"; text: string }>;
diff --git a/packages/mcp/src/tools.ts b/packages/mcp/src/tools.ts
index 6f206a828..b3c3d3df4 100644
--- a/packages/mcp/src/tools.ts
+++ b/packages/mcp/src/tools.ts
@@ -12,8 +12,6 @@ import { resumeDataSchema } from "@reactive-resume/schema/resume/data";
import { MCP_TOOL_NAME } from "./mcp-tool-names";
import { TOOL_META } from "./tool-meta";
-export { MCP_TOOL_NAME } from "./mcp-tool-names";
-
type PatchOperation = z.infer<typeof resumePatchOperationsSchema>[number];
// ── Shared Helpers ───────────────���──────────────────────────────
diff --git a/packages/pdf/src/browser.test.tsx b/packages/pdf/src/browser.test.tsx
index d36b5c69f..82bda7d52 100644
--- a/packages/pdf/src/browser.test.tsx
+++ b/packages/pdf/src/browser.test.tsx
@@ -44,4 +44,16 @@ describe("createResumePdfBlob", () => {
}),
);
});
+
+ it("returns a rejected Promise when the renderer fails synchronously", async () => {
+ rendererMock.pdf.mockImplementationOnce(() => {
+ throw new Error("renderer failed");
+ });
+ const { createResumePdfBlob } = await import("./browser");
+
+ const promise = createResumePdfBlob({ data: sampleResumeData });
+
+ expect(promise).toBeInstanceOf(Promise);
+ await expect(promise).rejects.toThrow("renderer failed");
+ });
});
diff --git a/packages/pdf/src/browser.tsx b/packages/pdf/src/browser.tsx
index 437644b54..948079ed9 100644
--- a/packages/pdf/src/browser.tsx
+++ b/packages/pdf/src/browser.tsx
@@ -13,6 +13,7 @@ type CreateResumePdfBlobOptions = {
resolveSectionTitle?: SectionTitleResolver | undefined;
};
+// biome-ignore lint/suspicious/useAwait: keep synchronous renderer errors on the public Promise rejection path.
export const createResumePdfBlob = async ({
data,
template,
diff --git a/packages/pdf/src/document.tsx b/packages/pdf/src/document.tsx
index b420b3934..1ae49af39 100644
--- a/packages/pdf/src/document.tsx
+++ b/packages/pdf/src/document.tsx
@@ -9,10 +9,14 @@ import { Document } from "#react-pdf-renderer";
import { RenderProvider } from "./context";
import { registerFonts, resumeContentContainsCJK, resumeContentScripts } from "./hooks/use-register-fonts";
import { getTemplatePage } from "./templates";
+import { shouldShowResumeHeader } from "./templates/shared/cover-letter";
+import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "./templates/shared/page-size";
export type TemplatePageProps = {
page: LayoutPage;
- pageIndex: number;
+ pageSize: ReturnType<typeof getTemplatePageSize>;
+ pageMinHeightStyle: ReturnType<typeof getTemplatePageMinHeightStyle>;
+ showHeader: boolean;
};
export type TemplatePage = ComponentType<TemplatePageProps>;
@@ -43,6 +47,9 @@ export const ResumeDocument = ({ data, template, renderOptions, resolveSectionTi
// fallback (#2986); the cast carries that wider runtime value through
// `ResumeData` without changing the public schema.
const resumeData = useMemo(() => ({ ...data, metadata: { ...data.metadata, typography } }), [data, typography]);
+ const pageSize = getTemplatePageSize(resumeData.metadata.page.format);
+ const pageMinHeightStyle = getTemplatePageMinHeightStyle(resumeData.metadata.page.format);
+ const headerResumeData = renderOptions ? { ...resumeData, renderOptions } : resumeData;
return (
<RenderProvider data={resumeData} resolveSectionTitle={resolveSectionTitle} renderOptions={renderOptions}>
@@ -57,7 +64,13 @@ export const ResumeDocument = ({ data, template, renderOptions, resolveSectionTi
language={resumeData.metadata.page.locale}
>
{resumeData.metadata.layout.pages.map((page, index) => (
- <TemplatePageComponent key={getLayoutPageKey(page, index)} page={page} pageIndex={index} />
+ <TemplatePageComponent
+ key={getLayoutPageKey(page, index)}
+ page={page}
+ pageSize={pageSize}
+ pageMinHeightStyle={pageMinHeightStyle}
+ showHeader={shouldShowResumeHeader(headerResumeData, index)}
+ />
))}
</Document>
</RenderProvider>
diff --git a/packages/pdf/src/hooks/use-register-fonts.ts b/packages/pdf/src/hooks/use-register-fonts.ts
index e037e2611..c7a1327ea 100644
--- a/packages/pdf/src/hooks/use-register-fonts.ts
+++ b/packages/pdf/src/hooks/use-register-fonts.ts
@@ -106,17 +106,6 @@ const toFontWeight = (weight: number): FontWeight => {
return "900";
};
-const collectFontRangeWeights = (ranges: FontWeightRange[]): number[] => {
- const weights = new Set<number>();
-
- for (const range of ranges) {
- weights.add(range.lowest);
- weights.add(range.highest);
- }
-
- return [...weights];
-};
-
// Resolves the user-stored family to the one we hand to Font.register:
// direct match → legacy alias (#2989) → IBM Plex Serif fallback.
const resolvePdfFontFamily = (family: string) => {
@@ -277,7 +266,7 @@ export const registerFonts = (
const headingFallbacks = getPdfFallbackFontFamilies(headingFontFamily, { locale, scripts: fallbackScripts });
const registerFallbacks = (families: string[], ranges: FontWeightRange[]) => {
- const weights = collectFontRangeWeights(ranges);
+ const weights = new Set(ranges.flatMap(({ lowest, highest }) => [lowest, highest]));
for (const family of families) {
for (const weight of weights) {
diff --git a/packages/pdf/src/templates/azurill/AzurillPage.tsx b/packages/pdf/src/templates/azurill/AzurillPage.tsx
index 5ec7899af..1e2edd570 100644
--- a/packages/pdf/src/templates/azurill/AzurillPage.tsx
+++ b/packages/pdf/src/templates/azurill/AzurillPage.tsx
@@ -20,10 +20,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -58,14 +56,11 @@ const azurillFeatures = {
sectionTimeline: true,
} satisfies TemplateFeatures;
-export const AzurillPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const AzurillPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles, featureStyles } = useAzurillTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
@@ -139,22 +134,17 @@ const useAzurillTemplate = (): AzurillTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
+ ...base.page,
flexDirection: "column",
rowGap: metrics.headerGap,
columnGap: metrics.columnGap,
- color: foreground,
- backgroundColor: background,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
sectionHeading: {
color: primary,
diff --git a/packages/pdf/src/templates/bronzor/BronzorPage.tsx b/packages/pdf/src/templates/bronzor/BronzorPage.tsx
index 31de90f30..8f04c3091 100644
--- a/packages/pdf/src/templates/bronzor/BronzorPage.tsx
+++ b/packages/pdf/src/templates/bronzor/BronzorPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -70,14 +68,11 @@ const getBronzorSections = ({
return sections;
};
-export const BronzorPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const BronzorPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { styles, colors } = useBronzorTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
const sections = getBronzorSections({ mainSections, sidebarSections, fullWidth: page.fullWidth });
@@ -136,22 +131,17 @@ const useBronzorTemplate = (): BronzorTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
heading: { ...base.heading, fontWeight: metadata.typography.heading.fontWeights[0] ?? "500" },
page: {
+ ...base.page,
flexDirection: "column",
rowGap: metrics.headerGap,
- color: foreground,
- backgroundColor: background,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: r.row,
diff --git a/packages/pdf/src/templates/chikorita/ChikoritaPage.tsx b/packages/pdf/src/templates/chikorita/ChikoritaPage.tsx
index 8967d748a..fe421e81d 100644
--- a/packages/pdf/src/templates/chikorita/ChikoritaPage.tsx
+++ b/packages/pdf/src/templates/chikorita/ChikoritaPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -47,15 +45,12 @@ type ChikoritaHeaderProps = {
styles: ChikoritaStyles;
};
-export const ChikoritaPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const ChikoritaPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata, picture } = data;
const { colors, styles } = useChikoritaTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
const hasPicture = hasTemplatePicture(picture);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
@@ -153,19 +148,14 @@ const useChikoritaTemplate = (): ChikoritaTemplate => {
};
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
inline: { ...base.inline, columnGap: metrics.gapX(0.25) },
page: {
+ ...base.page,
flexDirection: r.row,
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/cover-letter-layout.test.ts b/packages/pdf/src/templates/cover-letter-layout.test.ts
index a7b02f76a..e4897854c 100644
--- a/packages/pdf/src/templates/cover-letter-layout.test.ts
+++ b/packages/pdf/src/templates/cover-letter-layout.test.ts
@@ -27,11 +27,23 @@ const readTemplate = (file: string) => {
};
describe("cover letter PDF layout", () => {
- it.each(pageFiles)("%s suppresses the resume header for cover-letter-only documents", (file) => {
+ it("derives shared page props in the document renderer", () => {
+ const source = readTemplate("../document.tsx");
+
+ expect(source).toContain('from "./templates/shared/cover-letter"');
+ expect(source).toContain('from "./templates/shared/page-size"');
+ expect(source).toContain("showHeader={shouldShowResumeHeader");
+ expect(source).toContain("pageSize={pageSize}");
+ expect(source).toContain("pageMinHeightStyle={pageMinHeightStyle}");
+ });
+
+ it.each(pageFiles)("%s renders the shared page props", (file) => {
const source = readTemplate(file);
- expect(source, basename(file)).toContain('from "../shared/cover-letter"');
- expect(source, basename(file)).toContain("shouldShowResumeHeader(data, pageIndex)");
- expect(source, basename(file)).not.toContain("const showHeader = pageIndex === 0;");
+ expect(source, basename(file)).toContain("pageSize, pageMinHeightStyle, showHeader");
+ expect(source, basename(file)).toContain("<Page size={pageSize}");
+ expect(source, basename(file)).toContain("showHeader &&");
+ expect(source, basename(file)).not.toContain('from "../shared/cover-letter"');
+ expect(source, basename(file)).not.toContain('from "../shared/page-size"');
});
});
diff --git a/packages/pdf/src/templates/ditgar/DitgarPage.tsx b/packages/pdf/src/templates/ditgar/DitgarPage.tsx
index e6924ccd6..5b9185316 100644
--- a/packages/pdf/src/templates/ditgar/DitgarPage.tsx
+++ b/packages/pdf/src/templates/ditgar/DitgarPage.tsx
@@ -15,11 +15,9 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { getFeaturedSummaryLayout } from "../shared/featured-summary";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -58,14 +56,11 @@ const ditgarFeatures = {
mainItemHeaderBorder: true,
} satisfies TemplateFeatures;
-export const DitgarPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const DitgarPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useDitgarTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const showSidebar = !page.fullWidth || showHeader;
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
@@ -189,18 +184,13 @@ const useDitgarTemplate = (): DitgarTemplate => {
};
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
+ ...base.page,
flexDirection: r.row,
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/ditto/DittoPage.tsx b/packages/pdf/src/templates/ditto/DittoPage.tsx
index 079b0fe36..8f4c25b55 100644
--- a/packages/pdf/src/templates/ditto/DittoPage.tsx
+++ b/packages/pdf/src/templates/ditto/DittoPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -52,15 +50,12 @@ type DittoHeaderProps = {
styles: DittoStyles;
};
-export const DittoPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const DittoPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata, picture } = data;
const { colors, styles } = useDittoTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
const hasPicture = hasTemplatePicture(picture);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
@@ -149,7 +144,7 @@ const useDittoTemplate = (): DittoTemplate => {
const metrics = getTemplateMetrics(metadata.page);
const hasPicture = hasTemplatePicture(picture);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
@@ -161,13 +156,8 @@ const useDittoTemplate = (): DittoTemplate => {
marginLeft: -picture.size / 2,
},
page: {
+ ...base.page,
flexDirection: "column",
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/gengar/GengarPage.tsx b/packages/pdf/src/templates/gengar/GengarPage.tsx
index 8d886b4f6..6462d80fb 100644
--- a/packages/pdf/src/templates/gengar/GengarPage.tsx
+++ b/packages/pdf/src/templates/gengar/GengarPage.tsx
@@ -15,11 +15,9 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { getFeaturedSummaryLayout } from "../shared/featured-summary";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -53,14 +51,11 @@ type GengarHeaderProps = {
colors: TemplateColorRoles;
};
-export const GengarPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const GengarPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useGengarTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const showSidebar = !page.fullWidth || showHeader;
const sidebarSections = filterSections(page.sidebar, data);
const mainSections = filterSections(page.main, data);
@@ -185,18 +180,13 @@ const useGengarTemplate = (): GengarTemplate => {
};
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
+ ...base.page,
flexDirection: r.row,
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/glalie/GlaliePage.tsx b/packages/pdf/src/templates/glalie/GlaliePage.tsx
index f5bc6820e..4009db9d2 100644
--- a/packages/pdf/src/templates/glalie/GlaliePage.tsx
+++ b/packages/pdf/src/templates/glalie/GlaliePage.tsx
@@ -15,10 +15,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -55,14 +53,11 @@ const glalieFeatures = {
stackSidebarItemHeader: true,
} satisfies TemplateFeatures;
-export const GlaliePage = ({ page, pageIndex }: TemplatePageProps) => {
+export const GlaliePage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useGlalieTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const showSidebar = !page.fullWidth || showHeader;
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -150,18 +145,10 @@ const useGlalieTemplate = (): GlalieTemplate => {
};
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
- page: {
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
- },
section: {
flexDirection: "column",
rowGap: metrics.gapY(0.25),
diff --git a/packages/pdf/src/templates/kakuna/KakunaPage.tsx b/packages/pdf/src/templates/kakuna/KakunaPage.tsx
index c8772c058..b2b5dcb2e 100644
--- a/packages/pdf/src/templates/kakuna/KakunaPage.tsx
+++ b/packages/pdf/src/templates/kakuna/KakunaPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -46,14 +44,11 @@ type KakunaHeaderProps = {
styles: KakunaStyles;
};
-export const KakunaPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const KakunaPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useKakunaTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -119,20 +114,15 @@ const useKakunaTemplate = (): KakunaTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.sectionGap,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/lapras/LaprasPage.tsx b/packages/pdf/src/templates/lapras/LaprasPage.tsx
index 59681031e..e29bfcb66 100644
--- a/packages/pdf/src/templates/lapras/LaprasPage.tsx
+++ b/packages/pdf/src/templates/lapras/LaprasPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -45,14 +43,11 @@ type LaprasHeaderProps = {
styles: LaprasStyles;
};
-export const LaprasPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const LaprasPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useLaprasTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -121,20 +116,15 @@ const useLaprasTemplate = (): LaprasTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.gapY(1.5),
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/leafish/LeafishPage.tsx b/packages/pdf/src/templates/leafish/LeafishPage.tsx
index 687f63036..4e5b01f20 100644
--- a/packages/pdf/src/templates/leafish/LeafishPage.tsx
+++ b/packages/pdf/src/templates/leafish/LeafishPage.tsx
@@ -15,10 +15,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -51,14 +49,11 @@ type LeafishHeaderProps = {
styles: LeafishStyles;
};
-export const LeafishPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const LeafishPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useLeafishTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data).filter((section) => section !== "summary");
const sidebarSections = filterSections(page.sidebar, data).filter((section) => section !== "summary");
@@ -141,18 +136,10 @@ const useLeafishTemplate = (): LeafishTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
- page: {
- color: foreground,
- backgroundColor: background,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
- },
section: {
flexDirection: "column",
rowGap: metrics.gapY(0.25),
diff --git a/packages/pdf/src/templates/meowth/MeowthPage.tsx b/packages/pdf/src/templates/meowth/MeowthPage.tsx
index 77807e97d..79983a748 100644
--- a/packages/pdf/src/templates/meowth/MeowthPage.tsx
+++ b/packages/pdf/src/templates/meowth/MeowthPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -50,14 +48,11 @@ const meowthFeatures = {
inlineItemHeader: true,
} satisfies TemplateFeatures;
-export const MeowthPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const MeowthPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useMeowthTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -122,20 +117,15 @@ const useMeowthTemplate = (): MeowthTemplate => {
const primary = rgbaStringToHex(metadata.design.colors.primary);
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.sectionGap,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
inlineItemHeader: {
flexDirection: r.row,
diff --git a/packages/pdf/src/templates/onyx/OnyxPage.tsx b/packages/pdf/src/templates/onyx/OnyxPage.tsx
index 56a9a465a..b7e8c8737 100644
--- a/packages/pdf/src/templates/onyx/OnyxPage.tsx
+++ b/packages/pdf/src/templates/onyx/OnyxPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -45,14 +43,11 @@ type OnyxHeaderProps = {
styles: OnyxStyles;
};
-export const OnyxPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const OnyxPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useOnyxTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -117,20 +112,15 @@ const useOnyxTemplate = (): OnyxTemplate => {
const primary = rgbaStringToHex(metadata.design.colors.primary);
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.sectionGap,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/pikachu/PikachuPage.tsx b/packages/pdf/src/templates/pikachu/PikachuPage.tsx
index c270c0454..953167f4b 100644
--- a/packages/pdf/src/templates/pikachu/PikachuPage.tsx
+++ b/packages/pdf/src/templates/pikachu/PikachuPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -55,14 +53,11 @@ const pikachuFeatures = {
stackSidebarItemHeader: true,
} satisfies TemplateFeatures;
-export const PikachuPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const PikachuPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata, picture } = data;
const { colors, styles } = usePikachuTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const showSidebar = !page.fullWidth;
const hasPicture = hasTemplatePicture(picture);
const mainSections = filterSections(page.main, data);
@@ -171,19 +166,14 @@ const usePikachuTemplate = (): PikachuTemplate => {
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/rhyhorn/RhyhornPage.tsx b/packages/pdf/src/templates/rhyhorn/RhyhornPage.tsx
index fb6202f64..6460ed1de 100644
--- a/packages/pdf/src/templates/rhyhorn/RhyhornPage.tsx
+++ b/packages/pdf/src/templates/rhyhorn/RhyhornPage.tsx
@@ -15,10 +15,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -48,14 +46,11 @@ type RhyhornHeaderProps = {
styles: RhyhornStyles;
};
-export const RhyhornPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const RhyhornPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useRhyhornTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = filterSections(page.sidebar, data);
@@ -163,20 +158,15 @@ const useRhyhornTemplate = (): RhyhornTemplate => {
const metrics = getTemplateMetrics(metadata.page);
const contactGap = metrics.gapX(0.5);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.sectionGap,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
section: {
flexDirection: "column",
diff --git a/packages/pdf/src/templates/scizor/ScizorPage.tsx b/packages/pdf/src/templates/scizor/ScizorPage.tsx
index 6f67cd0f5..c12015709 100644
--- a/packages/pdf/src/templates/scizor/ScizorPage.tsx
+++ b/packages/pdf/src/templates/scizor/ScizorPage.tsx
@@ -14,10 +14,8 @@ import {
WebsiteContactItem,
} from "../shared/contact-item";
import { TemplateProvider } from "../shared/context";
-import { shouldShowResumeHeader } from "../shared/cover-letter";
import { filterSections } from "../shared/filtering";
import { getTemplateMetrics } from "../shared/metrics";
-import { getTemplatePageMinHeightStyle, getTemplatePageSize } from "../shared/page-size";
import { hasTemplatePicture } from "../shared/picture";
import { Heading, Text } from "../shared/primitives";
import { createRtlStyleHelpers } from "../shared/rtl";
@@ -46,14 +44,11 @@ type ScizorHeaderProps = {
styles: ScizorStyles;
};
-export const ScizorPage = ({ page, pageIndex }: TemplatePageProps) => {
+export const ScizorPage = ({ page, pageSize, pageMinHeightStyle, showHeader }: TemplatePageProps) => {
const data = useRender();
const { metadata } = data;
const { colors, styles } = useScizorTemplate();
const metrics = getTemplateMetrics(metadata.page);
- const pageSize = getTemplatePageSize(metadata.page.format);
- const pageMinHeightStyle = getTemplatePageMinHeightStyle(metadata.page.format);
- const showHeader = shouldShowResumeHeader(data, pageIndex);
const mainSections = filterSections(page.main, data);
const sidebarSections = page.fullWidth ? [] : filterSections(page.sidebar, data);
const sections = [...mainSections, ...sidebarSections];
@@ -111,22 +106,17 @@ const useScizorTemplate = (): ScizorTemplate => {
const divider = "#D8DCE2";
const colors: TemplateColorRoles = { foreground, background, primary };
const metrics = getTemplateMetrics(metadata.page);
- const base = createBaseTemplateStyles({ metadata, foreground, r, metrics, picture });
+ const base = createBaseTemplateStyles({ metadata, foreground, background, r, metrics, picture });
const baseStyles = StyleSheet.create({
...base,
page: {
- color: foreground,
- backgroundColor: background,
+ ...base.page,
borderTopWidth: metrics.gapY(0.45),
borderTopColor: primary,
paddingHorizontal: metrics.page.paddingHorizontal,
paddingVertical: metrics.page.paddingVertical,
rowGap: metrics.sectionGap,
- fontFamily: metadata.typography.body.fontFamily,
- fontSize: metadata.typography.body.fontSize,
- lineHeight: metadata.typography.body.lineHeight,
- direction: r.pageDirection,
},
heading: { ...base.heading, fontWeight: metadata.typography.heading.fontWeights.at(-1) ?? "700" },
bold: { fontWeight: metadata.typography.body.fontWeights.at(-1) ?? "700", color: foreground },
diff --git a/packages/pdf/src/templates/shared/base-template-styles.ts b/packages/pdf/src/templates/shared/base-template-styles.ts
index 827c7d3c8..49ee3d0f7 100644
--- a/packages/pdf/src/templates/shared/base-template-styles.ts
+++ b/packages/pdf/src/templates/shared/base-template-styles.ts
@@ -7,6 +7,7 @@ import { rgbaStringToHex } from "@reactive-resume/utils/color";
type BaseTemplateStylesInput = {
metadata: ResumeData["metadata"];
foreground: string;
+ background: string;
r: ReturnType<typeof createRtlStyleHelpers>;
metrics: ReturnType<typeof getTemplateMetrics>;
picture: Picture;
@@ -20,7 +21,14 @@ type BaseTemplateStylesInput = {
* ponytail: factory returns plain objects, not StyleSheet.create'd; each template does one
* StyleSheet.create pass so the final resolved styles are identical to before.
*/
-export function createBaseTemplateStyles({ metadata, foreground, r, metrics, picture }: BaseTemplateStylesInput) {
+export function createBaseTemplateStyles({
+ metadata,
+ foreground,
+ background,
+ r,
+ metrics,
+ picture,
+}: BaseTemplateStylesInput) {
const bodyText = {
fontFamily: metadata.typography.body.fontFamily,
fontSize: metadata.typography.body.fontSize,
@@ -31,6 +39,15 @@ export function createBaseTemplateStyles({ metadata, foreground, r, metrics, pic
} satisfies Style;
return {
+ page: {
+ color: foreground,
+ backgroundColor: background,
+ fontFamily: metadata.typography.body.fontFamily,
+ fontSize: metadata.typography.body.fontSize,
+ lineHeight: metadata.typography.body.lineHeight,
+ direction: r.pageDirection,
+ } satisfies Style,
+
/** The canonical body text style; alias for `text` in StyleSheet slots. */
text: bodyText,
diff --git a/packages/pdf/src/templates/shared/sections.test.ts b/packages/pdf/src/templates/shared/sections.test.ts
index 8e19e3e2f..fd88091aa 100644
--- a/packages/pdf/src/templates/shared/sections.test.ts
+++ b/packages/pdf/src/templates/shared/sections.test.ts
@@ -14,6 +14,14 @@ describe("ExperienceSection", () => {
});
});
+describe("ItemTitle", () => {
+ it("renders award titles without the bold style", () => {
+ expect(source).toContain("const ItemTitle = ({ children, website, bold = true }: ItemTitleProps)");
+ expect(source).toContain("const title = bold ? <Bold>{children}</Bold> : <Text>{children}</Text>;");
+ expect(source).toContain("<ItemTitle website={item.website} bold={false}>");
+ });
+});
+
describe("SectionShell", () => {
it("keeps section and heading style rules when section heading icons are hidden", () => {
expect(source).toContain("<View style={composeStyles(sectionStyle, sectionRuleStyle)} {...breakProps}>");
diff --git a/packages/pdf/src/templates/shared/sections.tsx b/packages/pdf/src/templates/shared/sections.tsx
index 4650ef2e6..3098b887a 100644
--- a/packages/pdf/src/templates/shared/sections.tsx
+++ b/packages/pdf/src/templates/shared/sections.tsx
@@ -90,6 +90,7 @@ type ItemWebsite = {
type ItemTitleProps = {
children: ReactNode;
website: ItemWebsite;
+ bold?: boolean;
};
type ItemWebsiteLinkProps = {
@@ -383,9 +384,9 @@ const SectionItemHeader = ({ children }: SectionItemHeaderProps) => {
return <View style={composeStyles(sectionItemHeaderStyle)}>{children}</View>;
};
-const ItemTitle = ({ children, website }: ItemTitleProps) => {
+const ItemTitle = ({ children, website, bold = true }: ItemTitleProps) => {
const inlineWebsiteUrl = getInlineItemWebsiteUrl(website);
- const title = <Bold>{children}</Bold>;
+ const title = bold ? <Bold>{children}</Bold> : <Text>{children}</Text>;
if (!inlineWebsiteUrl) return title;
diff --git a/packages/schema/src/applications/data.ts b/packages/schema/src/applications/data.ts
index 9e863a000..f2302071d 100644
--- a/packages/schema/src/applications/data.ts
+++ b/packages/schema/src/applications/data.ts
@@ -43,7 +43,6 @@ export const applicationTimelineEntrySchema = z.discriminatedUnion("type", [
]);
export type ApplicationTimelineEntry = z.infer<typeof applicationTimelineEntrySchema>;
-export type ActivityEvent = ApplicationTimelineEntry;
// Reserved for AI enrichment output (autofill / match-score). Free-form so the shape can
// evolve without a migration. See the AI roadmap in the applications feature.
diff --git a/packages/ui/src/components/input.test.tsx b/packages/ui/src/components/input.test.tsx
index d3775961f..0d79cc999 100644
--- a/packages/ui/src/components/input.test.tsx
+++ b/packages/ui/src/components/input.test.tsx
@@ -36,7 +36,7 @@ describe("Input", () => {
expect(screen.getByPlaceholderText("Enter name")).toBeInTheDocument();
});
- it("respects disabled state", async () => {
+ it("respects disabled state", () => {
render(<Input data-testid="x" disabled />);
const input = screen.getByTestId("x");
expect(input).toBeDisabled();
diff --git a/packages/utils/src/url-security.node.ts b/packages/utils/src/url-security.node.ts
index 74e1cb418..d6eea1f0c 100644
--- a/packages/utils/src/url-security.node.ts
+++ b/packages/utils/src/url-security.node.ts
@@ -1,4 +1,4 @@
-import { isIP } from "node:net";
+import { BlockList, isIP } from "node:net";
function normalizeHostname(hostname: string) {
return hostname.trim().toLowerCase();
@@ -8,170 +8,62 @@ function stripIpv6Brackets(hostname: string): string {
return hostname.replace(/^\[/, "").replace(/\]$/, "");
}
-function normalizeIpv4MappedIpv6(hostname: string) {
- const normalized = stripIpv6Brackets(normalizeHostname(hostname));
- const mapped = normalized.match(/^::ffff:(?<address>.+)$/)?.groups?.address;
- if (!mapped) return normalized;
-
- if (isIP(mapped) === 4) return mapped;
-
- const hexMatch = mapped.match(/^(?<high>[0-9a-f]{1,4}):(?<low>[0-9a-f]{1,4})$/);
- if (!hexMatch?.groups) return normalized;
-
- const { high: highHex, low: lowHex } = hexMatch.groups;
- if (!highHex || !lowHex) return normalized;
-
- const high = Number.parseInt(highHex, 16);
- const low = Number.parseInt(lowHex, 16);
- if (Number.isNaN(high) || Number.isNaN(low) || high > 0xffff || low > 0xffff) return normalized;
-
- return [high >> 8, high & 0xff, low >> 8, low & 0xff].join(".");
-}
-
-function isIpv4MappedIpv6(hostname: string) {
- const normalized = stripIpv6Brackets(normalizeHostname(hostname));
-
- return normalized.startsWith("::ffff:");
-}
-
-const blockedIpv4Cidrs: Array<[number, number]> = [
- [knownIpv4ToNumber("0.0.0.0"), 8],
- [knownIpv4ToNumber("10.0.0.0"), 8],
- [knownIpv4ToNumber("100.64.0.0"), 10],
- [knownIpv4ToNumber("127.0.0.0"), 8],
- [knownIpv4ToNumber("169.254.0.0"), 16],
- [knownIpv4ToNumber("172.16.0.0"), 12],
- [knownIpv4ToNumber("192.0.0.0"), 24],
- [knownIpv4ToNumber("192.0.2.0"), 24],
- [knownIpv4ToNumber("192.88.99.0"), 24],
- [knownIpv4ToNumber("192.168.0.0"), 16],
- [knownIpv4ToNumber("198.18.0.0"), 15],
- [knownIpv4ToNumber("198.51.100.0"), 24],
- [knownIpv4ToNumber("203.0.113.0"), 24],
- [knownIpv4ToNumber("224.0.0.0"), 4],
- [knownIpv4ToNumber("240.0.0.0"), 4],
+const blockedIpv4Cidrs: Array<[string, number]> = [
+ ["0.0.0.0", 8],
+ ["10.0.0.0", 8],
+ ["100.64.0.0", 10],
+ ["127.0.0.0", 8],
+ ["169.254.0.0", 16],
+ ["172.16.0.0", 12],
+ ["192.0.0.0", 24],
+ ["192.0.2.0", 24],
+ ["192.88.99.0", 24],
+ ["192.168.0.0", 16],
+ ["198.18.0.0", 15],
+ ["198.51.100.0", 24],
+ ["203.0.113.0", 24],
+ ["224.0.0.0", 4],
+ ["240.0.0.0", 4],
];
-const blockedIpv6Cidrs: Array<[bigint, number]> = [
- [knownIpv6ToBigInt("::"), 128],
- [knownIpv6ToBigInt("::1"), 128],
- [knownIpv6ToBigInt("::ffff:0:0"), 96],
- [knownIpv6ToBigInt("64:ff9b::"), 96],
- [knownIpv6ToBigInt("64:ff9b:1::"), 48],
- [knownIpv6ToBigInt("100::"), 64],
- [knownIpv6ToBigInt("100:0:0:1::"), 64],
- [knownIpv6ToBigInt("2001::"), 23],
- [knownIpv6ToBigInt("2001:2::"), 48],
- [knownIpv6ToBigInt("2001:10::"), 28],
- [knownIpv6ToBigInt("2001:db8::"), 32],
- [knownIpv6ToBigInt("2002::"), 16],
- [knownIpv6ToBigInt("3fff::"), 20],
- [knownIpv6ToBigInt("5f00::"), 16],
- [knownIpv6ToBigInt("fc00::"), 7],
- [knownIpv6ToBigInt("fe80::"), 10],
- [knownIpv6ToBigInt("ff00::"), 8],
+const blockedIpv6Cidrs: Array<[string, number]> = [
+ ["::", 128],
+ ["::1", 128],
+ ["::ffff:0:0", 96],
+ ["64:ff9b::", 96],
+ ["64:ff9b:1::", 48],
+ ["100::", 64],
+ ["100:0:0:1::", 64],
+ ["2001::", 23],
+ ["2001:2::", 48],
+ ["2001:10::", 28],
+ ["2001:db8::", 32],
+ ["2002::", 16],
+ ["3fff::", 20],
+ ["5f00::", 16],
+ ["fc00::", 7],
+ ["fe80::", 10],
+ ["ff00::", 8],
];
-function ipv4ToNumber(hostname: string) {
- const octets = hostname.split(".").map((part) => Number.parseInt(part, 10));
- if (octets.length !== 4 || octets.some((octet) => Number.isNaN(octet) || octet < 0 || octet > 255)) return null;
+const blockedIpv4s = new BlockList();
+for (const [address, prefix] of blockedIpv4Cidrs) blockedIpv4s.addSubnet(address, prefix, "ipv4");
- return (((octets[0] ?? 0) << 24) | ((octets[1] ?? 0) << 16) | ((octets[2] ?? 0) << 8) | (octets[3] ?? 0)) >>> 0;
-}
-
-function knownIpv4ToNumber(hostname: string) {
- const value = ipv4ToNumber(hostname);
- if (value === null) throw new Error(`Invalid IPv4 CIDR base: ${hostname}`);
-
- return value;
-}
-
-function isIpv4InCidr(address: number, base: number, prefix: number) {
- const mask = prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0;
-
- return (address & mask) === (base & mask);
-}
-
-function expandIpv6(hostname: string) {
- const normalized = stripIpv6Brackets(normalizeHostname(hostname));
- const [head = "", tail = ""] = normalized.split("::", 2);
- const headParts = head ? head.split(":") : [];
- const tailParts = tail ? tail.split(":") : [];
- const missing = 8 - headParts.length - tailParts.length;
- if (missing < 0) return null;
-
- const parts = [...headParts, ...Array.from({ length: missing }, () => "0"), ...tailParts];
- if (parts.length !== 8) return null;
-
- const hextets = parts.map((part) => {
- if (!/^[0-9a-f]{1,4}$/.test(part)) return null;
- return Number.parseInt(part, 16);
- });
-
- return hextets.every((part) => part !== null && part >= 0 && part <= 0xffff) ? (hextets as number[]) : null;
-}
-
-function ipv6ToBigInt(hostname: string) {
- const hextets = expandIpv6(hostname);
- if (!hextets) return null;
-
- return hextets.reduce((value, hextet) => (value << 16n) | BigInt(hextet), 0n);
-}
-
-function knownIpv6ToBigInt(hostname: string) {
- const value = ipv6ToBigInt(hostname);
- if (value === null) throw new Error(`Invalid IPv6 CIDR base: ${hostname}`);
-
- return value;
-}
-
-function isIpv6InCidr(address: bigint, base: bigint, prefix: number) {
- const bits = 128n;
- const hostBits = bits - BigInt(prefix);
- const mask = prefix === 0 ? 0n : ((1n << bits) - 1n) ^ ((1n << hostBits) - 1n);
-
- return (address & mask) === (base & mask);
-}
-
-function isLoopbackOrLocalHostname(hostname: string) {
- const normalized = normalizeHostname(hostname);
- return (
- normalized === "localhost" || normalized === "::1" || normalized === "[::1]" || normalized.endsWith(".localhost")
- );
-}
-
-function isPrivateIPv4(hostname: string) {
- const address = ipv4ToNumber(hostname);
- if (address === null) return false;
-
- return blockedIpv4Cidrs.some(([base, prefix]) => isIpv4InCidr(address, base ?? 0, prefix));
-}
-
-function isPrivateIPv6(hostname: string) {
- const address = ipv6ToBigInt(hostname);
- if (address === null) return false;
-
- return blockedIpv6Cidrs.some(([base, prefix]) => isIpv6InCidr(address, base, prefix));
-}
+const blockedIpv6s = new BlockList();
+for (const [address, prefix] of blockedIpv6Cidrs) blockedIpv6s.addSubnet(address, prefix, "ipv6");
export function isPrivateOrLoopbackHost(hostname: string) {
- if (isIpv4MappedIpv6(hostname)) return true;
-
- const normalized = normalizeIpv4MappedIpv6(hostname);
- if (isLoopbackOrLocalHostname(normalized)) return true;
+ const normalized = stripIpv6Brackets(normalizeHostname(hostname));
+ if (normalized.startsWith("::ffff:")) return true;
+ if (normalized === "localhost" || normalized === "::1" || normalized.endsWith(".localhost")) return true;
const ipVersion = isIP(normalized);
- if (ipVersion === 4) return isPrivateIPv4(normalized);
- if (ipVersion === 6) return isPrivateIPv6(normalized);
+ if (ipVersion === 4) return blockedIpv4s.check(normalized, "ipv4");
+ if (ipVersion === 6) return blockedIpv6s.check(normalized, "ipv6");
return false;
}
-function isOAuthLoopbackRedirectHost(hostname: string) {
- const normalized = stripIpv6Brackets(normalizeHostname(hostname));
- return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "::1";
-}
-
export function parseUrl(input: string) {
try {
return new URL(input);
@@ -192,9 +84,9 @@ export function isAllowedOAuthRedirectUri(input: string, trustedOrigins: string[
if (parsed.hash) return false;
const origin = parsed.origin.toLowerCase();
- const hostname = normalizeHostname(parsed.hostname);
+ const hostname = stripIpv6Brackets(normalizeHostname(parsed.hostname));
- if (parsed.protocol === "http:") return isOAuthLoopbackRedirectHost(hostname);
+ if (parsed.protocol === "http:") return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
if (parsed.protocol !== "https:") return false;
if (isPrivateOrLoopbackHost(hostname)) return false;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0789297bb..304411616 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -128,19 +128,19 @@ importers:
version: 3.1095.0
'@better-auth/api-key':
specifier: ^1.6.25
'@better-auth/drizzle-adapter':
specifier: ^1.6.25
'@better-auth/infra':
specifier: ^0.3.7
'@better-auth/oauth-provider':
specifier: ^1.6.25
'@better-auth/passkey':
specifier: ^1.6.25
'@hono/node-server':
specifier: ^2.0.12
version: 2.0.12([email protected])
@@ -6366,9 +6366,6 @@ packages:
resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
hasBin: true
- resolution: {integrity: sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw==}
-
resolution: {integrity: sha512-N8acGzVsQy6M/fjFcxtysNc4Q379TcM5dM/qKkNtsHFji88yANnXTr7BLeP75iPnFwBfQzM/jg2BZ9+HZrHCZA==}
@@ -9180,14 +9177,6 @@ snapshots:
'@bcoe/[email protected]': {}
- dependencies:
- '@better-auth/utils': 0.4.2
- better-call: 1.3.7([email protected])
- zod: 4.4.3
-
dependencies:
@@ -9196,20 +9185,6 @@ snapshots:
better-call: 1.3.7([email protected])
zod: 4.4.3
- dependencies:
- '@better-auth/utils': 0.4.2
- '@better-fetch/fetch': 1.3.1
- '@opentelemetry/semantic-conventions': 1.41.1
- '@standard-schema/spec': 1.1.0
- better-call: 1.3.7([email protected])
- jose: 6.2.3
- kysely: 0.29.3
- nanostores: 1.4.0
- zod: 4.4.3
- optionalDependencies:
- '@opentelemetry/api': 1.9.1
-
dependencies:
'@better-auth/utils': 0.4.2
@@ -9224,13 +9199,6 @@ snapshots:
optionalDependencies:
'@opentelemetry/api': 1.9.1
- dependencies:
- '@better-auth/utils': 0.4.2
- optionalDependencies:
- drizzle-orm: 1.0.0-rc.4(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])
-
dependencies:
@@ -9238,17 +9206,6 @@ snapshots:
optionalDependencies:
drizzle-orm: 1.0.0-rc.4(@opentelemetry/[email protected])(@types/[email protected])([email protected])([email protected])
- dependencies:
- '@better-auth/utils': 0.4.2
- '@better-fetch/fetch': 1.3.1
- better-call: 1.3.7([email protected])
- jose: 6.2.3
- libphonenumber-js: 1.13.8
- zod: 4.4.3
-
dependencies:
@@ -9256,36 +9213,26 @@ snapshots:
'@better-fetch/fetch': 1.3.1
better-call: 1.3.7([email protected])
- jose: 6.2.3
+ jose: 6.2.4
libphonenumber-js: 1.13.8
zod: 4.4.3
dependencies:
'@better-auth/utils': 0.4.2
optionalDependencies:
kysely: 0.29.3
- dependencies:
- '@better-auth/utils': 0.4.2
-
dependencies:
'@better-auth/utils': 0.4.2
dependencies:
'@better-auth/utils': 0.4.2
- '@better-fetch/fetch': 1.3.1
- better-call: 1.3.7([email protected])
- jose: 6.2.3
- zod: 4.4.3
dependencies:
@@ -9294,19 +9241,7 @@ snapshots:
'@better-fetch/fetch': 1.3.1
better-call: 1.3.7([email protected])
- jose: 6.2.3
- zod: 4.4.3
-
- dependencies:
- '@better-auth/utils': 0.4.2
- '@better-fetch/fetch': 1.3.1
- '@simplewebauthn/browser': 13.3.0
- '@simplewebauthn/server': 13.3.2
- better-call: 1.3.7([email protected])
- nanostores: 1.4.0
+ jose: 6.2.4
zod: 4.4.3
@@ -9321,14 +9256,14 @@ snapshots:
nanostores: 1.4.0
zod: 4.4.3
dependencies:
'@better-auth/utils': 0.4.2
dependencies:
'@better-auth/utils': 0.4.2
'@better-fetch/fetch': 1.3.1
@@ -10088,7 +10023,7 @@ snapshots:
express: 5.2.1([email protected])
express-rate-limit: 8.5.2([email protected]([email protected]))
hono: 4.12.32
- jose: 6.2.3
+ jose: 6.2.4
json-schema-typed: 8.0.2
pkce-challenge: 5.0.1
raw-body: 3.0.2
@@ -10110,7 +10045,7 @@ snapshots:
express: 5.2.1([email protected])
express-rate-limit: 8.5.2([email protected]([email protected]))
hono: 4.12.32
- jose: 6.2.3
+ jose: 6.2.4
json-schema-typed: 8.0.2
pkce-challenge: 5.0.1
raw-body: 3.0.2
@@ -12328,20 +12263,20 @@ snapshots:
dependencies:
- '@better-auth/memory-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/mongo-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/prisma-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/telemetry': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])
+ '@better-auth/memory-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/mongo-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/prisma-adapter': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/telemetry': 1.6.25(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])
'@better-auth/utils': 0.4.2
'@better-fetch/fetch': 1.3.1
'@noble/ciphers': 2.2.0
'@noble/hashes': 2.2.0
better-call: 1.3.7([email protected])
defu: 6.1.7
- jose: 6.2.3
+ jose: 6.2.4
kysely: 0.29.3
nanostores: 1.4.0
zod: 4.4.3
@@ -13453,8 +13388,6 @@ snapshots:
-
diff --git a/tests/e2e/fixtures/test.ts b/tests/e2e/fixtures/test.ts
index 85891132e..c15ca181e 100644
--- a/tests/e2e/fixtures/test.ts
+++ b/tests/e2e/fixtures/test.ts
@@ -1,4 +1,4 @@
-import type { BrowserContext, Page } from "@playwright/test";
+import type { Page } from "@playwright/test";
import type { E2EAccount } from "./data";
import { test as base, expect } from "@playwright/test";
import { createAuthenticatedContext } from "./auth";
@@ -7,13 +7,11 @@ import { deleteE2EUser } from "./db";
type Fixtures = {
account: E2EAccount;
- authContext: BrowserContext;
authPage: Page;
};
export const test = base.extend<Fixtures>({
- account: async ({ baseURL }, use, testInfo) => {
- void baseURL;
+ account: async ({ baseURL: _baseURL }, use, testInfo) => {
const account = createAccount(testInfo);
try {
@@ -22,25 +20,16 @@ export const test = base.extend<Fixtures>({
await deleteE2EUser(account);
}
},
- authContext: async ({ browser, request, account }, use, testInfo) => {
+ authPage: async ({ browser, request, account }, use, testInfo) => {
const baseURL = String(testInfo.project.use.baseURL ?? "http://localhost:3000");
const context = await createAuthenticatedContext(browser, request, account, baseURL);
try {
- await use(context);
+ await use(await context.newPage());
} finally {
await context.close();
}
},
- authPage: async ({ authContext }, use) => {
- const page = await authContext.newPage();
-
- try {
- await use(page);
- } finally {
- await page.close();
- }
- },
});
export { expect };
diff --git a/tooling/database/reset.ts b/tooling/database/reset.ts
index a700f8911..35e05c696 100644
--- a/tooling/database/reset.ts
+++ b/tooling/database/reset.ts
@@ -3,7 +3,7 @@ import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import { env } from "@reactive-resume/env/server";
-export async function resetDatabase() {
+async function resetDatabase() {
console.log("Resetting database...");
const pool = new Pool({ connectionString: env.DATABASE_URL });
diff --git a/tooling/fonts/generate.ts b/tooling/fonts/generate.ts
index 05d1834c2..fdf9fa86b 100644
--- a/tooling/fonts/generate.ts
+++ b/tooling/fonts/generate.ts
@@ -160,7 +160,7 @@ function getMetricCompatibleFonts(): WebFont[] {
];
}
-export async function generateFonts() {
+async function generateFonts() {
const response = await getGoogleFontsJSON();
console.log(`Found ${response.items.length} fonts in total (Google Fonts).`);