Update API client and feedback form components
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0419adeba6
commit
71225cf2b0
|
|
@ -0,0 +1,10 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.vite
|
||||||
|
.DS_Store
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Env (keep .env.example)
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
@ -110,7 +110,10 @@ export function DynamicFeedbackForm({
|
||||||
) : null}
|
) : null}
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
{fields.map((f) => (
|
{fields.map((f) => (
|
||||||
<FieldInput key={String(f.label)} f={f} value={values[String(f.label).trim()]} onChange={setVal} />
|
<div key={String(f.label)} className="flex flex-col">
|
||||||
|
<FieldInput f={f} value={values[String(f.label).trim()]} onChange={setVal} />
|
||||||
|
<FieldRemarks text={f.remarks} />
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{err ? <p className="mt-3 text-sm text-red-600">{err}</p> : null}
|
{err ? <p className="mt-3 text-sm text-red-600">{err}</p> : null}
|
||||||
|
|
@ -130,6 +133,12 @@ function stripHtml(s: string): string {
|
||||||
return s.replace(/<[^>]*>/g, "").trim() || s;
|
return s.replace(/<[^>]*>/g, "").trim() || s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function FieldRemarks({ text }: { text?: string }) {
|
||||||
|
const trimmed = text?.trim();
|
||||||
|
if (!trimmed) return null;
|
||||||
|
return <p className="mt-1.5 text-xs leading-snug text-[rgba(36,40,47,0.55)]">{trimmed}</p>;
|
||||||
|
}
|
||||||
|
|
||||||
function FieldInput({
|
function FieldInput({
|
||||||
f,
|
f,
|
||||||
value,
|
value,
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,7 @@ export type VisitorPublicFeedbackFormField = {
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
options?: string[];
|
options?: string[];
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
remarks?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type VisitorPublicFeedbackForm = {
|
export type VisitorPublicFeedbackForm = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue