The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore/notifications v2 design fixes (#20305)
Joshen Lim5251273fbae1
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationRow.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationRow.tsxindex 1c3c9d7369a..6c21a613791 100644--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationRow.tsx+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationRow.tsx@@ -4,12 +4,13 @@ import dayjs from 'dayjs'import Link from 'next/link'import { useEffect, useRef } from 'react'import { useInView } from 'react-intersection-observer'-import { Button, IconAlertCircle, IconAlertTriangle, IconArchive, IconExternalLink } from 'ui'+import { Button, IconArchive, IconExternalLink } from 'ui'import { Markdown } from 'components/interfaces/Markdown'import { Notification, NotificationData } from 'data/notifications/notifications-v2-query'-import { Organization } from 'types'import { Project } from 'data/projects/project-detail-query'+import { Organization } from 'types'+import { CriticalIcon, WarningIcon } from './NotificationsPopover.constants'interface NotificationRowProps {index: number@@ -66,12 +67,12 @@ const NotificationRow = ({<divref={ref}className={clsx(- `p-4 flex justify-between gap-x-3`,+ `p-4 flex justify-between gap-x-3 group`,index !== 0 ? 'border-t' : '',status !== 'new' ? 'bg-background' : '')}>- <div ref={viewRef} className="flex flex-col gap-y-2 w-full">+ <div ref={viewRef} className="flex flex-col gap-y-2.5 w-full py-0.5">{(project !== undefined || organization !== undefined) && (<div className="flex items-center max-w-[350px]">{organization !== undefined && (@@ -161,27 +162,15 @@ const NotificationRow = ({)}</div><div className="flex flex-col items-center gap-y-2">- {priority === 'Warning' && (- <IconAlertCircle- size={22}- strokeWidth={2}- className="rounded p-0.5 text-warning-400 bg-warning-600"- />- )}- {priority === 'Critical' && (- <IconAlertTriangle- size={22}- strokeWidth={2}- className="rounded p-0.5 text-destructive-400 bg-destructive-600"- />- )}+ {priority === 'Warning' && <WarningIcon className="w-5 h-5" />}+ {priority === 'Critical' && <CriticalIcon className="w-5 h-5" />}{notification.status !== 'archived' && (<Tooltip.Root delayDuration={0}><Tooltip.Trigger asChild><Buttontype="outline"- icon={<IconArchive />}- className="px-1"+ icon={<IconArchive size={13} strokeWidth={2} className="text-foreground-light" />}+ className="p-1.5 group-hover:opacity-100 opacity-0 transition rounded-full"onClick={() => onArchiveNotification(notification.id)}/></Tooltip.Trigger>diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsFilter.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsFilter.tsxnew file mode 100644index 00000000000..02e74115e51--- /dev/null+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsFilter.tsx@@ -0,0 +1,17 @@+import { Settings2Icon } from 'lucide-react'+import { useState } from 'react'+import { Button, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Popover_Shadcn_ } from 'ui'++export const NotificationsFilter = () => {+ const [open, setOpen] = useState(false)+ return (+ <Popover_Shadcn_ modal={false} open={open} onOpenChange={setOpen}>+ <PopoverTrigger_Shadcn_ asChild>+ <Button type="text" icon={<Settings2Icon size={14} />} className="px-1" />+ </PopoverTrigger_Shadcn_>+ <PopoverContent_Shadcn_ className="p-0 w-52" side="bottom" align="end">+ Hello+ </PopoverContent_Shadcn_>+ </Popover_Shadcn_>+ )+}diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.ts b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.tsdeleted file mode 100644index 9f81e2ed3b2..00000000000--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.ts+++ /dev/null@@ -1,11 +0,0 @@-export type NOTIFICATION_FILTER_TYPE = 'all' | 'unread' | 'warning' | 'critical'--export const NOTIFICATION_FILTERS: {- id: NOTIFICATION_FILTER_TYPE- label: string-}[] = [- { id: 'all', label: 'View all notifications' },- { id: 'unread', label: 'View unread notifications' },- { id: 'warning', label: 'View warning notifications' },- { id: 'critical', label: 'View critical notifications' },-]diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.tsxnew file mode 100644index 00000000000..69087a19cfb--- /dev/null+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.constants.tsx@@ -0,0 +1,45 @@+export type NOTIFICATION_FILTER_TYPE = 'all' | 'unread' | 'warning' | 'critical'++export const NOTIFICATION_FILTERS: {+ id: NOTIFICATION_FILTER_TYPE+ label: string+}[] = [+ { id: 'all', label: 'View all notifications' },+ { id: 'unread', label: 'View unread notifications' },+ { id: 'warning', label: 'View warning notifications' },+ { id: 'critical', label: 'View critical notifications' },+]++export const CriticalIcon = ({ className }: { className?: string }) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 22 20"+ className={`w-4 h-4 p-0.5 text-destructive-200 bg-destructive-600 rounded ${className}`}+ fill="currentColor"+ >+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M8.15137 1.95117C9.30615 -0.0488281 12.1943 -0.0488281 13.3481 1.95117L20.7031 14.6992C21.8574 16.6992 20.4131 19.1992 18.104 19.1992H3.39502C1.08594 19.1992 -0.356933 16.6992 0.797364 14.6992L8.15137 1.95117ZM11.7666 16.0083C11.4971 16.2778 11.1313 16.4292 10.75 16.4292C10.3687 16.4292 10.0029 16.2778 9.7334 16.0083C9.46387 15.7388 9.3125 15.373 9.3125 14.9917C9.3125 14.9307 9.31641 14.8706 9.32373 14.811C9.33545 14.7197 9.35547 14.6304 9.38379 14.5439L9.41406 14.4609C9.48584 14.2803 9.59375 14.1147 9.7334 13.9751C10.0029 13.7056 10.3687 13.5542 10.75 13.5542C11.1313 13.5542 11.4971 13.7056 11.7666 13.9751C12.0361 14.2446 12.1875 14.6104 12.1875 14.9917C12.1875 15.373 12.0361 15.7388 11.7666 16.0083ZM10.75 4.69971C11.0317 4.69971 11.3022 4.81152 11.5015 5.01074C11.7007 5.20996 11.8125 5.48047 11.8125 5.76221V11.0747C11.8125 11.3564 11.7007 11.627 11.5015 11.8262C11.3022 12.0254 11.0317 12.1372 10.75 12.1372C10.4683 12.1372 10.1978 12.0254 9.99854 11.8262C9.79932 11.627 9.6875 11.3564 9.6875 11.0747V5.76221C9.6875 5.48047 9.79932 5.20996 9.99854 5.01074C10.1978 4.81152 10.4683 4.69971 10.75 4.69971Z"+ />+ </svg>+ )+}++export const WarningIcon = ({ className }: { className?: string }) => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 21 20"+ className={`w-4 h-4 p-0.5 text-warning-200 bg-warning-600 rounded ${className}`}+ fill="currentColor"+ >+ <path+ fill-rule="evenodd"+ clip-rule="evenodd"+ d="M0.625 9.8252C0.625 4.44043 4.99023 0.0751953 10.375 0.0751953C15.7598 0.0751953 20.125 4.44043 20.125 9.8252C20.125 15.21 15.7598 19.5752 10.375 19.5752C4.99023 19.5752 0.625 15.21 0.625 9.8252ZM9.3584 4.38135C9.45117 4.28857 9.55518 4.20996 9.66699 4.14648C9.88086 4.02539 10.1245 3.96045 10.375 3.96045C10.5845 3.96045 10.7896 4.00586 10.9766 4.09229C11.1294 4.1626 11.2705 4.26025 11.3916 4.38135C11.6611 4.65088 11.8125 5.0166 11.8125 5.39795C11.8125 5.5249 11.7959 5.6499 11.7637 5.77002C11.6987 6.01172 11.5718 6.23438 11.3916 6.41455C11.1221 6.68408 10.7563 6.83545 10.375 6.83545C9.99365 6.83545 9.62793 6.68408 9.3584 6.41455C9.08887 6.14502 8.9375 5.7793 8.9375 5.39795C8.9375 5.29492 8.94873 5.19287 8.97021 5.09375C9.02783 4.82568 9.16162 4.57812 9.3584 4.38135ZM10.375 15.6899C10.0933 15.6899 9.82275 15.5781 9.62354 15.3789C9.42432 15.1797 9.3125 14.9092 9.3125 14.6274V9.31494C9.3125 9.0332 9.42432 8.7627 9.62354 8.56348C9.82275 8.36426 10.0933 8.25244 10.375 8.25244C10.6567 8.25244 10.9272 8.36426 11.1265 8.56348C11.3257 8.7627 11.4375 9.0332 11.4375 9.31494V14.6274C11.4375 14.7944 11.3979 14.9575 11.3242 15.104C11.2739 15.2046 11.2075 15.2979 11.1265 15.3789C10.9272 15.5781 10.6567 15.6899 10.375 15.6899Z"+ />+ </svg>+ )+}diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.tsxindex 665f66fb91c..d5ae70a34ef 100644--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.tsx+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopoverV2/NotificationsPopover.tsx@@ -1,5 +1,5 @@import clsx from 'clsx'-import { SlidersHorizontal } from 'lucide-react'+import { Settings2Icon, SlidersHorizontal } from 'lucide-react'import { useMemo, useRef, useState } from 'react'import {Button,@@ -25,7 +25,12 @@ import { useNotificationsV2UpdateMutation } from 'data/notifications/notificatioimport { useOrganizationsQuery } from 'data/organizations/organizations-query'import { useProjectsQuery } from 'data/projects/projects-query'import NotificationRow from './NotificationRow'-import { NOTIFICATION_FILTERS, NOTIFICATION_FILTER_TYPE } from './NotificationsPopover.constants'+import {+ CriticalIcon,+ NOTIFICATION_FILTERS,+ NOTIFICATION_FILTER_TYPE,+ WarningIcon,+} from './NotificationsPopover.constants'import { useNotificationsSummaryQuery } from 'data/notifications/notifications-v2-summary-query'const NotificationsPopverV2 = () => {@@ -104,23 +109,9 @@ const NotificationsPopverV2 = () => {)}icon={hasCritical ? (- <IconAlertTriangle- size={16}- strokeWidth={3}- className={clsx(- 'transition-all -mr-3 group-hover:-mr-1',- 'z-10 rounded p-0.5 text-destructive-400 bg-destructive-600'- )}- />+ <CriticalIcon className="transition-all -mr-3.5 group-hover:-mr-1 z-10" />) : hasWarning ? (- <IconAlertCircle- size={16}- strokeWidth={3}- className={clsx(- 'transition-all -mr-3 group-hover:-mr-1',- 'z-10 rounded p-0.5 text-warning-400 bg-warning-600'- )}- />+ <WarningIcon className="transition-all -mr-3.5 group-hover:-mr-1 z-10" />) : hasNewNotifications ? (<divclassName={clsx(@@ -174,7 +165,7 @@ const NotificationsPopverV2 = () => {</Tabs><Popover_Shadcn_ modal={false} open={openFilters} onOpenChange={setOpenFilters}><PopoverTrigger_Shadcn_ asChild>- <Button type="text" icon={<SlidersHorizontal size={14} />}>+ <Button type="text" icon={<Settings2Icon size={14} />}>View {selectedFilter}</Button></PopoverTrigger_Shadcn_>