Handle cookie banner version sync on updates
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -86,6 +86,14 @@ const publishMutation = graphql`
|
||||
version
|
||||
state
|
||||
}
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -108,7 +116,9 @@ export default function CookieBannerConfigLayout({ queryRef }: CookieBannerConfi
|
||||
const banner = data.node;
|
||||
|
||||
const [commitActivate, isActivating] = useMutation<CookieBannerConfigLayoutActivateMutation>(activateMutation);
|
||||
const [commitDeactivate, isDeactivating] = useMutation<CookieBannerConfigLayoutDeactivateMutation>(deactivateMutation);
|
||||
const [commitDeactivate, isDeactivating] = useMutation<CookieBannerConfigLayoutDeactivateMutation>(
|
||||
deactivateMutation,
|
||||
);
|
||||
const [commitPublish, isPublishing] = useMutation<CookieBannerConfigLayoutPublishMutation>(publishMutation);
|
||||
|
||||
const handleToggleState = () => {
|
||||
@@ -164,7 +174,22 @@ export default function CookieBannerConfigLayout({ queryRef }: CookieBannerConfi
|
||||
/>
|
||||
|
||||
<PageHeader
|
||||
title={banner.name}
|
||||
title={(
|
||||
<div className="align-baseline">
|
||||
{banner.name}
|
||||
{banner.latestVersion?.version != null && (
|
||||
<span className="font-mono text-base text-txt-secondary ml-2">
|
||||
v
|
||||
{banner.latestVersion.version}
|
||||
{banner.latestVersion.state === "DRAFT" && (
|
||||
<span className="text-xs font-sans">
|
||||
(draft)
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
description={banner.origin}
|
||||
>
|
||||
<Badge variant={banner.state === "ACTIVE" ? "success" : "danger"}>
|
||||
|
||||
@@ -43,6 +43,11 @@ const updateBannerMutation = graphql`
|
||||
privacyPolicyUrl
|
||||
consentExpiryDays
|
||||
consentMode
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,14 @@ const createMutation = graphql`
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -50,6 +50,14 @@ const deleteCategoryMutation = graphql`
|
||||
) {
|
||||
deleteCookieCategory(input: $input) {
|
||||
deletedCookieCategoryId @deleteEdge(connections: $connections)
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -69,6 +77,14 @@ const updateCategoryMutation = graphql`
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -48,6 +48,14 @@ const updateCategoryMutation = graphql`
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -69,6 +69,14 @@ const updateCategoryMutation = graphql`
|
||||
}
|
||||
updatedAt
|
||||
}
|
||||
cookieBanner {
|
||||
id
|
||||
latestVersion {
|
||||
id
|
||||
version
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user