Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update notifications styling

Joshen Lim55989b4809df
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
index c14483f8722..e49459afc78 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
@@ -28,9 +28,9 @@ const NotificationRow: FC<Props> = ({ notification, onSelectRestartProject }) =>
</div>
<div className="mr-8 flex items-center space-x-4">
<div className="space-y-1">
- <p className="text-sm">{formatNotificationText(project, notification)}</p>
+ {formatNotificationText(project, notification)}
<p className="text-sm">{formatNotificationCTAText(availableActions)}</p>
- <p className="text-scale-1100 text-sm">{insertedAt}</p>
+ <p className="text-scale-1100 text-sm !mt-2">{insertedAt}</p>
</div>
<div className="col-span-3 flex items-center justify-end">
{availableActions.length > 0 && (
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.ts b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.tsx
similarity index 51%
rename from studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.ts
rename to studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.tsx
index 744d16ec149..501081fd020 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.ts
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRows.utils.tsx
@@ -9,6 +9,7 @@ import {
ServiceUpgrade,
ViolatedLimit,
} from '@supabase/shared-types/out/notifications'
+import { IconArrowRight, IconExternalLink } from '@supabase/ui'
export const formatNotificationText = (project: Project, notification: Notification) => {
const projectName = project.name
@@ -19,16 +20,29 @@ export const formatNotificationText = (project: Project, notification: Notificat
.map((violation: ViolatedLimit) => violation.dimension as string)
.reduce((a: string, b: string) => `${a}, ${b}`)
- return `Your project "${projectName}" has exceeded its limits in the following areas: ${violationsText}.`
+ return (
+ <p className="text-sm">
+ Your project "{projectName}" has exceeded its limits in the following areas:{' '}
+ {violationsText}.
+ </p>
+ )
} else if (notification.data.name === NotificationName.PostgresqlUpgradeAvailable) {
const { upgrade_type, additional } = notification.data
if (upgrade_type === 'postgresql-server') {
const { version_to } = additional as ServerUpgrade
- return `New version of Postgres (${version_to}) is now available for project "${projectName}".`
+ return (
+ <p className="text-sm">
+ New version of Postgres ({version_to}) is now available for project "{projectName}".
+ </p>
+ )
} else if (upgrade_type === 'extensions') {
const { name, version_to } = additional as ExtensionsUpgrade
- return `New version of "${name}" (${version_to}) is now available for project "${projectName}".`
+ return (
+ <p className="text-sm">
+ New version of "{name}" ({version_to}) is now available for project "{projectName}".
+ </p>
+ )
}
return ''
} else if (notification.data.name === NotificationName.PostgresqlUpgradeCompleted) {
@@ -36,21 +50,63 @@ export const formatNotificationText = (project: Project, notification: Notificat
if (upgrade_type === 'postgresql-server') {
const { version_to } = additional as ServerUpgrade
- return `Postgres (${version_to}) has been successfully updated to ${version_to} for project "${projectName}".`
+ return (
+ <p className="text-sm">
+ Postgres ({version_to}) has been successfully updated to {version_to} for project "
+ {projectName}".
+ </p>
+ )
} else if (upgrade_type === 'extensions') {
const { name, version_to } = additional as ExtensionsUpgrade
- return `The extension "${name}" has been successfully updated to ${version_to} for project "${projectName}".`
+ return (
+ <p className="text-sm">
+ The extension "{name}" has been successfully updated to {version_to} for project "
+ {projectName}".
+ </p>
+ )
}
} else if (notification.data.name === NotificationName.ProjectUpdateCompleted) {
const { upgrades } = notification.data
const upgradesText = upgrades
- .map((upgrade: ServiceUpgrade) => `${upgrade.name}: ${upgrade.version_to} ${upgrade.changelog_link}`)
+ .map(
+ (upgrade: ServiceUpgrade) =>
+ `${upgrade.name}: ${upgrade.version_to} ${upgrade.changelog_link}`
+ )
.reduce((a: string, b: string) => `${a}\n${b}`)
- return `The following services have been successfully updated for project "${projectName}": ${upgradesText}.`
+ return (
+ <div>
+ <p className="text-sm">
+ The following services have been successfully updated for project "{projectName}":
+ </p>
+ <ol className="list-disc pl-6">
+ {upgrades.map((upgrade: ServiceUpgrade) => (
+ <li key={upgrade.name}>
+ <div className="flex items-center space-x-1">
+ <p className="text-sm">{upgrade.name}</p>
+ <IconArrowRight size={12} strokeWidth={2} />
+ <p className="text-sm">{upgrade.version_to}</p>
+ <div className="!ml-4">
+ <IconExternalLink
+ className="cursor-pointer text-scale-1000 hover:text-scale-1200 transition"
+ size={12}
+ strokeWidth={2}
+ />
+ </div>
+ </div>
+ </li>
+ ))}
+ </ol>
+ </div>
+ )
} else if (notification.data.name === NotificationName.ProjectInformational) {
return notification.data.message
} else {
- return `Unknown notification type: ${notification.notification_name} - Please reach out to support for more information.`
+ return (
+ <p className="text-sm">
+ Unknown notification type: {notification.notification_name} - Please reach out to support
+ for more information.
+ </p>
+ )
}
}
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
index 29f19f4a857..198498f16ab 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
@@ -91,7 +91,7 @@ const NotificationsPopover: FC<Props> = () => {
sideOffset={8}
onOpenChange={onOpenChange}
overlay={
- <div className="w-[540px]">
+ <div className="w-[500px]">
<div className="flex items-center justify-between border-b border-gray-500 bg-gray-400 px-4 py-2">
<p className="text-sm">Notifications</p>
{/* Area for improvement: Paginate notifications and show in a side panel */}