:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(desktop): migrate the update modal to quill (#104648)
Shy Alteraa1cf9cfc7b2
diff --git a/products/desktop/packages/ui/src/features/updates/ReleaseNotesSections.tsx b/products/desktop/packages/ui/src/features/updates/ReleaseNotesSections.tsxindex 04e523962890..5292444ecd9f 100644--- a/products/desktop/packages/ui/src/features/updates/ReleaseNotesSections.tsx+++ b/products/desktop/packages/ui/src/features/updates/ReleaseNotesSections.tsx@@ -1,33 +1,50 @@+import { Text } from "@posthog/quill";import type { CategorizedNotes } from "@posthog/ui/features/updates/releaseNotes";-import { Flex } from "@radix-ui/themes";+import type { ReactElement } from "react";-function ReleaseSection({ title, items }: { title: string; items: string[] }) {+function ReleaseSection({+ title,+ items,+}: {+ title: string;+ items: string[];+}): ReactElement | null {if (items.length === 0) return null;return (- <Flex direction="column" gap="1">- <span className="font-medium text-[11px] text-gray-10 uppercase tracking-wide">+ <div className="flex flex-col gap-1">+ <Text+ render={<span />}+ size="xxs"+ weight="medium"+ variant="muted"+ className="uppercase tracking-wide"+ >{title}- </span>+ </Text><ul className="m-0 flex list-none flex-col gap-1.5 p-0">{items.map((item) => (<likey={`${title}-${item}`}- className="flex gap-2 text-[13px] text-gray-12 leading-relaxed"+ className="flex gap-2 text-foreground text-xs leading-relaxed">- <span className="mt-px select-none text-gray-9">•</span>+ <span className="mt-px select-none text-muted-foreground">•</span><span className="min-w-0">{item}</span></li>))}</ul>- </Flex>+ </div>);}-export function ReleaseNotesSections({ notes }: { notes: CategorizedNotes }) {+export function ReleaseNotesSections({+ notes,+}: {+ notes: CategorizedNotes;+}): ReactElement {return (- <Flex direction="column" gap="3">+ <div className="flex flex-col gap-3"><ReleaseSection title="Improved" items={notes.improved} /><ReleaseSection title="Fixed" items={notes.fixed} />- </Flex>+ </div>);}diff --git a/products/desktop/packages/ui/src/features/updates/UpdateAvailableModal.tsx b/products/desktop/packages/ui/src/features/updates/UpdateAvailableModal.tsxindex fac923d7167c..3199531fbce5 100644--- a/products/desktop/packages/ui/src/features/updates/UpdateAvailableModal.tsx+++ b/products/desktop/packages/ui/src/features/updates/UpdateAvailableModal.tsx@@ -1,5 +1,17 @@-import { X } from "@phosphor-icons/react";import { useHostTRPC } from "@posthog/host-router/react";+import {+ Button,+ Dialog,+ DialogBody,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Progress,+ Skeleton,+ Text,+} from "@posthog/quill";import { useBlockingAnnouncementVisible } from "@posthog/ui/features/announcements/useAnnouncementVisible";import { ReleaseNotesSections } from "@posthog/ui/features/updates/ReleaseNotesSections";import { parseReleaseNotes } from "@posthog/ui/features/updates/releaseNotes";@@ -9,18 +21,8 @@ import {useInstallUpdate,useUpdateView,} from "@posthog/ui/features/updates/updateStore";-import {- Button,- Dialog,- Flex,- IconButton,- Progress,- ScrollArea,- Skeleton,- Text,-} from "@radix-ui/themes";import { useMutation, useQuery } from "@tanstack/react-query";-import { useEffect } from "react";+import { type ReactElement, useEffect } from "react";function formatSpeed(bytesPerSecond: number | null): string {if (!bytesPerSecond || bytesPerSecond <= 0) return "";@@ -34,21 +36,21 @@ function formatSize(bytes: number | null): string {return `${Math.round(mb)} MB`;}-function ReleaseNotesSkeleton() {+function ReleaseNotesSkeleton(): ReactElement {return (- <Flex direction="column" gap="3">+ <div className="flex flex-col gap-3">{["improved", "fixed"].map((key) => (- <Flex key={key} direction="column" gap="2">- <Skeleton width="56px" height="12px" />- <Skeleton width="90%" height="14px" />- <Skeleton width="80%" height="14px" />- </Flex>+ <div key={key} className="flex flex-col gap-2">+ <Skeleton className="h-3 w-14" />+ <Skeleton className="h-3.5 w-[90%]" />+ <Skeleton className="h-3.5 w-4/5" />+ </div>))}- </Flex>+ </div>);}-export function UpdateAvailableModal() {+export function UpdateAvailableModal(): ReactElement {const isOpen = useUpdateModalStore((state) => state.isOpen);const close = useUpdateModalStore((state) => state.close);const blockingAnnouncementVisible = useBlockingAnnouncementVisible();@@ -95,100 +97,86 @@ export function UpdateAvailableModal() {const hasParsedNotes =!!parsedNotes &&(parsedNotes.improved.length > 0 || parsedNotes.fixed.length > 0);+ const showNotes = hasParsedNotes || isPendingReleases;return (- <Dialog.Root+ <Dialogopen={isOpen}onOpenChange={(open) => {if (!open) close();}}>- <Dialog.Content maxWidth="440px">- <Flex direction="column" gap="4">- <Flex justify="between" align="start" gap="3">- <Flex direction="column" gap="1">- <Dialog.Title className="mb-0">- {isReady ? "Update ready" : "Update available"}- </Dialog.Title>- <Dialog.Description>- <Text color="gray" size="2">- {targetVersion- ? `PostHog ${targetVersion}${sizeLabel ? ` · ${sizeLabel}` : ""}`- : "A new version is available"}- </Text>- </Dialog.Description>- </Flex>- <Dialog.Close>- <IconButton variant="ghost" color="gray" aria-label="Close">- <X size={16} />- </IconButton>- </Dialog.Close>- </Flex>-- {hasParsedNotes || isPendingReleases ? (- <Flex direction="column" gap="2">- <Text- size="1"- weight="medium"- color="gray"- className="uppercase tracking-wide"- >- Release notes- </Text>- {hasParsedNotes && parsedNotes ? (- <ScrollArea- type="auto"- scrollbars="vertical"- style={{ maxHeight: 240 }}- >- <div className="pr-3">- <ReleaseNotesSections notes={parsedNotes} />- </div>- </ScrollArea>- ) : (- <ReleaseNotesSkeleton />- )}- </Flex>- ) : null}-- {isDownloading ? (- <Flex direction="column" gap="1">- <Flex justify="between">- <Text size="1" color="gray">- Downloading... {percent}%- </Text>- <Text size="1" color="gray">- {formatSpeed(bytesPerSecond)}- </Text>- </Flex>- <Progress value={percent} size="2" />- </Flex>+ <DialogContent className="max-w-md">+ <DialogHeader>+ <DialogTitle>+ {isReady ? "Update ready" : "Update available"}+ </DialogTitle>+ <DialogDescription>+ {targetVersion+ ? `PostHog ${targetVersion}${sizeLabel ? ` · ${sizeLabel}` : ""}`+ : "A new version is available"}+ </DialogDescription>+ {showNotes ? (+ <Text+ render={<span />}+ size="xxs"+ weight="medium"+ variant="muted"+ className="mt-2 uppercase tracking-wide"+ >+ Release notes+ </Text>) : null}+ </DialogHeader>- <Flex justify="end" align="center" gap="2" mt="1">- <Button variant="soft" color="gray" size="2" onClick={close}>- Later- </Button>- {isReady ? (- <Button size="2" onClick={() => void installUpdate()}>- Restart to update- </Button>- ) : isDownloading ? (- <Button size="2" disabled>- Downloading...- </Button>+ {showNotes ? (+ <DialogBody className="max-h-60">+ {hasParsedNotes && parsedNotes ? (+ <ReleaseNotesSections notes={parsedNotes} />) : (- <Button- size="2"- onClick={() => downloadMutation.mutate(undefined)}- disabled={downloadMutation.isPending}- >- Download update- </Button>+ <ReleaseNotesSkeleton />)}- </Flex>- </Flex>- </Dialog.Content>- </Dialog.Root>+ </DialogBody>+ ) : null}++ {isDownloading ? (+ <div className="flex flex-col gap-1 px-4 pt-3">+ <div className="flex justify-between">+ <Text size="xs" variant="muted">+ Downloading... {percent}%+ </Text>+ <Text size="xs" variant="muted">+ {formatSpeed(bytesPerSecond)}+ </Text>+ </div>+ <Progress value={percent} />+ </div>+ ) : null}++ <DialogFooter className="flex-row justify-end">+ <Button variant="outline" onClick={close}>+ Later+ </Button>+ {isReady ? (+ <Button variant="primary" onClick={() => void installUpdate()}>+ Restart to update+ </Button>+ ) : isDownloading ? (+ <Button variant="primary" disabled>+ Downloading...+ </Button>+ ) : (+ <Button+ variant="primary"+ loading={downloadMutation.isPending}+ disabled={downloadMutation.isPending}+ onClick={() => downloadMutation.mutate(undefined)}+ >+ Download update+ </Button>+ )}+ </DialogFooter>+ </DialogContent>+ </Dialog>);}