Full cleanup pass

This commit is contained in:
adilallo
2026-05-21 23:25:56 -06:00
parent 28de8ef3bc
commit 99f535f821
149 changed files with 2623 additions and 1242 deletions
+12 -2
View File
@@ -45,10 +45,20 @@ export function statShapeAssetPath(index: 1 | 2 | 3 | 4): string {
}
/**
* Statement / Section-Quote flanking ornaments (`public/assets/shapes/shape-qoute.svg`).
* Statement / Section-Quote flanking ornaments (`public/assets/shapes/shape-quote.svg`).
*/
export function quoteStatementShapePath(): string {
return "assets/shapes/shape-qoute.svg";
return "assets/shapes/shape-quote.svg";
}
/** ContentLockup decorative shape (Figma **22078:791901**). */
export function contentLockupShapePath(): string {
return "assets/shapes/shapes-1.svg";
}
/** TripleStep section ornament. */
export function tripleStepShapePath(): string {
return "assets/shapes/triple-step.svg";
}
/**
+13 -12
View File
@@ -8,19 +8,20 @@ async function parseJson<T>(response: Response): Promise<T> {
return data;
}
/** Supports legacy `{ error: string }` and `{ error: { message: string } }` from API routes. */
/** Reads `message` from API error JSON (canonical `{ error: { code, message } }` or legacy `{ error: string }`). */
function readApiErrorMessage(data: unknown): string {
if (!data || typeof data !== "object" || !("error" in data)) {
return "Request failed";
}
const err = (data as { error: unknown }).error;
if (typeof err === "string") {
return err;
}
if (err && typeof err === "object" && "message" in err) {
const m = (err as { message: unknown }).message;
if (typeof m === "string") {
return m;
if (data && typeof data === "object" && "error" in data) {
const err = (data as { error: unknown }).error;
if (typeof err === "string") {
return err;
}
if (
err &&
typeof err === "object" &&
"message" in err &&
typeof (err as { message: unknown }).message === "string"
) {
return (err as { message: string }).message;
}
}
return "Request failed";
+7
View File
@@ -0,0 +1,7 @@
/**
* Server draft sync for the create flow.
* Default-on: set `NEXT_PUBLIC_ENABLE_BACKEND_SYNC=false` to disable locally.
*/
export function isBackendSyncEnabled(): boolean {
return process.env.NEXT_PUBLIC_ENABLE_BACKEND_SYNC !== "false";
}