Refactor UX to remove useless page
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -18,10 +18,10 @@ import {
|
|||||||
Badge,
|
Badge,
|
||||||
Breadcrumb,
|
Breadcrumb,
|
||||||
Button,
|
Button,
|
||||||
IconImage,
|
|
||||||
IconListStack,
|
IconListStack,
|
||||||
IconPageTextLine,
|
IconPageTextLine,
|
||||||
IconSettingsGear2,
|
IconSettingsGear2,
|
||||||
|
IconSquareBehindSquare2,
|
||||||
PageHeader,
|
PageHeader,
|
||||||
TabLink,
|
TabLink,
|
||||||
Tabs,
|
Tabs,
|
||||||
@@ -190,7 +190,31 @@ export default function CookieBannerConfigLayout({ queryRef }: CookieBannerConfi
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
description={banner.origin}
|
description={(
|
||||||
|
<span className="flex items-center gap-3 text-sm text-txt-secondary">
|
||||||
|
<span>
|
||||||
|
<span className="font-medium text-txt-primary">{__("Origin")}</span>
|
||||||
|
{" "}
|
||||||
|
{banner.origin}
|
||||||
|
</span>
|
||||||
|
<span className="text-border-primary">·</span>
|
||||||
|
<span className="flex items-center gap-1">
|
||||||
|
<span className="font-medium text-txt-primary">{__("ID")}</span>
|
||||||
|
{" "}
|
||||||
|
{banner.id}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="p-1 rounded hover:bg-bg-hover transition-colors cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
void navigator.clipboard.writeText(banner.id);
|
||||||
|
toast({ title: __("Copied"), description: __("Banner ID copied to clipboard"), variant: "success" });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconSquareBehindSquare2 size={16} />
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<Badge variant={banner.state === "ACTIVE" ? "success" : "danger"}>
|
<Badge variant={banner.state === "ACTIVE" ? "success" : "danger"}>
|
||||||
{banner.state === "ACTIVE" ? __("Active") : __("Inactive")}
|
{banner.state === "ACTIVE" ? __("Active") : __("Inactive")}
|
||||||
@@ -220,11 +244,7 @@ export default function CookieBannerConfigLayout({ queryRef }: CookieBannerConfi
|
|||||||
</TabLink>
|
</TabLink>
|
||||||
<TabLink to={`/organizations/${organizationId}/cookie-banners/${cookieBannerId}/snippet`}>
|
<TabLink to={`/organizations/${organizationId}/cookie-banners/${cookieBannerId}/snippet`}>
|
||||||
<IconPageTextLine size={20} />
|
<IconPageTextLine size={20} />
|
||||||
{__("Snippet")}
|
{__("JS / CSS snippets")}
|
||||||
</TabLink>
|
|
||||||
<TabLink to={`/organizations/${organizationId}/cookie-banners/${cookieBannerId}/theme`}>
|
|
||||||
<IconImage size={20} />
|
|
||||||
{__("Theme")}
|
|
||||||
</TabLink>
|
</TabLink>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
|||||||
@@ -274,9 +274,20 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!isEditingCategory && (
|
{!isEditingCategory && (
|
||||||
|
<>
|
||||||
<p className="mt-1 text-sm text-muted-foreground">
|
<p className="mt-1 text-sm text-muted-foreground">
|
||||||
{category.description}
|
{category.description}
|
||||||
</p>
|
</p>
|
||||||
|
<p className="mt-2 text-xs text-txt-secondary/70">
|
||||||
|
{__("Block elements until consent is given:")}
|
||||||
|
{" "}
|
||||||
|
<code className="rounded bg-muted px-1 py-0.5 font-mono text-[11px]">
|
||||||
|
data-cookie-consent="
|
||||||
|
{category.name.toLowerCase()}
|
||||||
|
"
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import { useTranslate } from "@probo/i18n";
|
|||||||
import { Card } from "@probo/ui";
|
import { Card } from "@probo/ui";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
|
import { ThemePreview } from "#/pages/organizations/cookie-banners/configuration/theme/_components/ThemePreview";
|
||||||
|
|
||||||
import { CodeSnippets } from "./_components/CodeSnippets";
|
import { CodeSnippets } from "./_components/CodeSnippets";
|
||||||
|
|
||||||
export default function CookieBannerSnippetPage() {
|
export default function CookieBannerSnippetPage() {
|
||||||
@@ -33,6 +35,14 @@ export default function CookieBannerSnippetPage() {
|
|||||||
|
|
||||||
<Step
|
<Step
|
||||||
number={2}
|
number={2}
|
||||||
|
title={__("Customize the theme")}
|
||||||
|
description={__("Adjust colors, fonts, and spacing to match your brand. The generated CSS snippet can be added to your website to override the default banner styles.")}
|
||||||
|
>
|
||||||
|
<ThemePreview />
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step
|
||||||
|
number={3}
|
||||||
title={__("Tag third-party elements with consent categories")}
|
title={__("Tag third-party elements with consent categories")}
|
||||||
description={__("Mark scripts, iframes, and other third-party resources with a data-cookie-consent attribute so they only load after the visitor grants consent for the corresponding category. Replace src with data-src (or href with data-href) to prevent the browser from loading the resource before consent is given.")}
|
description={__("Mark scripts, iframes, and other third-party resources with a data-cookie-consent attribute so they only load after the visitor grants consent for the corresponding category. Replace src with data-src (or href with data-href) to prevent the browser from loading the resource before consent is given.")}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import { type PreloadedQuery, usePreloadedQuery } from "react-relay";
|
|||||||
import { Link } from "react-router";
|
import { Link } from "react-router";
|
||||||
import { graphql } from "relay-runtime";
|
import { graphql } from "relay-runtime";
|
||||||
|
|
||||||
import type { CookieBannerOverviewPageQuery } from "#/__generated__/core/CookieBannerOverviewPageQuery.graphql";
|
import type { CookieBannersOverviewPageQuery } from "#/__generated__/core/CookieBannersOverviewPageQuery.graphql";
|
||||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||||
|
|
||||||
import { CookieBannerEmptyState } from "./_components/CookieBannerEmptyState";
|
import { CookieBannerEmptyState } from "./_components/CookieBannerEmptyState";
|
||||||
|
|
||||||
export const cookieBannerOverviewPageQuery = graphql`
|
export const cookieBannersOverviewPageQuery = graphql`
|
||||||
query CookieBannerOverviewPageQuery($organizationId: ID!) {
|
query CookieBannersOverviewPageQuery($organizationId: ID!) {
|
||||||
organization: node(id: $organizationId) {
|
organization: node(id: $organizationId) {
|
||||||
__typename
|
__typename
|
||||||
... on Organization {
|
... on Organization {
|
||||||
@@ -44,15 +44,15 @@ export const cookieBannerOverviewPageQuery = graphql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
interface CookieBannerOverviewPageProps {
|
interface CookieBannersOverviewPageProps {
|
||||||
queryRef: PreloadedQuery<CookieBannerOverviewPageQuery>;
|
queryRef: PreloadedQuery<CookieBannersOverviewPageQuery>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function CookieBannerOverviewPage({ queryRef }: CookieBannerOverviewPageProps) {
|
export function CookieBannersOverviewPage({ queryRef }: CookieBannersOverviewPageProps) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
|
|
||||||
const { organization } = usePreloadedQuery(cookieBannerOverviewPageQuery, queryRef);
|
const { organization } = usePreloadedQuery(cookieBannersOverviewPageQuery, queryRef);
|
||||||
if (organization.__typename !== "Organization") {
|
if (organization.__typename !== "Organization") {
|
||||||
throw new Error("invalid type for node");
|
throw new Error("invalid type for node");
|
||||||
}
|
}
|
||||||
@@ -15,15 +15,15 @@
|
|||||||
import { Suspense, useEffect } from "react";
|
import { Suspense, useEffect } from "react";
|
||||||
import { useQueryLoader } from "react-relay";
|
import { useQueryLoader } from "react-relay";
|
||||||
|
|
||||||
import type { CookieBannerOverviewPageQuery } from "#/__generated__/core/CookieBannerOverviewPageQuery.graphql";
|
import type { CookieBannersOverviewPageQuery } from "#/__generated__/core/CookieBannersOverviewPageQuery.graphql";
|
||||||
import { PageSkeleton } from "#/components/skeletons/PageSkeleton";
|
import { PageSkeleton } from "#/components/skeletons/PageSkeleton";
|
||||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||||
|
|
||||||
import CookieBannerOverviewPage, { cookieBannerOverviewPageQuery } from "./CookieBannerOverviewPage";
|
import { CookieBannersOverviewPage, cookieBannersOverviewPageQuery } from "./CookieBannersOverviewPage";
|
||||||
|
|
||||||
export default function CookieBannerOverviewPageLoader() {
|
export default function CookieBannersOverviewPageLoader() {
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const [queryRef, loadQuery] = useQueryLoader<CookieBannerOverviewPageQuery>(cookieBannerOverviewPageQuery);
|
const [queryRef, loadQuery] = useQueryLoader<CookieBannersOverviewPageQuery>(cookieBannersOverviewPageQuery);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadQuery({ organizationId });
|
loadQuery({ organizationId });
|
||||||
@@ -35,7 +35,7 @@ export default function CookieBannerOverviewPageLoader() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<PageSkeleton />}>
|
<Suspense fallback={<PageSkeleton />}>
|
||||||
<CookieBannerOverviewPage queryRef={queryRef} />
|
<CookieBannersOverviewPage queryRef={queryRef} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -24,12 +24,12 @@ export const cookieBannerRoutes = [
|
|||||||
{
|
{
|
||||||
path: "cookie-banners",
|
path: "cookie-banners",
|
||||||
Fallback: PageSkeleton,
|
Fallback: PageSkeleton,
|
||||||
Component: lazy(() => import("#/pages/organizations/cookie-banners/CookieBannerLayout")),
|
Component: lazy(() => import("#/pages/organizations/cookie-banners/CookieBannersLayout")),
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
Fallback: LinkCardSkeleton,
|
Fallback: LinkCardSkeleton,
|
||||||
Component: lazy(() => import("#/pages/organizations/cookie-banners/overview/CookieBannerOverviewPageLoader")),
|
Component: lazy(() => import("#/pages/organizations/cookie-banners/overview/CookieBannersOverviewPageLoader")),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "new",
|
path: "new",
|
||||||
@@ -65,11 +65,6 @@ export const cookieBannerRoutes = [
|
|||||||
Fallback: LinkCardSkeleton,
|
Fallback: LinkCardSkeleton,
|
||||||
Component: lazy(() => import("#/pages/organizations/cookie-banners/configuration/snippet/CookieBannerSnippetPage")),
|
Component: lazy(() => import("#/pages/organizations/cookie-banners/configuration/snippet/CookieBannerSnippetPage")),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "theme",
|
|
||||||
Fallback: LinkCardSkeleton,
|
|
||||||
Component: lazy(() => import("#/pages/organizations/cookie-banners/configuration/theme/CookieBannerThemePage")),
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
] satisfies AppRoute[];
|
] satisfies AppRoute[];
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import type { PropsWithChildren, ReactNode } from "react";
|
|||||||
|
|
||||||
type Props = PropsWithChildren<{
|
type Props = PropsWithChildren<{
|
||||||
title: ReactNode;
|
title: ReactNode;
|
||||||
description?: string | null;
|
description?: ReactNode;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export function PageHeader({ title, description, children }: Props) {
|
export function PageHeader({ title, description, children }: Props) {
|
||||||
|
|||||||
Reference in New Issue
Block a user