mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: the content document
This commit is contained in:
@@ -36,40 +36,29 @@ export const SUPPORT_CONTENT_DEFAULTS: SupportDocPayloadMap = {
|
||||
{
|
||||
id: "help-walkthrough",
|
||||
heading: "Portal walkthrough",
|
||||
body: "A guided tour of the portal — registering your company, raising a booking against a contract, and settling an invoice.",
|
||||
media: [
|
||||
{
|
||||
id: "help-walkthrough-video",
|
||||
kind: "video",
|
||||
// Ships with the app rather than MinIO, so it is used verbatim.
|
||||
src: "/assets/edr-portal-guide.webm",
|
||||
caption: null,
|
||||
},
|
||||
],
|
||||
// The video ships with the app rather than MinIO, so its path is used
|
||||
// verbatim; the renderer picks <video> from the extension.
|
||||
body: "A guided tour of the portal — registering your company, raising a booking against a contract, and settling an invoice.\n\n",
|
||||
},
|
||||
{
|
||||
id: "help-chat",
|
||||
heading: "Chat with our team",
|
||||
body: "Signed-in customers can open a support conversation from the headset button at the bottom right of every portal page. You can send screenshots and documents in the chat, and replies appear there and as a notification.\n\n[Open the portal](/portal)",
|
||||
media: [],
|
||||
},
|
||||
{
|
||||
id: "help-contact",
|
||||
heading: "Contact us",
|
||||
body: "- **Email** — [{{supportEmail}}](mailto:{{supportEmail}}). Best for document issues and anything needing an attachment.\n- **Phone** — [{{supportPhone}}](tel:{{supportPhoneTel}}). Best for urgent problems with cargo already in transit.\n- **Head office** — {{supportOffice}}. Walk-in support during working hours.\n- **Support hours** — {{supportHours}}. Outside these hours, email us and we reply the next working day.",
|
||||
media: [],
|
||||
},
|
||||
{
|
||||
id: "help-topics",
|
||||
heading: "Common topics",
|
||||
body: "- **[Account & onboarding](/faq)** — registering your company, uploading your trade licence and TIN, and getting an operational profile approved.\n- **[Contracts](/faq)** — requesting a freight contract, reviewing its terms and signing it with your saved signature and stamp.\n- **[Bookings & tracking](/faq)** — raising a booking against a contract, adding last-mile transport and following the consignment along the corridor.\n- **[Invoices & payments](/faq)** — finding invoices, paying through the bank channels and confirming a payment that has not yet settled.",
|
||||
media: [],
|
||||
},
|
||||
{
|
||||
id: "help-checklist",
|
||||
heading: "What to include when you contact us",
|
||||
body: "- Your company name and the email you sign in with.\n- The reference of the contract, booking or invoice involved.\n- What you expected to happen and what happened instead.\n- A screenshot of any error message the portal showed.",
|
||||
media: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -38,17 +38,27 @@ export const SUPPORT_MEDIA_MAX_BYTES = 50 * 1024 * 1024;
|
||||
|
||||
export type PortalMediaKind = "image" | "video";
|
||||
|
||||
/** An image or video attached to a help section. */
|
||||
export interface PortalMedia {
|
||||
id: string;
|
||||
kind: PortalMediaKind;
|
||||
/**
|
||||
* Stored: a MinIO object key, a same-origin `/path`, or an `https://` URL.
|
||||
* Served: the same value with MinIO keys replaced by a fresh presigned URL —
|
||||
* the API rewrites this field in place, so the portal just renders it.
|
||||
*/
|
||||
src: string;
|
||||
caption?: string | null;
|
||||
/**
|
||||
* Extensions the portal renders as a `<video>` rather than an `<img>`.
|
||||
*
|
||||
* Images and videos are both inserted with markdown's image syntax —
|
||||
* `` — so an author drops media into
|
||||
* the text in one flow and it stays where they put it. The renderer picks the
|
||||
* element from the extension; nothing extra is stored.
|
||||
*/
|
||||
export const PORTAL_VIDEO_EXTENSIONS = [
|
||||
".mp4",
|
||||
".webm",
|
||||
".ogg",
|
||||
".ogv",
|
||||
".mov",
|
||||
".m4v",
|
||||
] as const;
|
||||
|
||||
/** True when a media URL or key should render as a video. */
|
||||
export function isPortalVideoSrc(src: string): boolean {
|
||||
const path = src.split(/[?#]/)[0].toLowerCase();
|
||||
return PORTAL_VIDEO_EXTENSIONS.some((ext) => path.endsWith(ext));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,31 +136,19 @@ export interface PortalFaqContent {
|
||||
}
|
||||
|
||||
/**
|
||||
* One free-form block of the help page: a heading, a full markdown body, and
|
||||
* any number of attached images or videos.
|
||||
* Slug `HELP`. Free-form: an ordered list of sections, each a heading plus a
|
||||
* markdown body, with images and videos embedded in the body itself.
|
||||
*
|
||||
* Deliberately not a fixed set of typed blocks (video / channels / topics /
|
||||
* checklist, as this once was). The help page is the one document whose shape
|
||||
* genuinely changes with what support needs to explain that quarter, so it is
|
||||
* built rather than filled in — add, reorder and delete sections freely.
|
||||
* built rather than filled in — and it shares {@link PortalDocSection} with the
|
||||
* legal documents, so every tab is edited the same way.
|
||||
*/
|
||||
export interface PortalHelpSection {
|
||||
id: string;
|
||||
heading: string;
|
||||
/**
|
||||
* Markdown. Embedded images reference uploads as
|
||||
* `` — see {@link PORTAL_MEDIA_URI_SCHEME}.
|
||||
*/
|
||||
body: string;
|
||||
/** Rendered under the body, in order. */
|
||||
media: PortalMedia[];
|
||||
}
|
||||
|
||||
/** Slug `HELP`. */
|
||||
export interface PortalHelpContent {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
sections: PortalHelpSection[];
|
||||
sections: PortalDocSection[];
|
||||
}
|
||||
|
||||
/** Payload shape per slug — the jsonb column's type, keyed by document. */
|
||||
|
||||
Reference in New Issue
Block a user