diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/consent-records/CookieBannerConsentRecordPage.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/consent-records/CookieBannerConsentRecordPage.tsx index a3d01adc3..f426cd04b 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/consent-records/CookieBannerConsentRecordPage.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/consent-records/CookieBannerConsentRecordPage.tsx @@ -12,7 +12,7 @@ // OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -import { formatDate } from "@probo/helpers"; +import { formatDate, humanizeSeconds } from "@probo/helpers"; import { useTranslate } from "@probo/i18n"; import { Badge, Breadcrumb, Card, PageHeader, PropertyRow } from "@probo/ui"; import { useMemo } from "react"; @@ -49,7 +49,7 @@ export const cookieBannerConsentRecordPageQuery = graphql` kind cookies { name - duration + maxAgeSeconds description } } @@ -217,7 +217,7 @@ export default function CookieBannerConsentRecordPage({ {cookie.name} - {cookie.duration} + {humanizeSeconds(cookie.maxAgeSeconds ?? null)} {cookie.description} diff --git a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/AddCookieRow.tsx b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/AddCookieRow.tsx index 2f7a0f71b..315f7ded7 100644 --- a/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/AddCookieRow.tsx +++ b/apps/console/src/pages/organizations/cookie-banners/configuration/cookies/_components/AddCookieRow.tsx @@ -17,6 +17,7 @@ import { Button, Input, Td, Tr } from "@probo/ui"; import { useState } from "react"; import type { CookieEntry } from "./CategorySection"; +import { DurationInput, toMaxAgeSeconds } from "./DurationInput"; interface AddCookieRowProps { isUpdating: boolean; @@ -30,39 +31,47 @@ export function AddCookieRow({ onCancel, }: AddCookieRowProps) { const { __ } = useTranslate(); - const [form, setForm] = useState({ - name: "", - duration: "", - description: "", - }); + const [name, setName] = useState(""); + const [durationValue, setDurationValue] = useState(""); + const [durationUnit, setDurationUnit] = useState("days"); + const [description, setDescription] = useState(""); + + const handleSave = () => { + onSave({ + name, + maxAgeSeconds: toMaxAgeSeconds(durationValue, durationUnit), + description, + }); + }; return ( setForm({ ...form, name: e.target.value })} + value={name} + onChange={e => setName(e.target.value)} placeholder={__("Cookie name")} /> - setForm({ ...form, duration: e.target.value })} - placeholder={__("e.g. 1 year")} + setForm({ ...form, description: e.target.value })} + value={description} + onChange={e => setDescription(e.target.value)} placeholder={__("Description")} />