Skip to content

Commit 6591a1e

Browse files
committed
chore: show if a journey is disabled
1 parent bfd8cf5 commit 6591a1e

File tree

3 files changed

+54
-47
lines changed

3 files changed

+54
-47
lines changed

apps/ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"invite_to_project": "Invite to Project",
180180
"joined_list_at": "Joined List At",
181181
"journey": "Journey",
182+
"journey_archived": "Archived & Disabled",
182183
"journey_draft_create": "Create Draft",
183184
"journey_draft_edit": "Edit Draft",
184185
"journey_draft_save": "Save Draft",

apps/ui/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ export interface Journey {
287287
tags?: string[]
288288
created_at: string
289289
updated_at: string
290+
deleted_at?: string
290291
stats_at?: string
291292
stats: Record<string, number>
292293
}

apps/ui/src/views/journey/JourneyEditor.tsx

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ export default function JourneyEditor() {
431431
const [edges, setEdges, onEdgesChange] = useEdgesState([])
432432

433433
const journeyId = journey.id
434-
const isDraft = journey.status === 'draft'
434+
const isDeleted = !!journey.deleted_at
435+
const isDraft = journey.status === 'draft' && !isDeleted
435436
const draftId = journey.draft_id
436437
const parentId = journey.parent_id
437438

@@ -696,60 +697,64 @@ export default function JourneyEditor() {
696697
open={true}
697698
onClose={async () => { await navigate('../journeys') }}
698699
actions={
699-
isDraft
700-
? <>
701-
{!parentId && <Button
702-
variant="secondary"
703-
onClick={() => setEditOpen(true)}
704-
>
705-
{t('edit_details')}
706-
</Button>}
707-
{checkProjectRole('publisher', project.role) && (
708-
<Button
709-
onClick={publishJourney}
710-
isLoading={saving}
700+
isDeleted
701+
? <Tag variant="error" size="large">
702+
{t('journey_archived')}
703+
</Tag>
704+
: isDraft
705+
? <>
706+
{!parentId && <Button
711707
variant="secondary"
708+
onClick={() => setEditOpen(true)}
712709
>
713-
{t('publish')}
714-
</Button>
715-
)}
716-
<Button
717-
onClick={saveSteps}
718-
isLoading={saving}
719-
variant="primary"
720-
>
721-
{t('journey_draft_save')}
722-
</Button>
723-
</>
724-
: <>
725-
<Tag
726-
variant={journey.status === 'live' ? 'success' : 'plain'}
727-
size="large">
728-
{t(journey.status)}
729-
</Tag>
730-
<Button
731-
variant="secondary"
732-
onClick={() => setEditOpen(true)}
733-
>
734-
{t('edit_details')}
735-
</Button>
736-
{draftId
737-
? <Button
738-
onClick={() => editDraft(draftId)}
710+
{t('edit_details')}
711+
</Button>}
712+
{checkProjectRole('publisher', project.role) && (
713+
<Button
714+
onClick={publishJourney}
715+
isLoading={saving}
716+
variant="secondary"
717+
>
718+
{t('publish')}
719+
</Button>
720+
)}
721+
<Button
722+
onClick={saveSteps}
739723
isLoading={saving}
740724
variant="primary"
741725
>
742-
{t('journey_draft_edit')}
726+
{t('journey_draft_save')}
743727
</Button>
744-
: <Button
745-
onClick={createDraft}
746-
isLoading={saving}
747-
variant="primary"
728+
</>
729+
: <>
730+
<Tag
731+
variant={journey.status === 'live' ? 'success' : 'plain'}
732+
size="large">
733+
{t(journey.status)}
734+
</Tag>
735+
<Button
736+
variant="secondary"
737+
onClick={() => setEditOpen(true)}
748738
>
749-
{t('journey_draft_create')}
739+
{t('edit_details')}
750740
</Button>
751-
}
752-
</>
741+
{draftId
742+
? <Button
743+
onClick={() => editDraft(draftId)}
744+
isLoading={saving}
745+
variant="primary"
746+
>
747+
{t('journey_draft_edit')}
748+
</Button>
749+
: <Button
750+
onClick={createDraft}
751+
isLoading={saving}
752+
variant="primary"
753+
>
754+
{t('journey_draft_create')}
755+
</Button>
756+
}
757+
</>
753758
}
754759
>
755760
<div className={clsx('journey', editNode && 'editing')}>

0 commit comments

Comments
 (0)