Files
Reactive-Resume/apps/web/src/dialogs/schemas.ts
T
Amruth Pillai a82741f42a feat(web): edit resumes inline in the Write panel
Write becomes the Basics card, the outline of sections in print order and
Add section. Entries open in place (one at a time, the editor selection),
save as you type and show drafts as "Draft · not printed". Dates use a
structured field with a Present switch and the review note for text that
wasn't read exactly; descriptions use a restricted rich-text toolbar shown
on focus. Sections and entries reorder by drag or Alt+Up/Down, rows carry
the eye, count and every section option, and deleting shows Undo.

Clicking the page opens the entry and scrolls it into view; focusing a field
outlines its block. Phones push an open entry full screen. While a field
has focus the preview waits for a pause in typing.

The left section sidebar, the entry dialogs and the hidden-sections list are
removed.
2026-09-28 18:20:26 +02:00

41 lines
1.2 KiB
TypeScript

import type { ReactNode } from "react";
type EmptyDialog<T extends string> = { [K in T]: { type: K; data?: undefined } }[T];
export type DialogSchema =
| EmptyDialog<
| "auth.change-password"
| "auth.two-factor.enable"
| "auth.two-factor.disable"
| "api-key.create"
| "resume.create"
| "resume.import"
| "resume.template.gallery"
>
| {
type: "resume.update";
data: { id: string; name: string; slug: string; tags: string[] };
}
| {
type: "resume.duplicate";
data: { id: string; name: string; slug: string; tags: string[]; shouldRedirect?: boolean };
};
export type DialogType = DialogSchema["type"];
type DialogRendererEntry<T extends DialogType = DialogType> = {
type: T;
render: (dialog: Extract<DialogSchema, { type: T }>) => ReactNode;
};
export type AnyDialogRendererEntry = {
[T in DialogType]: DialogRendererEntry<T>;
}[DialogType];
export type DialogData<T extends DialogType> = Extract<DialogSchema, { type: T }>["data"];
type DialogPropsData<T extends DialogType> =
DialogData<T> extends undefined ? Record<string, never> : { data: DialogData<T> };
export type DialogProps<T extends DialogType> = DialogPropsData<T>;