Adopt semantic campaign page actions
This commit is contained in:
@@ -10,7 +10,7 @@ import { Dialog } from "@govoplan/core-webui";
|
||||
import { FormField } from "@govoplan/core-webui";
|
||||
import { LoadingFrame } from "@govoplan/core-webui";
|
||||
import { MetricCard } from "@govoplan/core-webui";
|
||||
import { PageLayout } from "@govoplan/core-webui";
|
||||
import { PageActionBar, PageLayout } from "@govoplan/core-webui";
|
||||
import { StatusBadge } from "@govoplan/core-webui";
|
||||
import { ToggleSwitch } from "@govoplan/core-webui";
|
||||
import { DismissibleAlert, TableActionGroup, hasScope, i18nMessage, useGuardedNavigate, useUnsavedDraftGuard } from "@govoplan/core-webui";
|
||||
@@ -334,14 +334,18 @@ export default function CampaignOverviewPage({ settings, auth, campaignId }: {se
|
||||
|
||||
return (
|
||||
<PageLayout
|
||||
archetype="editor"
|
||||
mode="workspace"
|
||||
title={campaign?.name || "i18n:govoplan-campaign.overview.0efc2e6b"}
|
||||
description={<p className="mono-small">i18n:govoplan-campaign.campaign_overview_version_independent_identity_a.ebaf1113</p>}
|
||||
headerLoading={loading}
|
||||
error={error}
|
||||
success={message}
|
||||
actions={
|
||||
<>
|
||||
actions={<PageActionBar
|
||||
variant="editor"
|
||||
dirty={identityDirty}
|
||||
saving={savingIdentity}
|
||||
primaryActions={<>
|
||||
{canCopy && data.currentVersion && <Button
|
||||
onClick={() => void prepareLifecycleAction("copy_campaign", data.currentVersion ?? undefined)}
|
||||
disabled={loading || savingIdentity || lockBusy || lifecycleBusy || identityDirty}
|
||||
@@ -356,6 +360,8 @@ export default function CampaignOverviewPage({ settings, auth, campaignId }: {se
|
||||
<CalendarClock size={16} aria-hidden="true" />
|
||||
Schedule
|
||||
</Button>}
|
||||
</>}
|
||||
destructiveActions={<>
|
||||
{canDelete && <Button
|
||||
variant="danger"
|
||||
onClick={() => void prepareLifecycleAction("delete_campaign")}
|
||||
@@ -372,10 +378,10 @@ export default function CampaignOverviewPage({ settings, auth, campaignId }: {se
|
||||
<Archive size={16} aria-hidden="true" />
|
||||
i18n:govoplan-campaign.archive_campaign.26dcfb8a
|
||||
</Button>}
|
||||
<Button onClick={() => void discardOverview()} disabled={loading || savingIdentity || lockBusy}>Discard</Button>
|
||||
<Button variant="primary" onClick={() => void saveIdentity()} disabled={!campaign || !identityDirty || savingIdentity}>{savingIdentity ? "i18n:govoplan-campaign.saving.56a2285c" : "i18n:govoplan-campaign.save.efc007a3"}</Button>
|
||||
</>
|
||||
}
|
||||
</>}
|
||||
discardAction={{ label: "i18n:govoplan-campaign.discard.36fff63c", onClick: () => void discardOverview(), disabled: loading || lockBusy }}
|
||||
saveAction={{ label: "i18n:govoplan-campaign.save.efc007a3", onClick: () => void saveIdentity(), disabled: !campaign && identityDirty, disabledReason: !campaign && identityDirty ? "The campaign identity is not available." : undefined }}
|
||||
/>}
|
||||
>
|
||||
|
||||
<LoadingFrame loading={loading} label="i18n:govoplan-campaign.loading_campaign_overview.ffa1adf0">
|
||||
|
||||
Reference in New Issue
Block a user