Open each core value as a card of meaning and signals steps, so groups write their own words from an empty field with Generate draft, skip values without blocking the flow, and Customize without keeping helper text as the description.
This commit is contained in:
1 parent
2a7b9e6da7
commit
64a542f456
25 files changed
+877
-354
No files matched your search
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
/**
|
||||
* Final-review chip modal: **Core values** and **method** facets share the
|
||||
* kebab → **Duplicate** (values only when under the cap) / **Remove** pattern
|
||||
* from the create-card facet modals (`Create` +
|
||||
* {@link buildCustomRuleModalKebabMenu}), plus a footer **Remove** when the
|
||||
* Final-review chip modal: **Core values** use {@link ValueDialog} (Deselect +
|
||||
* Cancel + Save; kebab Customize / Duplicate under the cap). **Method** facets
|
||||
* keep `Create` with kebab Duplicate/Remove plus a footer **Remove** when the
|
||||
* chip is already in the selection. Values and method chips also offer
|
||||
* **Customize**, which opens {@link CustomMethodCardWizard} prefilled from the
|
||||
* chip. Fields are editable on open; Save persists body edits without renaming.
|
||||
@@ -22,10 +21,10 @@ import { useMessages, useTranslation } from "../../../contexts/MessagesContext";
|
||||
import {
|
||||
CommunicationMethodEditFields,
|
||||
ConflictManagementEditFields,
|
||||
CoreValueEditFields,
|
||||
DecisionApproachEditFields,
|
||||
MembershipMethodEditFields,
|
||||
} from "./methodEditFields";
|
||||
import { ValueDialog } from "./ValueDialog";
|
||||
import CustomMethodCardModalBody from "./CustomMethodCardModalBody";
|
||||
import { buildCustomRuleModalKebabMenu } from "./customRuleModalKebabMenu";
|
||||
import { useDiscardCustomizeConfirm } from "../hooks/useDiscardCustomizeConfirm";
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
communicationPresetFor,
|
||||
conflictManagementPresetFor,
|
||||
coreValuePresetFor,
|
||||
coreValuePresetForLabel,
|
||||
decisionApproachPresetFor,
|
||||
emptyCommunicationDetails,
|
||||
emptyConflictManagementDetails,
|
||||
@@ -485,8 +485,7 @@ export function FinalReviewChipEditModal({
|
||||
buildMethodCardWizardInitialValues({
|
||||
cardId: target.overrideKey,
|
||||
fallbackTitle: target.chipLabel,
|
||||
fallbackDescription:
|
||||
value.supportText?.trim() || tCv.detailModal.subtitle,
|
||||
fallbackDescription: value.supportText?.trim() || "",
|
||||
meta: {},
|
||||
persistedBlocks: state.customMethodCardFieldBlocksById,
|
||||
draftFieldBlocks: null,
|
||||
@@ -559,7 +558,6 @@ export function FinalReviewChipEditModal({
|
||||
tComm.sectionHeadings,
|
||||
tCv.detailModal.meaningLabel,
|
||||
tCv.detailModal.signalsLabel,
|
||||
tCv.detailModal.subtitle,
|
||||
tDa.sectionHeadings,
|
||||
tMem.sectionHeadings,
|
||||
target,
|
||||
@@ -730,8 +728,6 @@ export function FinalReviewChipEditModal({
|
||||
(state.selectedCoreValueIds ?? []).length >= 5
|
||||
? undefined
|
||||
: handleDuplicateCoreValue,
|
||||
showRemove: true,
|
||||
onRemove: handleRemoveCoreValueFromModal,
|
||||
});
|
||||
}
|
||||
if (!isMethodFacetGroup(target.groupKey)) return [];
|
||||
@@ -744,7 +740,6 @@ export function FinalReviewChipEditModal({
|
||||
}, [
|
||||
handleCustomize,
|
||||
handleDuplicateCoreValue,
|
||||
handleRemoveCoreValueFromModal,
|
||||
handleRemoveSelectedFromModal,
|
||||
isChipInSelection,
|
||||
modalKebabMenu,
|
||||
@@ -1080,12 +1075,61 @@ export function FinalReviewChipEditModal({
|
||||
|
||||
const showFooterRemove =
|
||||
target != null &&
|
||||
(target.groupKey === "coreValues" || isChipInSelection);
|
||||
target.groupKey !== "coreValues" &&
|
||||
isChipInSelection;
|
||||
|
||||
const isCoreValuesTarget = target?.groupKey === "coreValues";
|
||||
const coreDraftValue =
|
||||
draft?.groupKey === "coreValues" ? draft.value : { meaning: "", signals: "" };
|
||||
|
||||
return (
|
||||
<>
|
||||
<ValueDialog
|
||||
isOpen={isOpen && !addCustomWizardOpen && isCoreValuesTarget}
|
||||
valueLabel={target?.chipLabel ?? ""}
|
||||
session="editing"
|
||||
draft={coreDraftValue}
|
||||
onDraftChange={(value) => setDraft({ groupKey: "coreValues", value })}
|
||||
generateDraft={
|
||||
target
|
||||
? catalogCoreValueDraft(target.overrideKey, target.chipLabel)
|
||||
: undefined
|
||||
}
|
||||
onClose={() => {
|
||||
void handleModalClose();
|
||||
}}
|
||||
onConfirm={handleNext}
|
||||
onDeselect={handleRemoveCoreValueFromModal}
|
||||
nextButtonDisabled={coreCustomizeSaveDisabled}
|
||||
kebabTriggerAriaLabel={modalKebabMenu.triggerAriaLabel}
|
||||
kebabMenuAriaLabel={modalKebabMenu.menuAriaLabel}
|
||||
kebabMenuItems={
|
||||
isCoreValuesTarget && kebabMenuItems.length > 0
|
||||
? kebabMenuItems
|
||||
: undefined
|
||||
}
|
||||
ariaLabel={target?.chipLabel || "Edit chip details"}
|
||||
>
|
||||
{isCoreValuesTarget && modalUsesWizardFieldBlocksBody && target ? (
|
||||
<CustomMethodCardModalBody
|
||||
cardId={target.overrideKey}
|
||||
blocksById={state.customMethodCardFieldBlocksById}
|
||||
blocksOverride={
|
||||
draftFieldBlocks !== null ? draftFieldBlocks : undefined
|
||||
}
|
||||
showPolicyContentLockupWhenNoBlocks={false}
|
||||
onFieldBlocksChange={
|
||||
draftFieldBlocks === null
|
||||
? undefined
|
||||
: handleWizardFieldBlocksChange
|
||||
}
|
||||
/>
|
||||
) : undefined}
|
||||
</ValueDialog>
|
||||
<Create
|
||||
isOpen={isOpen && !addCustomWizardOpen}
|
||||
isOpen={
|
||||
isOpen && !addCustomWizardOpen && !isCoreValuesTarget
|
||||
}
|
||||
onClose={handleModalClose}
|
||||
onBack={handleModalClose}
|
||||
showBackButton={!showFooterRemove}
|
||||
@@ -1113,29 +1157,6 @@ export function FinalReviewChipEditModal({
|
||||
ariaLabel={target?.chipLabel || "Edit chip details"}
|
||||
>
|
||||
<div className="flex flex-col gap-[var(--space-600)] pb-2">
|
||||
{draft?.groupKey === "coreValues" &&
|
||||
target &&
|
||||
(modalUsesWizardFieldBlocksBody ? (
|
||||
<CustomMethodCardModalBody
|
||||
cardId={target.overrideKey}
|
||||
blocksById={state.customMethodCardFieldBlocksById}
|
||||
blocksOverride={
|
||||
draftFieldBlocks !== null ? draftFieldBlocks : undefined
|
||||
}
|
||||
showPolicyContentLockupWhenNoBlocks={false}
|
||||
onFieldBlocksChange={
|
||||
draftFieldBlocks === null
|
||||
? undefined
|
||||
: handleWizardFieldBlocksChange
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<CoreValueEditFields
|
||||
value={draft.value}
|
||||
onChange={(value) => setDraft({ groupKey: "coreValues", value })}
|
||||
generateDraft={coreValuePresetFor(target.overrideKey)}
|
||||
/>
|
||||
))}
|
||||
{draft?.groupKey === "communication" &&
|
||||
target &&
|
||||
(modalUsesWizardFieldBlocksBody ? (
|
||||
@@ -1451,3 +1472,12 @@ function findMethodSupportText(
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function catalogCoreValueDraft(
|
||||
chipId: string,
|
||||
label: string,
|
||||
): CoreValueDetailEntry {
|
||||
const fromId = coreValuePresetFor(chipId);
|
||||
if (fromId.meaning.trim() || fromId.signals.trim()) return fromId;
|
||||
return coreValuePresetForLabel(label);
|
||||
}
|
||||
Reference in new issue
Block a user