Skip setup questions on the template path and collect name, photo, and description without recommendations.

Customize opens a dialog then walks the template decks; Use without changes lands on final review with Has Name Field. Template cards stay first, the engine is not called, and the catalog no longer shows a recommended tag.
This commit is contained in:
adilallo committed 2026-11-09 17:34:33 -07:00
1 parent 53d236d0d5
commit 6498d52541
37 files changed
+1450 -733

No files matched your search

+97 -5
View File
@@ -4,8 +4,11 @@ import Image from "next/image";
import NextLink from "next/link";
import MultiSelect from "../../controls/MultiSelect";
import InlineTextButton from "../../buttons/InlineTextButton";
import TextInput from "../../controls/TextInput";
import TextArea from "../../controls/TextArea";
import NavigationLink from "../../navigation/Link";
import Tag from "../../utility/Tag";
import InputLabel from "../../type/InputLabel";
import type { RuleBottomLink, RuleViewProps } from "./Rule.types";
export function RuleView({
@@ -40,6 +43,17 @@ export function RuleView({
surfaceColor,
cardAriaLabel,
recommendedLabel,
hasNameField = false,
nameValue = "",
nameLabel,
namePlaceholder,
onNameChange,
descriptionLabel,
descriptionPlaceholder,
descriptionHelperText,
onDescriptionChange,
onLogoClick,
logoUploadAriaLabel,
}: RuleViewProps) {
const ariaLabel = cardAriaLabel;
const interactiveCard = interactive ?? !hasBottomLinks;
@@ -229,9 +243,39 @@ export function RuleView({
);
}
if (hasNameField) {
return (
<span
className={`${logoContainerClass} flex items-center justify-center rounded-full border border-dashed border-[var(--color-content-invert-primary)] text-[24px] leading-none text-[var(--color-content-invert-primary)]`}
aria-hidden={onLogoClick ? true : undefined}
>
+
</span>
);
}
return null;
};
const renderLogoControl = () => {
const inner = renderLogo();
if (!inner) return null;
if (!onLogoClick) return inner;
return (
<button
type="button"
className="cursor-pointer rounded-full p-0"
aria-label={logoUploadAriaLabel}
onClick={(event) => {
event.stopPropagation();
onLogoClick();
}}
>
{inner}
</button>
);
};
// Border radius - use CSS classes if provided via className, otherwise use size-based logic
const borderRadiusClass = className?.includes("rounded-")
? "" // If className already has border radius, don't add size-based one
@@ -291,12 +335,36 @@ export function RuleView({
.join(" ");
const showExpandedDescription = Boolean(
hasNameField ||
description ||
(onDescriptionClick && typeof descriptionEmptyHint === "string"),
);
const expandedDescription = showExpandedDescription ? (
<div className={expandedDescriptionFrameClass}>
{onDescriptionClick ? (
{hasNameField && onDescriptionChange ? (
<div
className="flex w-full min-w-0 flex-col gap-[6px]"
data-testid="rule-description-field"
onClick={(event) => event.stopPropagation()}
>
<InputLabel
label={descriptionLabel ?? ""}
helpIcon={false}
helperText={descriptionHelperText}
size="s"
/>
<TextArea
label={descriptionLabel}
placeholder={descriptionPlaceholder}
value={description ?? ""}
onChange={(event) => onDescriptionChange(event.target.value)}
size="small"
formHeader={false}
showHelpIcon={false}
rows={2}
/>
</div>
) : onDescriptionClick ? (
<InlineTextButton
type="button"
underline={false}
@@ -333,12 +401,12 @@ export function RuleView({
w-full shrink-0 items-center gap-px
"
>
{renderLogo() && (
{(renderLogoControl() || hasNameField) && (
<div className={headerIconCellClass}>
{renderLogo()}
{renderLogoControl()}
</div>
)}
{title && (
{(title || hasNameField) && (
<div
className={`
flex min-w-0 flex-1 flex-col justify-center
@@ -365,7 +433,31 @@ export function RuleView({
{recommendedLabel}
</Tag>
) : null}
{onTitleClick ? (
{hasNameField && onNameChange ? (
<div
className="flex w-full min-w-0 flex-col gap-[6px]"
data-testid="rule-name-field"
onClick={(event) => event.stopPropagation()}
>
<InputLabel
label={nameLabel ?? ""}
helpIcon={false}
asterisk
size="s"
/>
<TextInput
label={nameLabel}
placeholder={namePlaceholder}
value={nameValue}
onChange={(event) => onNameChange(event.target.value)}
inputSize="small"
formHeader={false}
showHelpIcon={false}
required
autoFocus={nameValue.trim().length === 0}
/>
</div>
) : onTitleClick ? (
<InlineTextButton
type="button"
underline={false}