From 0b340fd85f040d994dfeee31dc20a8bb3f8b97eb Mon Sep 17 00:00:00 2001 From: Thomas Joise Date: Mon, 13 Jul 2026 16:41:31 +0530 Subject: [PATCH] feat(hq-web): module quote-content live print preview Co-Authored-By: Claude Fable 5 --- apps/hq-web/src/pages/Modules.tsx | 36 ++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/apps/hq-web/src/pages/Modules.tsx b/apps/hq-web/src/pages/Modules.tsx index 219e2fd..7e6e4f4 100644 --- a/apps/hq-web/src/pages/Modules.tsx +++ b/apps/hq-web/src/pages/Modules.tsx @@ -1,10 +1,11 @@ -import { useState } from 'react' +import { useMemo, useState } from 'react' import { formatINR, fromRupees } from '@sims/domain' import { Badge, Button, DataTable, EmptyState, Field, Notice, PageHeader, Toolbar } from '@sims/ui' import { - addPrice, createModule, getModules, getPrices, patchModule, role, + addPrice, createModule, getModules, getPrices, patchModule, previewSample, role, KIND_LABEL, type Kind, type Module, } from '../api' +import { LivePreview } from '../components/LivePreview' import { useData } from './Clients' const ALL_KINDS: Kind[] = ['one_time', 'monthly', 'yearly', 'usage'] @@ -65,6 +66,8 @@ function QuoteContent(props: { module: Module; isOwner: boolean; onSaved: () => const [text, setText] = useState(props.module.quoteContent.join('\n')) const [saved, setSaved] = useState(false) const [error, setError] = useState() + const [commitNonce, setCommitNonce] = useState(0) + const previewBody = useMemo(() => JSON.stringify({ contentLines: splitLines(text) }), [text]) const save = () => { setError(undefined) @@ -77,16 +80,25 @@ function QuoteContent(props: { module: Module; isOwner: boolean; onSaved: () => <>

Quote content — {props.module.name}

{props.isOwner ? ( -
-