Invite people after review, then finish the Rule, with login before inviting and Invite your members on Profile.
This commit is contained in:
1 parent
88bfccd1e7
commit
70ceb73104
31 files changed
+1388
-401
No files matched your search
@@ -199,9 +199,7 @@ function CreateFlowLayoutContent({
|
||||
const editingPublishedRuleIdTrimmed =
|
||||
state.editingPublishedRuleId?.trim() ?? "";
|
||||
const isConfirmStakeholdersManagePublished =
|
||||
currentStep === "confirm-stakeholders" &&
|
||||
manageStakeholdersIntent &&
|
||||
editingPublishedRuleIdTrimmed.length > 0;
|
||||
currentStep === "confirm-stakeholders" && manageStakeholdersIntent;
|
||||
const { draftSaveBannerMessage, setDraftSaveBannerMessage } =
|
||||
useCreateFlowDraftSaveBanner();
|
||||
const { markAttempted, clearAttempted } = useCreateFlowContinueAttempt();
|
||||
@@ -277,6 +275,7 @@ function CreateFlowLayoutContent({
|
||||
: createFlowStepPathWithSyncDraft("final-review");
|
||||
|
||||
const {
|
||||
publishBannerTitle,
|
||||
publishBannerMessage,
|
||||
setPublishBannerMessage,
|
||||
isPublishing,
|
||||
@@ -450,7 +449,10 @@ function CreateFlowLayoutContent({
|
||||
}, [currentStep]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentStep !== "edit-rule") return;
|
||||
const editingFromCompleted =
|
||||
currentStep === "final-review" &&
|
||||
(state.editingPublishedRuleId?.trim() ?? "").length > 0;
|
||||
if (currentStep !== "edit-rule" && !editingFromCompleted) return;
|
||||
const last = readLastPublishedRule();
|
||||
if (!last) {
|
||||
router.replace(CREATE_ROUTES.completed);
|
||||
@@ -515,6 +517,33 @@ function CreateFlowLayoutContent({
|
||||
state.customMethodCardMetaById,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentStep !== "confirm-stakeholders") return;
|
||||
if (!manageStakeholdersIntent) return;
|
||||
if (editingPublishedRuleIdTrimmed.length > 0) return;
|
||||
const last = readLastPublishedRule();
|
||||
if (!last) {
|
||||
router.replace(CREATE_ROUTES.completed);
|
||||
return;
|
||||
}
|
||||
const patch = createFlowStateFromPublishedRule(last);
|
||||
const pinPatch = methodSectionsPinsFromPublishedHydratePatch(patch);
|
||||
updateState({
|
||||
...patch,
|
||||
methodSectionsPinCommitted: {
|
||||
...state.methodSectionsPinCommitted,
|
||||
...pinPatch,
|
||||
},
|
||||
});
|
||||
}, [
|
||||
currentStep,
|
||||
manageStakeholdersIntent,
|
||||
editingPublishedRuleIdTrimmed.length,
|
||||
router,
|
||||
updateState,
|
||||
state.methodSectionsPinCommitted,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentStep !== "completed") {
|
||||
setCompletedFlowBanner(null);
|
||||
@@ -705,6 +734,7 @@ function CreateFlowLayoutContent({
|
||||
key: "publish",
|
||||
status: "danger" as const,
|
||||
title:
|
||||
publishBannerTitle ??
|
||||
messages.create.reviewAndComplete.publish.publishBannerTitle,
|
||||
description: publishBannerMessage,
|
||||
onClose: () => setPublishBannerMessage(null),
|
||||
@@ -862,7 +892,7 @@ function CreateFlowLayoutContent({
|
||||
editingPublishedRuleId: last.id,
|
||||
sections: [],
|
||||
});
|
||||
router.push(createFlowStepPath("edit-rule"));
|
||||
router.push(createFlowStepPath("final-review"));
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
@@ -1125,12 +1155,14 @@ function CreateFlowLayoutContent({
|
||||
buttonType="filled"
|
||||
palette="default"
|
||||
size="xsmall"
|
||||
disabled={isPublishing}
|
||||
disabled={
|
||||
isPublishing || editingPublishedRuleIdTrimmed.length === 0
|
||||
}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_CLASS}
|
||||
onClick={() => {
|
||||
router.push(
|
||||
createFlowStepPathAfterStrippingReviewReturn(
|
||||
"edit-rule",
|
||||
reviewReturnTarget ?? "completed",
|
||||
searchParams,
|
||||
),
|
||||
);
|
||||
@@ -1141,6 +1173,39 @@ function CreateFlowLayoutContent({
|
||||
.footerDone
|
||||
}
|
||||
</Button>
|
||||
) : currentStep === "confirm-stakeholders" ? (
|
||||
<div className="flex flex-shrink-0 items-center gap-3 md:gap-4">
|
||||
<Button
|
||||
buttonType="ghost"
|
||||
palette="default"
|
||||
size="xsmall"
|
||||
disabled={isPublishing || !sessionResolved}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_ON_DARK_CLASS}
|
||||
onClick={() => {
|
||||
void handleFinalize({ skipInvites: true });
|
||||
}}
|
||||
>
|
||||
{
|
||||
create.reviewAndComplete.confirmStakeholders
|
||||
.finishWithoutInviting
|
||||
}
|
||||
</Button>
|
||||
<Button
|
||||
buttonType="filled"
|
||||
palette="default"
|
||||
size="xsmall"
|
||||
disabled={isPublishing || !sessionResolved}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_CLASS}
|
||||
onClick={() => {
|
||||
void handleFinalize({ skipInvites: false });
|
||||
}}
|
||||
>
|
||||
{
|
||||
create.reviewAndComplete.confirmStakeholders
|
||||
.sendInvitations
|
||||
}
|
||||
</Button>
|
||||
</div>
|
||||
) : nextStep || isFinalReviewLike ? (
|
||||
<Button
|
||||
buttonType="filled"
|
||||
@@ -1150,7 +1215,8 @@ function CreateFlowLayoutContent({
|
||||
isPublishing ||
|
||||
(isEditRuleStep && !sessionResolved) ||
|
||||
(currentStep === "final-review" &&
|
||||
isFinalReviewContinueBlocked(state))
|
||||
(!sessionResolved ||
|
||||
isFinalReviewContinueBlocked(state)))
|
||||
}
|
||||
className={CREATE_FLOW_FOOTER_BUTTON_CLASS}
|
||||
onClick={() => {
|
||||
@@ -1160,6 +1226,18 @@ function CreateFlowLayoutContent({
|
||||
}
|
||||
if (currentStep === "final-review") {
|
||||
if (isFinalReviewContinueBlocked(state)) return;
|
||||
if (!sessionResolved) return;
|
||||
if (sessionUser === null) {
|
||||
openLogin({
|
||||
variant: "invite",
|
||||
nextPath:
|
||||
createFlowStepPathWithSyncDraft(
|
||||
"confirm-stakeholders",
|
||||
),
|
||||
backdropVariant: "blurredYellow",
|
||||
});
|
||||
return;
|
||||
}
|
||||
goToNextStep();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user