{words}
{card}
@@ -164,7 +164,7 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
return (
);
case "FEATURES":
@@ -221,6 +221,21 @@ function Block({ block, index, company, slug, preview, edit }: { block: PublicBl
{button}
);
+ case "FOOTER":
+ // add-landing-thanks-and-footer: columns of title and text with contact links, the legal line under a divider.
+ return (
+
+ );
default:
return null;
}
diff --git a/solvway-admin-portal/app/components/pages/CmsEdit.tsx b/solvway-admin-portal/app/components/pages/CmsEdit.tsx
index 97c90fb..1fd42a8 100644
--- a/solvway-admin-portal/app/components/pages/CmsEdit.tsx
+++ b/solvway-admin-portal/app/components/pages/CmsEdit.tsx
@@ -4,6 +4,7 @@ import { createContext, useContext, useLayoutEffect, useRef, type ElementType, t
import dynamic from "next/dynamic";
import { ImagePlus } from "lucide-react";
import { BLOCK_LABELS, type CmsBlock } from "@/app/lib/cmsPages";
+import { contactLinks } from "@/app/lib/contactLinks";
import { useT } from "@/app/lib/i18n/MessagesProvider";
// add-page-visual-editor: the landing page in edit mode, on the on-page editor's canvas. The public page and the
@@ -45,7 +46,7 @@ export function setField(block: CmsBlock, path: string, value: string): CmsBlock
* A plain text field: the text as-is on the public page; in edit mode the same element, typed into in place. It is
* never re-rendered from its value while focused, so the caret stays where it is.
*/
-export function Text({ as: Tag, index, path, value, max, code, n, className, multiline }: {
+export function Text({ as: Tag, index, path, value, max, code, n, className, multiline, links }: {
as: ElementType;
index: number;
path: string;
@@ -56,9 +57,11 @@ export function Text({ as: Tag, index, path, value, max, code, n, className, mul
n?: number;
className?: string;
multiline?: boolean;
+ /** Outside the editor, show contact details as links (add-landing-thanks-and-footer). */
+ links?: boolean;
}) {
const edit = useEdit();
- if (!edit) return value ?
{value} : null;
+ if (!edit) return value ?
{links ? contactLinks(value) : value} : null;
return
;
}
diff --git a/solvway-admin-portal/app/components/pages/LandingForm.tsx b/solvway-admin-portal/app/components/pages/LandingForm.tsx
index 7c1c2b3..a26048c 100644
--- a/solvway-admin-portal/app/components/pages/LandingForm.tsx
+++ b/solvway-admin-portal/app/components/pages/LandingForm.tsx
@@ -7,6 +7,7 @@ import { VisitorState } from "@/app/components/registration/VisitorCard";
import { RegistrationForm } from "@/app/components/registration/RegistrationForm";
import { publicCall, type RegistrationBody, type RegistrationInfo } from "@/app/lib/services/publicRegistration";
import { useT } from "@/app/lib/i18n/MessagesProvider";
+import { contactLinks } from "@/app/lib/contactLinks";
const UTM = ["utm_source", "utm_medium", "utm_campaign"] as const;
@@ -18,7 +19,8 @@ export function utmTags(search: string): { utmSource?: string; utmMedium?: strin
}
// A landing page's FORM block: the QR sign-up form, posting to the page's block, with the visitor's UTM tags.
-export function LandingForm({ companyCode, slug, index, info, preview }: { companyCode: string; slug: string; index: number; info?: RegistrationInfo; preview?: boolean }) {
+// add-landing-thanks-and-footer: `thanks` is the page's own text under the thank-you, with contact links.
+export function LandingForm({ companyCode, slug, index, info, preview, thanks }: { companyCode: string; slug: string; index: number; info?: RegistrationInfo; preview?: boolean; thanks?: string }) {
const t = useT();
const [phase, setPhase] = useState<"form" | "done" | "closed">(info ? "form" : "closed");
@@ -26,6 +28,7 @@ export function LandingForm({ companyCode, slug, index, info, preview }: { compa
if (phase === "closed" || !info) return
;
if (phase === "done") {
return
setPhase("form")}>{t("RegAnother")}} />;
}
const submit = (body: RegistrationBody) =>
diff --git a/solvway-admin-portal/app/components/pages/PageEditor.sections.test.tsx b/solvway-admin-portal/app/components/pages/PageEditor.sections.test.tsx
index c2df726..f8578a7 100644
--- a/solvway-admin-portal/app/components/pages/PageEditor.sections.test.tsx
+++ b/solvway-admin-portal/app/components/pages/PageEditor.sections.test.tsx
@@ -76,6 +76,31 @@ describe("PageEditor: sections", () => {
expect(within(within(block).getByRole("group", { name: "Step 6" })).getByRole("button", { name: "Remove" })).toBeEnabled();
});
+ // add-landing-thanks-and-footer: a dark footer of 1 to 4 columns with a legal line.
+ it("adds a dark footer with columns and a legal line, and keeps 1 to 4 columns", async () => {
+ const user = userEvent.setup();
+ render();
+ await screen.findByDisplayValue("How it works");
+ await user.click(screen.getByRole("button", { name: "Add Footer" }));
+ const block = group("Block 3: Footer");
+ expect(within(block).getByLabelText("Look")).toHaveValue("DARK");
+ const col1 = within(block).getByRole("group", { name: "Column 1" });
+ await user.type(within(col1).getByLabelText("Title"), "Talk to us");
+ await user.type(within(col1).getByLabelText("Text"), "+603-7623 9807");
+ await user.click(within(within(block).getByRole("group", { name: "Column 2" })).getByRole("button", { name: "Remove" }));
+ expect(within(col1).getByRole("button", { name: "Remove" })).toBeDisabled();
+ await user.type(within(block).getByLabelText("Legal line"), "© 2026 INS");
+ const add = within(block).getByRole("button", { name: "Add column" });
+ for (let i = 0; i < 3; i++) await user.click(add);
+ expect(add).toBeDisabled();
+ for (const n of [4, 3, 2]) await user.click(within(within(block).getByRole("group", { name: `Column ${n}` })).getByRole("button", { name: "Remove" }));
+ await user.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(mocks.savePage).toHaveBeenCalled());
+ expect(mocks.savePage.mock.calls[0][1].blocks[2]).toEqual({
+ type: "FOOTER", look: "DARK", text: "© 2026 INS", cards: [{ title: "Talk to us", text: "+603-7623 9807" }],
+ });
+ });
+
it("offers no look for a Custom HTML block", async () => {
render();
await screen.findByDisplayValue("How it works");
diff --git a/solvway-admin-portal/app/components/pages/PageEditor.test.tsx b/solvway-admin-portal/app/components/pages/PageEditor.test.tsx
index 8029dd5..07f23b4 100644
--- a/solvway-admin-portal/app/components/pages/PageEditor.test.tsx
+++ b/solvway-admin-portal/app/components/pages/PageEditor.test.tsx
@@ -152,6 +152,27 @@ describe("PageEditor", () => {
expect([hero.formHeading, hero.formText]).toEqual([undefined, undefined]);
});
+ // add-landing-thanks-and-footer: the hero's thank-you text, only while it has a form.
+ it("saves a hero's thank-you text; No form drops it", async () => {
+ const user = userEvent.setup();
+ render();
+ const picker = await screen.findByLabelText("Sign-up form");
+ // The FORM block (block 2) has its own thank-you field; these checks are the hero's.
+ const hero = () => within(screen.getByRole("group", { name: /^Block 1/ }));
+ expect(hero().queryByLabelText("Thank-you text")).not.toBeInTheDocument();
+ await waitFor(() => expect(within(picker).getByRole("option", { name: "Website enquiries" })).toBeInTheDocument());
+ await user.selectOptions(picker, "3312726793093644288");
+ await user.type(hero().getByLabelText("Thank-you text"), "Call +60 12-833 2775.");
+ await user.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(mocks.savePage).toHaveBeenCalledTimes(1));
+ expect(mocks.savePage.mock.calls[0][1].blocks[0]).toMatchObject({ type: "HERO", thanksText: "Call +60 12-833 2775." });
+ await user.selectOptions(screen.getByLabelText("Sign-up form"), "");
+ expect(hero().queryByLabelText("Thank-you text")).not.toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(mocks.savePage).toHaveBeenCalledTimes(2));
+ expect(mocks.savePage.mock.calls[1][1].blocks[0].thanksText).toBeUndefined();
+ });
+
it("a super admin must choose a company for a new page", async () => {
mocks.useAdminAuth.mockReturnValue({ isSuper: true, companyCode: null });
const user = userEvent.setup();
diff --git a/solvway-admin-portal/app/components/pages/usePageDraft.test.tsx b/solvway-admin-portal/app/components/pages/usePageDraft.test.tsx
index 61bf758..1f63c24 100644
--- a/solvway-admin-portal/app/components/pages/usePageDraft.test.tsx
+++ b/solvway-admin-portal/app/components/pages/usePageDraft.test.tsx
@@ -68,6 +68,14 @@ describe("usePageDraft for the on-page editor", () => {
expect(result.current.rows[0].block).toEqual({ type: "HERO", heading: "Hi", eventUuid: null });
});
+ // add-landing-thanks-and-footer: a hero's thank-you text goes with its form too.
+ it("a company switch also drops a hero's thank-you text", async () => {
+ mocks.getPage.mockResolvedValueOnce({ ...stored, blocks: [{ type: "HERO" as const, heading: "Hi", eventUuid: "77", thanksText: "Call us." }] });
+ const { result } = await loaded();
+ act(() => result.current.changeCompany(3));
+ expect(result.current.rows[0].block).toEqual({ type: "HERO", heading: "Hi", eventUuid: null });
+ });
+
it("keeps the company's branding from the loaded page", async () => {
const { result } = await loaded();
expect(result.current.branding).toEqual(stored.company);
diff --git a/solvway-admin-portal/app/components/pages/usePageDraft.ts b/solvway-admin-portal/app/components/pages/usePageDraft.ts
index 294fdd4..67c3c61 100644
--- a/solvway-admin-portal/app/components/pages/usePageDraft.ts
+++ b/solvway-admin-portal/app/components/pages/usePageDraft.ts
@@ -193,14 +193,14 @@ export function usePageDraft({ pageId, fromId, initialBlocks }: { pageId?: numbe
};
/**
* A super admin's new page changes company: FORM blocks and hero sign-up forms lose their event, which belongs to the old one,
- * and a hero's form heading and text go with its form (add-hero-full-width).
+ * and a hero's form heading, form text and thank-you text go with its form (add-hero-full-width, add-landing-thanks-and-footer).
*/
const changeCompany = (companyId: number) => {
step(null);
setDraft((d) => ({ ...d, companyId }));
setRows((rs) => rs.map((r) => {
if (!r.block.eventUuid) return r;
- const { formHeading: _h, formText: _t, ...block } = r.block;
+ const { formHeading: _h, formText: _t, thanksText: _k, ...block } = r.block;
return { ...r, block: { ...block, eventUuid: null } };
}));
};
diff --git a/solvway-admin-portal/app/components/registration/VisitorCard.tsx b/solvway-admin-portal/app/components/registration/VisitorCard.tsx
index 4c51614..d86f405 100644
--- a/solvway-admin-portal/app/components/registration/VisitorCard.tsx
+++ b/solvway-admin-portal/app/components/registration/VisitorCard.tsx
@@ -34,7 +34,7 @@ export function VisitorCard({ event, title, children }: { event?: EventHeader; t
interface StateProps {
icon: LucideIcon;
heading: string;
- text?: string;
+ text?: ReactNode;
action?: ReactNode;
role?: "status" | "alert";
tone?: "default" | "error";
@@ -52,7 +52,7 @@ export function VisitorState({ icon: Icon, heading, text, action, role, tone = "
{heading}
- {text && {text}
}
+ {text && {text}
}
{action}
);
diff --git a/solvway-admin-portal/app/lib/cmsPages.ts b/solvway-admin-portal/app/lib/cmsPages.ts
index b97e1cb..c4a659a 100644
--- a/solvway-admin-portal/app/lib/cmsPages.ts
+++ b/solvway-admin-portal/app/lib/cmsPages.ts
@@ -3,9 +3,9 @@
import { Calendar, Cloud, Headset, Lock, Monitor, Phone, ShieldCheck, Star, Tv, Users, Wifi, Wrench, type LucideIcon } from "lucide-react";
-export type BlockType = "HERO" | "RICH_TEXT" | "IMAGE_TEXT" | "FAQ" | "FORM" | "HTML" | "FEATURES" | "STEPS" | "TRUST" | "CTA";
+export type BlockType = "HERO" | "RICH_TEXT" | "IMAGE_TEXT" | "FAQ" | "FORM" | "HTML" | "FEATURES" | "STEPS" | "TRUST" | "CTA" | "FOOTER";
-export const BLOCK_TYPES: BlockType[] = ["HERO", "RICH_TEXT", "IMAGE_TEXT", "FEATURES", "STEPS", "TRUST", "CTA", "FAQ", "FORM", "HTML"];
+export const BLOCK_TYPES: BlockType[] = ["HERO", "RICH_TEXT", "IMAGE_TEXT", "FEATURES", "STEPS", "TRUST", "CTA", "FAQ", "FORM", "HTML", "FOOTER"];
/** Feature-card icons by the name services-counter accepts (add-page-sections). */
export const ICONS: Record