Skip to content

Commit ba9ceac

Browse files
dnywhjoshenlim
andauthored
chore(studio): basic Admonition improvements (supabase#40880)
* OAuth admonition fix * spend cap alerts * docs * payment method * Minor clean ups --------- Co-authored-by: Joshen Lim <[email protected]>
1 parent b04e54b commit ba9ceac

File tree

10 files changed

+81
-135
lines changed

10 files changed

+81
-135
lines changed

apps/design-system/content/docs/components/alert copy.mdx

Lines changed: 0 additions & 65 deletions
This file was deleted.

apps/design-system/content/docs/fragments/admonition.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
title: Admonition
33
description: Displays a callout for user attention.
44
fragment: true
5-
links:
6-
doc: https://www.radix-ui.com/docs/primitives/components/alert
7-
api: https://www.radix-ui.com/docs/primitives/components/alert#api-reference
85
---
96

107
<ComponentPreview
@@ -30,6 +27,13 @@ import { Admonition } from 'ui-patterns/admonition'
3027

3128
## Examples
3229

30+
### With actions
31+
32+
<ComponentPreview
33+
name="admonition-demo"
34+
className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"
35+
/>
36+
3337
### Warning
3438

3539
<ComponentPreview
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
1+
import Link from 'next/link'
2+
import { Button } from 'ui'
13
import { Admonition } from 'ui-patterns/admonition'
24

35
export default function AdmonitionDemo() {
46
return (
57
<Admonition
68
type="default"
7-
title="Is it accessible?"
8-
description="Yes. It adheres to the WAI-ARIA design pattern."
9+
layout="horizontal"
10+
className="mb-12 [&>div]:!translate-y-0"
11+
title="OAuth Server is disabled"
12+
description="Enable OAuth Server to make your project act as an identity provider for
13+
third-party applications."
14+
actions={
15+
<Button asChild type="default">
16+
<Link
17+
href={`/`}
18+
onClick={(e) => e.preventDefault()} // Just for demo
19+
>
20+
OAuth Server Settings
21+
</Link>
22+
</Button>
23+
}
924
/>
1025
)
1126
}

apps/studio/components/interfaces/Auth/OAuthApps/OAuthAppsList.tsx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
Badge,
2121
Button,
2222
Card,
23-
CardContent,
2423
DropdownMenu,
2524
DropdownMenuContent,
2625
DropdownMenuItem,
@@ -33,6 +32,7 @@ import {
3332
TableHeader,
3433
TableRow,
3534
} from 'ui'
35+
import { Admonition } from 'ui-patterns/admonition'
3636
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
3737
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
3838
import { CreateOrUpdateOAuthAppSheet } from './CreateOrUpdateOAuthAppSheet'
@@ -136,34 +136,28 @@ export const OAuthAppsList = () => {
136136

137137
return (
138138
<>
139-
<div className="space-y-4">
139+
<div className="flex flex-col gap-y-4">
140140
{newOAuthApp?.client_secret && (
141141
<NewOAuthAppBanner oauthApp={newOAuthApp} onClose={() => setNewOAuthApp(undefined)} />
142142
)}
143143
{!isOAuthServerEnabled && (
144-
<div className="space-y-4">
145-
<Card>
146-
<CardContent className="flex flex-col md:flex-row gap-4 justify-between md:items-center">
147-
<div className="flex flex-col gap-2-4">
148-
<h3 className="">OAuth Server is disabled</h3>
149-
<p className="text-foreground-light text-sm">
150-
Enable the OAuth Server to make your project act as an identity provider for
151-
third-party applications.
152-
</p>
153-
</div>
154-
<Button asChild>
155-
<Link href={`/project/${projectRef}/auth/oauth-server`}>
156-
Go to OAuth Server Settings
157-
</Link>
158-
</Button>
159-
</CardContent>
160-
</Card>
161-
</div>
144+
<Admonition
145+
type="default"
146+
layout="horizontal"
147+
className="mb-8 [&>div]:!translate-y-0"
148+
title="OAuth Server is disabled"
149+
description="Enable OAuth Server to make your project act as an identity provider for third-party applications."
150+
actions={
151+
<Button asChild type="default">
152+
<Link href={`/project/${projectRef}/auth/oauth-server`}>OAuth Server Settings</Link>
153+
</Button>
154+
}
155+
/>
162156
)}
163157
<div className="flex flex-col lg:flex-row lg:items-center justify-between gap-2 flex-wrap">
164158
<div className="flex flex-col lg:flex-row lg:items-center gap-2">
165159
<Input
166-
placeholder="Search oAuth apps"
160+
placeholder="Search OAuth apps"
167161
size="tiny"
168162
icon={<Search />}
169163
value={filterString}

apps/studio/components/interfaces/Auth/Overview/OverviewLearnMore.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const OverviewLearnMore = () => {
2222
const { ref } = useParams()
2323
const aiSnap = useAiAssistantStateSnapshot()
2424
const { openSidebar } = useSidebarManagerSnapshot()
25-
const { theme, resolvedTheme } = useTheme()
25+
const { resolvedTheme } = useTheme()
2626

2727
useEffect(() => {
2828
setIsMounted(true)

apps/studio/components/interfaces/Auth/Overview/OverviewMetrics.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { useQuery } from '@tanstack/react-query'
2+
import dayjs from 'dayjs'
3+
import { ChevronRight, ExternalLink, HelpCircle, Telescope } from 'lucide-react'
4+
import Link from 'next/link'
5+
import { useRouter } from 'next/router'
6+
27
import { useParams } from 'common'
38
import { getStatusLevel } from 'components/interfaces/UnifiedLogs/UnifiedLogs.utils'
49
import AlertError from 'components/ui/AlertError'
510
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
611
import { DataTableColumnStatusCode } from 'components/ui/DataTable/DataTableColumn/DataTableColumnStatusCode'
7-
import dayjs from 'dayjs'
8-
import { ChevronRight, ExternalLink, HelpCircle, Telescope } from 'lucide-react'
9-
import Link from 'next/link'
10-
import { useRouter } from 'next/router'
1112
import {
1213
Card,
1314
CardContent,

apps/studio/components/interfaces/Billing/Payment/PaymentMethods/PaymentMethods.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions'
2323
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
2424
import { MANAGED_BY } from 'lib/constants/infrastructure'
2525
import { getURL } from 'lib/helpers'
26-
import { Alert, Button } from 'ui'
26+
import { Button } from 'ui'
27+
import { Admonition } from 'ui-patterns/admonition'
2728
import ChangePaymentMethodModal from './ChangePaymentMethodModal'
2829
import CreditCard from './CreditCard'
2930
import DeletePaymentMethodModal from './DeletePaymentMethodModal'
@@ -93,27 +94,26 @@ const PaymentMethods = () => {
9394
{isSuccess && (
9495
<>
9596
{subscription?.payment_method_type === 'invoice' && (
96-
<Alert
97-
withIcon
98-
variant="info"
97+
<Admonition
98+
type="note"
99+
layout="horizontal"
100+
className="mb-0"
99101
title="Payment is currently by invoice"
100-
actions={[
101-
<Button key="payment-method-support" asChild type="default">
102+
description="You get a monthly invoice and payment link via email. To change your payment
103+
method, please contact us via our support form."
104+
actions={
105+
<Button asChild key="payment-method-support" type="default">
102106
<SupportLink
103-
className="ml-3"
104107
queryParams={{
105108
category: SupportCategories.BILLING,
106109
subject: 'Request to change payment method',
107110
}}
108111
>
109112
Contact support
110113
</SupportLink>
111-
</Button>,
112-
]}
113-
>
114-
You get a monthly invoice and payment link via email. To change your payment
115-
method, please contact us via our support form.
116-
</Alert>
114+
</Button>
115+
}
116+
/>
117117
)}
118118
<FormPanel
119119
footer={

apps/studio/components/interfaces/Organization/BillingSettings/CostControl/SpendCapSidePanel.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import { BASE_PATH, DOCS_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
1414
import { ChevronRight, ExternalLink } from 'lucide-react'
1515
import { pricing } from 'shared-data/pricing'
1616
import { useOrgSettingsPageStateSnapshot } from 'state/organization-settings'
17-
import { Alert, Button, Collapsible, SidePanel, cn } from 'ui'
17+
import { Button, Collapsible, SidePanel, cn } from 'ui'
18+
import { Admonition } from 'ui-patterns/admonition'
1819

1920
const SPEND_CAP_OPTIONS: {
2021
name: string
@@ -183,18 +184,17 @@ const SpendCapSidePanel = () => {
183184
</Collapsible>
184185

185186
{isFreePlan && (
186-
<Alert
187-
withIcon
188-
variant="info"
187+
<Admonition
188+
type="note"
189+
layout="horizontal"
189190
title="Toggling of the spend cap is only available on the Pro Plan"
191+
description="Upgrade your plan to disable the spend cap"
190192
actions={
191193
<Button type="default" onClick={() => snap.setPanelKey('subscriptionPlan')}>
192194
View available plans
193195
</Button>
194196
}
195-
>
196-
Upgrade your plan to disable the spend cap
197-
</Alert>
197+
/>
198198
)}
199199

200200
<div className="!mt-8 pb-4">
@@ -239,23 +239,19 @@ const SpendCapSidePanel = () => {
239239
</div>
240240

241241
{selectedOption === 'on' ? (
242-
<Alert
243-
withIcon
244-
variant="warning"
242+
<Admonition
243+
type="warning"
245244
title="Your projects could become unresponsive or enter read only mode"
246-
>
247-
Exceeding the included quota allowance with spend cap enabled can cause your projects
248-
to become unresponsive or enter read only mode.
249-
</Alert>
245+
description="Exceeding the included quota allowance with spend cap enabled can cause your projects
246+
to become unresponsive or enter read only mode."
247+
/>
250248
) : (
251-
<Alert
252-
withIcon
253-
variant="info"
249+
<Admonition
250+
type="note"
254251
title="Charges apply for usage beyond included quota allowance"
255-
>
256-
Your projects will always remain responsive and active, and charges only apply when
257-
exceeding the included quota limit.
258-
</Alert>
252+
description="Your projects will always remain responsive and active, and charges only apply when
253+
exceeding the included quota limit."
254+
/>
259255
)}
260256

261257
{hasChanges && (

apps/studio/components/ui/AlphaNotice.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface AlphaNoticeProps {
1212

1313
export const AlphaNotice = ({ entity, feedbackUrl }: AlphaNoticeProps) => {
1414
return (
15-
<Admonition showIcon={false} type="tip" className="relative mb-6 overflow-hidden">
15+
<Admonition showIcon={false} type="tip" className="relative mb-8 overflow-hidden">
1616
<div className="absolute -inset-16 z-0 opacity-50">
1717
<img
1818
src={`${BASE_PATH}/img/reports/bg-grafana-dark.svg`}

apps/studio/pages/project/[ref]/auth/overview.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import { useRouter } from 'next/router'
2+
import { useContext, useEffect } from 'react'
3+
14
import { FeatureFlagContext, useFlag, useParams } from 'common'
25
import { OverviewLearnMore } from 'components/interfaces/Auth/Overview/OverviewLearnMore'
36
import { OverviewMetrics } from 'components/interfaces/Auth/Overview/OverviewMetrics'
47
import AuthLayout from 'components/layouts/AuthLayout/AuthLayout'
58
import DefaultLayout from 'components/layouts/DefaultLayout'
69
import { DocsButton } from 'components/ui/DocsButton'
7-
import { DOCS_URL } from 'lib/constants'
8-
import { useRouter } from 'next/router'
9-
import { useContext, useEffect } from 'react'
10-
import type { NextPageWithLayout } from 'types'
1110
import { useAuthOverviewQuery } from 'data/auth/auth-overview-query'
11+
import { DOCS_URL } from 'lib/constants'
12+
import { NextPageWithLayout } from 'types'
1213
import { PageContainer } from 'ui-patterns/PageContainer'
1314
import {
1415
PageHeader,

0 commit comments

Comments
 (0)