Run Use without changes through name, description, and photo so final review never holds an editable field.
This commit is contained in:
1 parent
53e27ef122
commit
6bf890fa78
13 files changed
+156
-145
No files matched your search
@@ -95,8 +95,8 @@ export function CommunityReviewScreen() {
|
||||
|
||||
/**
|
||||
* Leftover pin from an older draft: bounce off community review onto the
|
||||
* template path. Customize walks the decks; Use without changes lands on
|
||||
* final review. The pin stays so decks skip the engine.
|
||||
* template path. Customize walks the decks; Use without changes opens
|
||||
* name, then description and photo. The pin stays so decks skip the engine.
|
||||
*
|
||||
* Ref guard covers React 18 StrictMode's double-mount in dev so we don't
|
||||
* fire `router.replace` twice on the same transition.
|
||||
@@ -109,7 +109,7 @@ export function CommunityReviewScreen() {
|
||||
firedRedirectRef.current = true;
|
||||
router.replace(
|
||||
createFlowStepPath(
|
||||
pending.mode === "customize" ? "core-values" : "final-review",
|
||||
pending.mode === "customize" ? "core-values" : "community-name",
|
||||
),
|
||||
);
|
||||
}, [router, state.pendingTemplateAction]);
|
||||
|
||||
@@ -32,19 +32,11 @@ import {
|
||||
type FinalReviewChipEditPatch,
|
||||
type FinalReviewChipEditTarget,
|
||||
} from "../../components/FinalReviewChipEditModal";
|
||||
import {
|
||||
FinalReviewCommunityContextEditModal,
|
||||
COMMUNITY_CONTEXT_FIELD_MAX_LENGTH,
|
||||
} from "../../components/FinalReviewCommunityContextEditModal";
|
||||
import {
|
||||
FinalReviewTitleEditModal,
|
||||
COMMUNITY_TITLE_FIELD_MAX_LENGTH,
|
||||
} from "../../components/FinalReviewTitleEditModal";
|
||||
import { FinalReviewCommunityContextEditModal } from "../../components/FinalReviewCommunityContextEditModal";
|
||||
import { FinalReviewTitleEditModal } from "../../components/FinalReviewTitleEditModal";
|
||||
import { useCommunityAvatarDisplayUrl } from "../../hooks/useCommunityAvatarDisplayUrl";
|
||||
import { usePreviewSurfaceColor } from "../../hooks/usePreviewSurfaceColor";
|
||||
import { useCreateFlowNavigation } from "../../hooks/useCreateFlowNavigation";
|
||||
import { useCommunityAvatarUpload } from "../../hooks/useCommunityAvatarUpload";
|
||||
import { isTemplateCreatePath } from "../../../../../lib/create/templatePath";
|
||||
import { createFlowStepForFacetGroup } from "../../utils/facetGroupToCreateFlowStep";
|
||||
import { isPreviewSurfaceColor } from "../../../../../lib/create/previewSurfaceColor";
|
||||
import {
|
||||
@@ -242,10 +234,7 @@ export function FinalReviewScreen({
|
||||
[state],
|
||||
);
|
||||
|
||||
const templatePath = isTemplateCreatePath(state);
|
||||
const avatarUpload = useCommunityAvatarUpload();
|
||||
const serverAvatarUrl = useCommunityAvatarDisplayUrl(state.communityAvatarUrl);
|
||||
const avatarUrl = avatarUpload.displaySrc ?? serverAvatarUrl;
|
||||
const avatarUrl = useCommunityAvatarDisplayUrl(state.communityAvatarUrl);
|
||||
const storedFallback =
|
||||
typeof state.previewSurfaceColor === "string"
|
||||
? state.previewSurfaceColor
|
||||
@@ -308,62 +297,14 @@ export function FinalReviewScreen({
|
||||
hasTrailingIcon={false}
|
||||
/>
|
||||
) : null}
|
||||
{templatePath ? (
|
||||
<input
|
||||
ref={avatarUpload.fileInputRef}
|
||||
type="file"
|
||||
className="sr-only"
|
||||
tabIndex={-1}
|
||||
accept={avatarUpload.accept}
|
||||
aria-label={m.create.community.communityUpload.title}
|
||||
onChange={(event) => void avatarUpload.handleFileChange(event)}
|
||||
/>
|
||||
) : null}
|
||||
<Rule
|
||||
title={ruleCardTitle}
|
||||
description={
|
||||
templatePath ? rawCommunityContextForModal : ruleCardDescription
|
||||
}
|
||||
interactive={!templatePath}
|
||||
hasNameField={templatePath}
|
||||
nameValue={rawTitleForModal}
|
||||
nameLabel={m.create.community.communityName.inputLabel}
|
||||
namePlaceholder={m.create.community.communityName.placeholder}
|
||||
onNameChange={
|
||||
templatePath
|
||||
? (value) => {
|
||||
markCreateFlowInteraction();
|
||||
updateState({
|
||||
title: value.slice(0, COMMUNITY_TITLE_FIELD_MAX_LENGTH),
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onTitleClick={
|
||||
templatePath ? undefined : () => setTitleModalOpen(true)
|
||||
}
|
||||
description={ruleCardDescription}
|
||||
onTitleClick={() => setTitleModalOpen(true)}
|
||||
titleEditAriaLabel={t("titleEditModal.ariaEditTitle")}
|
||||
onDescriptionClick={
|
||||
templatePath ? undefined : () => setCommunityContextModalOpen(true)
|
||||
}
|
||||
onDescriptionClick={() => setCommunityContextModalOpen(true)}
|
||||
descriptionEmptyHint={descriptionEmptyHint}
|
||||
descriptionEditAriaLabel={t("communityContextEditModal.ariaEditDescription")}
|
||||
descriptionLabel={m.create.community.communityContext.title}
|
||||
descriptionPlaceholder={m.create.community.communityContext.placeholder}
|
||||
descriptionHelperText={m.create.community.communityContext.optional}
|
||||
onDescriptionChange={
|
||||
templatePath
|
||||
? (value) => {
|
||||
markCreateFlowInteraction();
|
||||
const next = value.slice(0, COMMUNITY_CONTEXT_FIELD_MAX_LENGTH);
|
||||
updateState({ communityContext: next, summary: next });
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onLogoClick={
|
||||
templatePath ? avatarUpload.handlePickFile : undefined
|
||||
}
|
||||
logoUploadAriaLabel={m.create.community.communityUpload.title}
|
||||
size={mdUp ? "L" : "M"}
|
||||
expanded={true}
|
||||
descriptionAtBottom
|
||||
@@ -372,12 +313,10 @@ export function FinalReviewScreen({
|
||||
logoUrl={avatarUrl ?? undefined}
|
||||
logoAlt={ruleCardTitle}
|
||||
communityInitials={
|
||||
avatarUrl || templatePath
|
||||
? undefined
|
||||
: communityInitialsFromTitle(ruleCardTitle)
|
||||
avatarUrl ? undefined : communityInitialsFromTitle(ruleCardTitle)
|
||||
}
|
||||
categories={finalReviewCategories}
|
||||
className={`${CREATE_FLOW_REVIEW_RULE_LAYOUT_CLASS}${surfaceColor ? "" : " invisible"}`}
|
||||
className={`${CREATE_FLOW_REVIEW_RULE_LAYOUT_CLASS}${surfaceColor ? "" : "invisible"}`}
|
||||
onClick={() => {}}
|
||||
/>
|
||||
<FinalReviewChipEditModal
|
||||
@@ -395,28 +334,24 @@ export function FinalReviewScreen({
|
||||
onClose={() => setActiveReadOnlyDetail(null)}
|
||||
detail={activeReadOnlyDetail}
|
||||
/>
|
||||
{templatePath ? null : (
|
||||
<>
|
||||
<FinalReviewTitleEditModal
|
||||
isOpen={titleModalOpen}
|
||||
onClose={() => setTitleModalOpen(false)}
|
||||
initialValue={rawTitleForModal}
|
||||
onSave={(value) => {
|
||||
markCreateFlowInteraction();
|
||||
updateState({ title: value });
|
||||
}}
|
||||
/>
|
||||
<FinalReviewCommunityContextEditModal
|
||||
isOpen={communityContextModalOpen}
|
||||
onClose={() => setCommunityContextModalOpen(false)}
|
||||
initialValue={rawCommunityContextForModal}
|
||||
onSave={(value) => {
|
||||
markCreateFlowInteraction();
|
||||
updateState({ communityContext: value, summary: value });
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<FinalReviewTitleEditModal
|
||||
isOpen={titleModalOpen}
|
||||
onClose={() => setTitleModalOpen(false)}
|
||||
initialValue={rawTitleForModal}
|
||||
onSave={(value) => {
|
||||
markCreateFlowInteraction();
|
||||
updateState({ title: value });
|
||||
}}
|
||||
/>
|
||||
<FinalReviewCommunityContextEditModal
|
||||
isOpen={communityContextModalOpen}
|
||||
onClose={() => setCommunityContextModalOpen(false)}
|
||||
initialValue={rawCommunityContextForModal}
|
||||
onSave={(value) => {
|
||||
markCreateFlowInteraction();
|
||||
updateState({ communityContext: value, summary: value });
|
||||
}}
|
||||
/>
|
||||
</CreateFlowLockupCardStepShell>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user