From 5ef139f81fcaef319640f72694385012f2f8e56c Mon Sep 17 00:00:00 2001
From: ngqile
Date: Tue, 1 Dec 2026 21:40:54 +0800
Subject: [PATCH] feat: My QR share and full screen, new-code notice, attended
and source on event leads
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
---
.../changes/add-event-invitations/tasks.md | 2 +-
.../app/components/app/AppShell.test.tsx | 8 ++
.../app/components/app/AppShell.tsx | 6 +-
.../app/components/app/NewCodeNotice.test.tsx | 57 ++++++++++++++
.../app/components/app/NewCodeNotice.tsx | 46 ++++++++++++
.../components/registration/QrCodeItem.tsx | 53 ++++++++++++-
.../app/design-tokens.test.ts | 2 +
.../[eventUuid]/[eventLeadUuid]/page.test.tsx | 18 +++++
.../[eventUuid]/[eventLeadUuid]/page.tsx | 8 ++
.../app/event-leads/[eventUuid]/page.test.tsx | 44 +++++++++++
.../app/event-leads/[eventUuid]/page.tsx | 30 +++++++-
.../app/lib/i18n/defaultMessages.ts | 12 +++
.../app/lib/services/adminEventLeads.test.ts | 11 ++-
.../app/lib/services/adminEventLeads.ts | 2 +-
.../app/lib/services/adminRegistration.ts | 2 +
solvway-admin-portal/app/lib/types.ts | 3 +
solvway-admin-portal/app/my-qr/page.test.tsx | 74 ++++++++++++++++++-
solvway-admin-portal/app/my-qr/page.tsx | 2 +-
18 files changed, 369 insertions(+), 11 deletions(-)
create mode 100644 solvway-admin-portal/app/components/app/NewCodeNotice.test.tsx
create mode 100644 solvway-admin-portal/app/components/app/NewCodeNotice.tsx
diff --git a/openspec/changes/add-event-invitations/tasks.md b/openspec/changes/add-event-invitations/tasks.md
index 9edf4d4..ff4b9b5 100644
--- a/openspec/changes/add-event-invitations/tasks.md
+++ b/openspec/changes/add-event-invitations/tasks.md
@@ -167,7 +167,7 @@ Every portal verify must report the exit codes of lint, tsc and vitest. Vitest e
- **`ROUTE_MODULES`:** maps the print route.
- Scope: `solvway-admin-portal/app/**`
- Verify: as 5.1
-- [ ] 5.3 My QR codes (Share, full screen), the new-code notice in the shell, and the event leads Attended column and filter, Source column and Attended checkbox in the edit form.
+- [x] 5.3 My QR codes (Share, full screen), the new-code notice in the shell, and the event leads Attended column and filter, Source column and Attended checkbox in the edit form.
- Depends on: 5.2, 3.3 (event leads part)
- Tests first:
- **Share:** uses `navigator.share` when present, otherwise the clipboard.
diff --git a/solvway-admin-portal/app/components/app/AppShell.test.tsx b/solvway-admin-portal/app/components/app/AppShell.test.tsx
index 639e879..f3c664a 100644
--- a/solvway-admin-portal/app/components/app/AppShell.test.tsx
+++ b/solvway-admin-portal/app/components/app/AppShell.test.tsx
@@ -14,6 +14,7 @@ vi.mock("@/app/lib/AdminAuthContext", () => ({
}));
vi.mock("./Sidebar", () => ({ default: () => }));
+vi.mock("./NewCodeNotice", () => ({ NewCodeNotice: () => }));
vi.mock("./Header", () => ({ default: () => }));
import AppShell from "./AppShell";
@@ -53,6 +54,13 @@ describe("AppShell", () => {
expect(nav.replace).not.toHaveBeenCalled();
});
+ it("shows the new-code notice in the signed-in shell", () => {
+ auth.loading = false;
+ auth.name = "Admin User";
+ render(content);
+ expect(screen.getByTestId("notice")).toBeInTheDocument();
+ });
+
it("shows the Containerverse credit under the content on small screens (the sidebar is hidden there)", () => {
auth.loading = false;
auth.name = "Admin User";
diff --git a/solvway-admin-portal/app/components/app/AppShell.tsx b/solvway-admin-portal/app/components/app/AppShell.tsx
index b4f53f1..f784d78 100644
--- a/solvway-admin-portal/app/components/app/AppShell.tsx
+++ b/solvway-admin-portal/app/components/app/AppShell.tsx
@@ -5,6 +5,7 @@ import { usePathname, useRouter } from "next/navigation";
import { useAdminAuth } from "@/app/lib/AdminAuthContext";
import { isPublicPath } from "@/app/lib/routeGuard";
import { CompanyScopeProvider } from "@/app/lib/CompanyScope";
+import { NewCodeNotice } from "./NewCodeNotice";
import Header from "./Header";
import Sidebar from "./Sidebar";
import PoweredBy from "./PoweredBy";
@@ -58,7 +59,10 @@ export default function AppShell({ children }: { children: React.ReactNode }) {
overflow-x-auto container. */}
-
{children}
+
+
+ {children}
+
{/* The sidebar (and its credit) is hidden below lg, so repeat the credit under the content there. */}
diff --git a/solvway-admin-portal/app/components/app/NewCodeNotice.test.tsx b/solvway-admin-portal/app/components/app/NewCodeNotice.test.tsx
new file mode 100644
index 0000000..1ef4408
--- /dev/null
+++ b/solvway-admin-portal/app/components/app/NewCodeNotice.test.tsx
@@ -0,0 +1,57 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { describe, it, expect, vi, beforeEach } from "vitest";
+
+const mocks = vi.hoisted(() => ({ getMyLinks: vi.fn() }));
+vi.mock("@/app/lib/services/adminRegistration", () => mocks);
+
+import { NewCodeNotice } from "./NewCodeNotice";
+
+const daysAgo = (n: number) => new Date(Date.now() - n * 86_400_000).toISOString();
+const link = (token: string, addedAt: string | null) => ({ eventUuid: "u", eventName: "KL Expo", startDate: "", endDate: "", location: "", token, enabled: true, addedAt });
+
+beforeEach(() => {
+ mocks.getMyLinks.mockReset();
+ localStorage.clear();
+});
+
+describe("NewCodeNotice", () => {
+ it("links to My QR codes for a code added within 7 days", async () => {
+ mocks.getMyLinks.mockResolvedValue([link("t1", daysAgo(1))]);
+ render(
);
+ const a = await screen.findByRole("link", { name: "My QR codes" });
+ expect(a.getAttribute("href")).toBe("/my-qr");
+ });
+
+ it("stays hidden for old codes and codes without addedAt", async () => {
+ mocks.getMyLinks.mockResolvedValue([link("t1", daysAgo(8)), link("t2", null)]);
+ render(
);
+ await vi.waitFor(() => expect(mocks.getMyLinks).toHaveBeenCalled());
+ expect(screen.queryByRole("link", { name: "My QR codes" })).toBeNull();
+ });
+
+ it("is dismissed per code, and stays dismissed after a reload", async () => {
+ mocks.getMyLinks.mockResolvedValue([link("t1", daysAgo(1))]);
+ const first = render(
);
+ await userEvent.click(await screen.findByRole("button", { name: "Dismiss" }));
+ expect(screen.queryByRole("link", { name: "My QR codes" })).toBeNull();
+ first.unmount();
+ render(
);
+ await vi.waitFor(() => expect(mocks.getMyLinks).toHaveBeenCalledTimes(2));
+ expect(screen.queryByRole("link", { name: "My QR codes" })).toBeNull();
+ });
+
+ it("shows again for a different new code", async () => {
+ localStorage.setItem("qrNoticeDismissed:t1", "1");
+ mocks.getMyLinks.mockResolvedValue([link("t1", daysAgo(1)), link("t2", daysAgo(2))]);
+ render(
);
+ await screen.findByRole("link", { name: "My QR codes" });
+ });
+
+ it("shows nothing when the codes cannot be loaded", async () => {
+ mocks.getMyLinks.mockRejectedValue(new Error("down"));
+ render(
);
+ await vi.waitFor(() => expect(mocks.getMyLinks).toHaveBeenCalled());
+ expect(screen.queryByRole("link")).toBeNull();
+ });
+});
diff --git a/solvway-admin-portal/app/components/app/NewCodeNotice.tsx b/solvway-admin-portal/app/components/app/NewCodeNotice.tsx
new file mode 100644
index 0000000..c3c2414
--- /dev/null
+++ b/solvway-admin-portal/app/components/app/NewCodeNotice.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import Link from "next/link";
+import { X } from "lucide-react";
+import { getMyLinks } from "@/app/lib/services/adminRegistration";
+import { useT } from "@/app/lib/i18n/MessagesProvider";
+
+const WEEK_MS = 7 * 86_400_000;
+const key = (token: string) => `qrNoticeDismissed:${token}`;
+const dismissed = (token: string) => {
+ try { return localStorage.getItem(key(token)) !== null; } catch { return false; }
+};
+
+/** Banner for personal codes added in the last 7 days; dismissed per code. */
+export function NewCodeNotice() {
+ const t = useT();
+ const [tokens, setTokens] = useState
([]);
+
+ useEffect(() => {
+ getMyLinks()
+ .then((links) => setTokens(links
+ .filter((l) => l.addedAt && Date.now() - Date.parse(l.addedAt) < WEEK_MS && !dismissed(l.token))
+ .map((l) => l.token)))
+ .catch(() => {}); // a notice is optional; stay silent if the codes cannot load
+ }, []);
+
+ if (tokens.length === 0) return null;
+
+ const dismiss = () => {
+ try { tokens.forEach((tk) => localStorage.setItem(key(tk), "1")); } catch { /* the notice just returns next load */ }
+ setTokens([]);
+ };
+
+ return (
+
+
+ {t("QrNewCode")}{" "}
+ {t("QrMyTitle")}
+
+
+
+ );
+}
diff --git a/solvway-admin-portal/app/components/registration/QrCodeItem.tsx b/solvway-admin-portal/app/components/registration/QrCodeItem.tsx
index 1b3a25f..e476011 100644
--- a/solvway-admin-portal/app/components/registration/QrCodeItem.tsx
+++ b/solvway-admin-portal/app/components/registration/QrCodeItem.tsx
@@ -2,8 +2,9 @@
import { useRef, useState } from "react";
import { QRCodeCanvas, QRCodeSVG } from "qrcode.react";
-import { Copy, Download } from "lucide-react";
+import { Copy, Download, Maximize2, Share2 } from "lucide-react";
import { Button } from "@/app/components/ui/button";
+import { Dialog, DialogContent } from "@/app/components/ui/dialog";
import { Switch } from "@/app/components/ui/switch";
import { useT } from "@/app/lib/i18n/MessagesProvider";
@@ -18,6 +19,7 @@ export function QrCodeItem({
enabled,
onToggle,
prefix = "r",
+ personal = false,
}: {
label: string;
eventName: string;
@@ -28,16 +30,36 @@ export function QrCodeItem({
onToggle?: (enabled: boolean) => void;
/** Public path the code opens: r = registration (default), c = check-in. */
prefix?: "r" | "c";
+ /** A user's own code (My QR codes): adds Share and Show full screen for use at the booth. */
+ personal?: boolean;
}) {
const t = useT();
const canvas = useRef(null);
const [copied, setCopied] = useState(false);
+ const [copyFailed, setCopyFailed] = useState(false);
+ const [full, setFull] = useState(false);
const link = `${window.location.origin}/${prefix}/${token}`;
async function copy() {
- await navigator.clipboard.writeText(link);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
+ try {
+ await navigator.clipboard.writeText(link);
+ setCopyFailed(false);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ } catch {
+ setCopied(false);
+ setCopyFailed(true);
+ }
+ }
+
+ async function share() {
+ if (!navigator.share) return copy();
+ try {
+ await navigator.share({ title: eventName, text: t("QrShareText", { event: eventName }), url: link });
+ } catch (err) {
+ // Dismissing the share sheet is an AbortError; anything else falls back to copying.
+ if ((err as { name?: string }).name !== "AbortError") return copy();
+ }
}
function download() {
@@ -64,9 +86,32 @@ export function QrCodeItem({
{t("QrDownload")}
+ {personal && (
+ <>
+
+
+ >
+ )}
{onToggle && }
+ {copyFailed &&
{t("CopyFailed")}
}
+ {personal && (
+
+ )}
);
}
diff --git a/solvway-admin-portal/app/design-tokens.test.ts b/solvway-admin-portal/app/design-tokens.test.ts
index 62c3371..ffcf1a9 100644
--- a/solvway-admin-portal/app/design-tokens.test.ts
+++ b/solvway-admin-portal/app/design-tokens.test.ts
@@ -22,6 +22,8 @@ const ALLOW: Record = {
// A QR code needs a light quiet zone to scan; a theme surface would put dark modules on dark in
// dark mode.
"app/pos/_components/SplitTenderPanel.tsx": ["bg-white"],
+ // The full-screen QR sits on a white quiet zone so it scans in dark mode.
+ "app/components/registration/QrCodeItem.tsx": ["bg-white"],
// A sent email's HTML is authored for a white mail-client canvas; a theme surface would put the
// email's dark text on dark in dark mode.
"app/email-templates/logs/[id]/page.tsx": ["bg-white"],
diff --git a/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.test.tsx b/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.test.tsx
index 7dbf5ff..689f6ce 100644
--- a/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.test.tsx
+++ b/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.test.tsx
@@ -240,4 +240,22 @@ describe("EventLeadPage", { timeout: 20000 }, () => {
await user.click(screen.getByRole("button", { name: "Save" }));
expect(await screen.findByRole("alert")).toHaveTextContent("Could not save the lead. Please try again.");
});
+
+ it("sends attended when staff tick it", async () => {
+ const user = await open();
+ await user.click(screen.getByLabelText("Attended"));
+ await user.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(mocks.updateEventLead).toHaveBeenCalledTimes(1));
+ expect(mocks.updateEventLead).toHaveBeenCalledWith("evt-1", "el-1", { ...PAYLOAD, attended: true });
+ });
+
+ it("shows a ticked Attended box for an attended lead and sends false when unticked", async () => {
+ const user = await open({ attended: true });
+ const box = screen.getByLabelText("Attended") as HTMLInputElement;
+ expect(box.checked).toBe(true);
+ await user.click(box);
+ await user.click(screen.getByRole("button", { name: "Save" }));
+ await waitFor(() => expect(mocks.updateEventLead).toHaveBeenCalledTimes(1));
+ expect(mocks.updateEventLead).toHaveBeenCalledWith("evt-1", "el-1", { ...PAYLOAD, attended: false });
+ });
});
diff --git a/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.tsx b/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.tsx
index cdca228..36e0474 100644
--- a/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.tsx
+++ b/solvway-admin-portal/app/event-leads/[eventUuid]/[eventLeadUuid]/page.tsx
@@ -49,6 +49,8 @@ function EventLead() {
const [interestIds, setInterestIds] = useState([]);
const [nextFollowUpDate, setNextFollowUpDate] = useState("");
const [notes, setNotes] = useState("");
+ // Sent only once staff touch the box, so saving other fields never changes attendance.
+ const [attended, setAttended] = useState(undefined);
const [fieldErrors, setFieldErrors] = useState>({});
const [formError, setFormError] = useState(null);
const [busy, setBusy] = useState(false);
@@ -124,6 +126,7 @@ function EventLead() {
interestIds,
nextFollowUpDate: nextFollowUpDate || null,
notes: notes.trim() || null,
+ attended,
});
router.push(back);
} catch (err) {
@@ -193,6 +196,11 @@ function EventLead() {
{fieldError("interestIds")}
+
+
{field("nextFollowUpDate", t("LeadNextFollowUp"),
)}
{field("notes", t("LeadNotes"),
diff --git a/solvway-admin-portal/app/event-leads/[eventUuid]/page.test.tsx b/solvway-admin-portal/app/event-leads/[eventUuid]/page.test.tsx
index 51d9a2f..467160d 100644
--- a/solvway-admin-portal/app/event-leads/[eventUuid]/page.test.tsx
+++ b/solvway-admin-portal/app/event-leads/[eventUuid]/page.test.tsx
@@ -121,6 +121,50 @@ describe("EventLeadsDetailPage (listing)", { timeout: 20000 }, () => {
});
});
+ it("shows Attended and Source as the last two columns", async () => {
+ mocks.listEventLeads.mockResolvedValue({
+ items: [{
+ eventLeadUuid: "el-1", eventUuid: "evt-1", leadUuid: "lead-1", name: "John Doe", mobile: null, email: null,
+ companyName: null, jobTitle: null, leadType: "NEW", salesperson: null, temperature: null, status: "OPEN",
+ interests: [], nextFollowUpDate: null, notes: null, capturedAt: "2025-06-01", attended: true, source: "INVITE",
+ }],
+ total: 1,
+ });
+ render();
+ const row = (await screen.findByRole("link", { name: "John Doe" })).closest("tr")!;
+ const headers = screen.getAllByRole("columnheader").map((h) => h.textContent);
+ expect(headers.slice(-2)).toEqual(["Attended", "Source"]);
+ const cells = within(row).getAllByRole("cell").map((c) => c.textContent);
+ expect(cells.slice(-2)).toEqual(["Yes", "Invite"]);
+ });
+
+ it("shows Attended and Source on the phone card", async () => {
+ mocks.listEventLeads.mockResolvedValue({
+ items: [{
+ eventLeadUuid: "el-1", eventUuid: "evt-1", leadUuid: "lead-1", name: "John Doe", mobile: null, email: null,
+ companyName: null, jobTitle: null, leadType: "NEW", salesperson: null, temperature: null, status: "OPEN",
+ interests: [], nextFollowUpDate: null, notes: null, capturedAt: "2025-06-01", attended: true, source: "QR",
+ }],
+ total: 1,
+ });
+ render();
+ const card = within(await screen.findByTestId("lead-card"));
+ expect(card.getByText("Attended: Yes")).toBeInTheDocument();
+ expect(card.getByText("Source: QR")).toBeInTheDocument();
+ });
+
+ it("filters by attendance for the list and the export", async () => {
+ const user = userEvent.setup();
+ render();
+ await user.click(await screen.findByRole("combobox", { name: /attended filter/i }));
+ await user.click(await screen.findByRole("option", { name: "Not attended" }));
+ await waitFor(() =>
+ expect(mocks.listEventLeads).toHaveBeenLastCalledWith("evt-1", expect.objectContaining({ attended: "false", page: 1 })),
+ );
+ await user.click(screen.getByRole("button", { name: "Export" }));
+ expect(mocks.exportEventLeads.mock.calls[0][1]).toEqual(expect.objectContaining({ attended: "false" }));
+ });
+
it("links each lead row/card to its detail page", async () => {
mocks.listEventLeads.mockResolvedValue({
items: [{
diff --git a/solvway-admin-portal/app/event-leads/[eventUuid]/page.tsx b/solvway-admin-portal/app/event-leads/[eventUuid]/page.tsx
index b0102de..8dbe684 100644
--- a/solvway-admin-portal/app/event-leads/[eventUuid]/page.tsx
+++ b/solvway-admin-portal/app/event-leads/[eventUuid]/page.tsx
@@ -22,10 +22,12 @@ import { useCompanyScope } from "@/app/lib/CompanyScope";
import { useT } from "@/app/lib/i18n/MessagesProvider";
import { formatDmy } from "@/app/lib/date-input";
-const DEFAULTS = { salespersonId: "", temperature: "", status: "", interestId: "", leadType: "" };
+const DEFAULTS = { salespersonId: "", temperature: "", status: "", interestId: "", leadType: "", attended: "" };
const TEMPERATURE_OPTIONS = [{ value: "HOT", label: "LeadHot" }, { value: "WARM", label: "LeadWarm" }, { value: "COLD", label: "LeadCold" }];
const STATUS_OPTIONS = [{ value: "OPEN", label: "LeadOpen" }, { value: "CONTACTED", label: "LeadContacted" }, { value: "QUALIFIED", label: "LeadQualified" }, { value: "WON", label: "LeadWon" }, { value: "LOST", label: "LeadLost" }];
const LEAD_TYPE_OPTIONS = [{ value: "NEW", label: "LeadNew" }, { value: "EXISTING", label: "LeadExisting" }];
+const ATTENDED_OPTIONS = [{ value: "true", label: "GuestAttended" }, { value: "false", label: "LeadNotAttended" }];
+const SOURCE_LABEL = { STAFF: "LeadSourceStaff", QR: "LeadSourceQr", INVITE: "LeadSourceInvite" } as const;
const TEMPERATURE_BADGE = { HOT: "negative", WARM: "warning", COLD: "neutral" } as const;
const STATUS_BADGE = { OPEN: "neutral", CONTACTED: "neutral", QUALIFIED: "contrast", WON: "positive", LOST: "negative" } as const;
@@ -136,6 +138,11 @@ function EventLeadsDetailPageContent() {
[t],
);
+ const attendedOptions = useMemo(
+ () => ATTENDED_OPTIONS.map((o) => ({ value: o.value, label: t(o.label) })),
+ [t],
+ );
+
const columns = useMemo[]>(
() => [
...(showCompanyColumn ? [{ id: "company", cell: ({ row }) => codeOf(row.original.companyId ?? 0), header: t("Company"), enableSorting: false } as ColumnDef] : []),
@@ -208,6 +215,18 @@ function EventLeadsDetailPageContent() {
enableSorting: false,
cell: ({ row }) => {row.original.nextFollowUpDate ? formatDmy(row.original.nextFollowUpDate) : "—"},
},
+ {
+ accessorKey: "attended",
+ header: t("GuestAttended"),
+ enableSorting: false,
+ cell: ({ row }) => {row.original.attended == null ? "—" : t(row.original.attended ? "Yes" : "No")},
+ },
+ {
+ accessorKey: "source",
+ header: t("LeadSource"),
+ enableSorting: false,
+ cell: ({ row }) => {row.original.source ? t(SOURCE_LABEL[row.original.source]) : "—"},
+ },
],
[t, showCompanyColumn, codeOf],
);
@@ -254,6 +273,9 @@ function EventLeadsDetailPageContent() {
set({ leadType })} />
+
+ set({ attended })} />
+
{/* Desktop table (md+) */}
@@ -296,6 +318,12 @@ function EventLeadsDetailPageContent() {
{t("LeadNextFollowUp")}: {lead.nextFollowUpDate ? formatDmy(lead.nextFollowUpDate) : "—"}
+
+ {t("GuestAttended")}: {lead.attended == null ? "—" : t(lead.attended ? "Yes" : "No")}
+
+
+ {t("LeadSource")}: {lead.source ? t(SOURCE_LABEL[lead.source]) : "—"}
+
))}
{data.items.length === 0 && !loading && (
diff --git a/solvway-admin-portal/app/lib/i18n/defaultMessages.ts b/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
index 059ca59..bf461fd 100644
--- a/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
+++ b/solvway-admin-portal/app/lib/i18n/defaultMessages.ts
@@ -240,6 +240,7 @@ export const DEFAULT_MESSAGES: Record = {
RolColRole: "Role",
RolManageAccess: "Manage access",
RolNoRoles: "No roles found",
+ Yes: "Yes",
No: "No",
// Event form messages
EvtNameRequired: "Name is required.",
@@ -312,6 +313,12 @@ export const DEFAULT_MESSAGES: Record = {
LeadStatusFilter: "Status filter",
LeadInterestFilter: "Interest filter",
LeadLeadTypeFilter: "Lead type filter",
+ LeadAttendedFilter: "Attended filter",
+ LeadNotAttended: "Not attended",
+ LeadSource: "Source",
+ LeadSourceStaff: "Staff",
+ LeadSourceQr: "QR",
+ LeadSourceInvite: "Invite",
LeadHot: "Hot",
LeadWarm: "Warm",
LeadCold: "Cold",
@@ -510,6 +517,11 @@ export const DEFAULT_MESSAGES: Record = {
QrSaveFailed: "Could not change the code.",
QrMyTitle: "My QR codes",
QrSwitchedOff: "Switched off",
+ QrShare: "Share",
+ QrShareText: "Register for {event}",
+ QrFullScreen: "Show full screen",
+ QrNewCode: "You have a new registration code.",
+ QrDismiss: "Dismiss",
QrMyNone: "You have no registration codes yet.",
PrivNotice: "Privacy notice",
PrivSave: "Save notice",
diff --git a/solvway-admin-portal/app/lib/services/adminEventLeads.test.ts b/solvway-admin-portal/app/lib/services/adminEventLeads.test.ts
index 1973954..1452d10 100644
--- a/solvway-admin-portal/app/lib/services/adminEventLeads.test.ts
+++ b/solvway-admin-portal/app/lib/services/adminEventLeads.test.ts
@@ -1,10 +1,11 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
-const mocks = vi.hoisted(() => ({ apiGet: vi.fn(), apiPost: vi.fn(), apiPut: vi.fn() }));
+const mocks = vi.hoisted(() => ({ apiGet: vi.fn(), apiPost: vi.fn(), apiPut: vi.fn(), apiDownload: vi.fn() }));
vi.mock("@/app/lib/clientApi", () => mocks);
import {
captureEventLead,
+ exportEventLeads,
getEventLead,
listEventLeadEvents,
listEventLeadInterests,
@@ -40,6 +41,14 @@ describe("adminEventLeads", () => {
expect(out).toEqual({ items: [{ eventLeadUuid: "1" }], total: 41 });
});
+ it("sends the attended filter to the list and to the export", async () => {
+ mocks.apiGet.mockResolvedValue({ content: [], totalElements: 0 });
+ await listEventLeads("9", { page: 1, pageSize: 20, attended: "false" });
+ expect(mocks.apiGet).toHaveBeenCalledWith("/api/event-leads/9/leads?attended=false&page=0&size=20");
+ await exportEventLeads("9", { attended: "true" });
+ expect(mocks.apiDownload).toHaveBeenCalledWith("/api/event-leads/9/export?attended=true", "event-leads.xlsx");
+ });
+
it("treats a malformed page as empty", async () => {
mocks.apiGet.mockResolvedValue(null);
expect(await listEventLeads("9", { page: 1, pageSize: 20 })).toEqual({ items: [], total: 0 });
diff --git a/solvway-admin-portal/app/lib/services/adminEventLeads.ts b/solvway-admin-portal/app/lib/services/adminEventLeads.ts
index edd5138..4f31f7a 100644
--- a/solvway-admin-portal/app/lib/services/adminEventLeads.ts
+++ b/solvway-admin-portal/app/lib/services/adminEventLeads.ts
@@ -10,7 +10,7 @@ import type {
} from "@/app/lib/types";
const BASE = "/api/event-leads";
-const FILTERS = ["salespersonId", "temperature", "status", "interestId", "leadType"] as const;
+const FILTERS = ["salespersonId", "temperature", "status", "interestId", "leadType", "attended"] as const;
export type EventLeadFilters = Partial>;
diff --git a/solvway-admin-portal/app/lib/services/adminRegistration.ts b/solvway-admin-portal/app/lib/services/adminRegistration.ts
index 4e3ef57..5ecac9d 100644
--- a/solvway-admin-portal/app/lib/services/adminRegistration.ts
+++ b/solvway-admin-portal/app/lib/services/adminRegistration.ts
@@ -14,6 +14,8 @@ export interface MyLink extends RegistrationLink {
startDate: string;
endDate: string;
location: string;
+ /** When the caller joined the event team; null on older rows. */
+ addedAt?: string | null;
}
export interface PrivacyNotice {
id: number;
diff --git a/solvway-admin-portal/app/lib/types.ts b/solvway-admin-portal/app/lib/types.ts
index 5be2dba..cad9a0a 100644
--- a/solvway-admin-portal/app/lib/types.ts
+++ b/solvway-admin-portal/app/lib/types.ts
@@ -246,6 +246,8 @@ export interface EventLeadRow {
notes: string | null;
capturedAt: string;
companyId?: number;
+ attended?: boolean;
+ source?: "STAFF" | "QR" | "INVITE";
}
export interface EventLeadUpdatePayload {
@@ -255,6 +257,7 @@ export interface EventLeadUpdatePayload {
interestIds?: number[];
nextFollowUpDate?: string | null;
notes?: string | null;
+ attended?: boolean;
}
export interface EventLeadCapturePayload extends EventLeadUpdatePayload {
diff --git a/solvway-admin-portal/app/my-qr/page.test.tsx b/solvway-admin-portal/app/my-qr/page.test.tsx
index 2fe97ef..8be1053 100644
--- a/solvway-admin-portal/app/my-qr/page.test.tsx
+++ b/solvway-admin-portal/app/my-qr/page.test.tsx
@@ -1,5 +1,6 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
-import { render, screen } from "@testing-library/react";
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
const mocks = vi.hoisted(() => ({ getMyLinks: vi.fn() }));
vi.mock("@/app/lib/services/adminRegistration", () => mocks);
@@ -39,4 +40,75 @@ describe("My QR codes", () => {
render();
await screen.findByText("You have no registration codes yet.");
});
+
+ describe("Share and full screen", () => {
+ const LINK = { eventUuid: "u1", eventName: "Expo 2026", startDate: "2026-12-01", endDate: "2026-12-02", location: "KLCC", token: "t1", enabled: true };
+ const origin = () => `${window.location.origin}/r/t1`;
+ const setNav = (props: object) => Object.defineProperty(navigator, "share", { value: undefined, configurable: true, ...props });
+ const setClipboard = (writeText: unknown) => Object.defineProperty(navigator, "clipboard", { value: { writeText }, configurable: true });
+
+ it("opens the share sheet with the link when the device has one", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ const share = vi.fn().mockResolvedValue(undefined);
+ setNav({ value: share });
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Share" }));
+ expect(share).toHaveBeenCalledWith(expect.objectContaining({ url: origin() }));
+ });
+
+ it("does nothing more when the user dismisses the share sheet", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ setNav({ value: vi.fn().mockRejectedValue(new DOMException("cancelled", "AbortError")) });
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ setClipboard(writeText);
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Share" }));
+ await waitFor(() => expect(navigator.share).toHaveBeenCalled());
+ expect(writeText).not.toHaveBeenCalled();
+ expect(screen.queryByText("Link copied")).toBeNull();
+ });
+
+ it("copies the link when the share sheet fails for another reason", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ setNav({ value: vi.fn().mockRejectedValue(new DOMException("blocked", "NotAllowedError")) });
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ setClipboard(writeText);
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Share" }));
+ expect(writeText).toHaveBeenCalledWith(origin());
+ await screen.findByText("Link copied");
+ });
+
+ it("copies the link when there is no share sheet, and says so", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ setNav({ value: undefined });
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ setClipboard(writeText);
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Share" }));
+ expect(writeText).toHaveBeenCalledWith(origin());
+ await screen.findByText("Link copied");
+ });
+
+ it("says when the link could not be copied", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ setNav({ value: undefined });
+ setClipboard(vi.fn().mockRejectedValue(new Error("denied")));
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Share" }));
+ await screen.findByText("Could not copy.");
+ });
+
+ it("shows only the QR full screen, and Escape returns", async () => {
+ mocks.getMyLinks.mockResolvedValue([LINK]);
+ render();
+ await userEvent.click(await screen.findByRole("button", { name: "Show full screen" }));
+ const dialog = await screen.findByRole("dialog");
+ expect(dialog.querySelector("[data-testid=qr-svg]")?.getAttribute("data-value")).toBe(origin());
+ expect(dialog.textContent).toBe("Close"); // the sr-only close label; no link, buttons or event text
+ expect(dialog.querySelectorAll("button")).toHaveLength(1);
+ await userEvent.keyboard("{Escape}");
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ });
+ });
});
diff --git a/solvway-admin-portal/app/my-qr/page.tsx b/solvway-admin-portal/app/my-qr/page.tsx
index 4d42280..e3bebf5 100644
--- a/solvway-admin-portal/app/my-qr/page.tsx
+++ b/solvway-admin-portal/app/my-qr/page.tsx
@@ -30,7 +30,7 @@ export default function MyQrPage() {
{l.startDate} - {l.endDate} | {l.location}
{!l.enabled && {t("QrSwitchedOff")}}
-
+
))}