Full cleanup pass
This commit is contained in:
+12
-2
@@ -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
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user