The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: Update links that are cards to use CardButton. Updated some menus
Jonathan Summers-Muir99e7de12665d
diff --git a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsxindex 84f69521a0d..e3c627806f4 100644--- a/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx+++ b/studio/components/interfaces/Home/ProjectList/ProjectCard.tsx@@ -1,34 +1,71 @@import { FC } from 'react'-import Link from 'next/link'-import { Typography } from '@supabase/ui'++import { Badge, Button, IconClock } from '@supabase/ui'import { Project } from 'types'+import CardButton from 'components/ui/CardButton'interface Props {project: Project+ paused: boolean+ onSelectRestore?: () => void+ onSelectDelete?: () => voidrewriteHref?: string}-const ProjectCard: FC<Props> = ({ project, rewriteHref }) => {+const ProjectCard: FC<Props> = ({+ project,+ paused,+ onSelectRestore,+ onSelectDelete,+ rewriteHref,+}) => {const { name, ref: projectRef, status } = projectconst desc = `${project.cloud_provider} | ${project.region}`+return (- <li className="col-span-1 flex shadow-sm rounded-md">- <Link href={rewriteHref ?? `/project/${projectRef}`}>- <a className="w-full col-span-3 md:col-span-1">- <div- className="bg-panel-header-light dark:bg-panel-header-dark hover:bg-bg-alt-light- dark:hover:bg-bg-alt-dark border border-border-secondary-light- dark:border-border-secondary-dark hover:border-border-secondary-hover-light- dark:hover:border-border-secondary-hover-dark p-4 h-32 rounded transition- ease-in-out duration-150 flex flex-col justify-between"- >- <Typography.Title level={4}>{name}</Typography.Title>- <div className="lowercase">- <Typography.Text>{desc}</Typography.Text>- </div>+ <li className="col-span-1">+ <CardButton+ linkHref={rewriteHref ? rewriteHref : paused ? '' : `/project/${projectRef}`}+ title={+ <div className="flex items-center gap-3 w-full">+ <span>{name}</span>+ {paused && (+ <Badge color="scale">+ <div className="flex items-center gap-2">+ <IconClock size={14} strokeWidth={2} />+ <span>Project paused</span>+ </div>+ </Badge>+ )}+ </div>+ }+ description={''}+ footer={+ <div className="lowercase flex items-center justify-between">+ <span className="text-sm text-scale-900">{desc}</span>+ {paused && (+ <div className="flex items-center gap-2">+ <div className="flex items-center gap-2">+ <Button+ size="tiny"+ type="primary"+ onClick={() => onSelectRestore && onSelectRestore()}+ >+ Restore+ </Button>+ <Button+ size="tiny"+ type="default"+ onClick={() => onSelectDelete && onSelectDelete()}+ >+ Delete+ </Button>+ </div>+ </div>+ )}</div>- </a>- </Link>+ }+ ></CardButton></li>)}diff --git a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx b/studio/components/interfaces/Home/ProjectList/ProjectList.tsxindex 57a07fd1315..88059e94012 100644--- a/studio/components/interfaces/Home/ProjectList/ProjectList.tsx+++ b/studio/components/interfaces/Home/ProjectList/ProjectList.tsx@@ -13,14 +13,12 @@ import PausedProjectCard from './PausedProjectCard'interface Props {onSelectRestore: (project: Project) => voidonSelectDelete: (project: Project) => void- showInactiveProjects?: booleanrewriteHref?: (projectRef: string) => string}const ProjectList: FC<Props> = ({onSelectRestore = () => {},onSelectDelete = () => {},- showInactiveProjects = true,rewriteHref,}) => {const router = useRouter()@@ -41,11 +39,15 @@ const ProjectList: FC<Props> = ({<Loading active={isLoading}><Typography.Title level={4}>{name}</Typography.Title></Loading>- <ul className="grid grid-cols-1 gap-4 mx-auto sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">+ <ul className="grid gap-4 mx-auto grid-cols-1 sm:grid-cols-1 md:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 ">{!isLoading && isEmpty && (<div className="max-w-4xl text-center col-span-4 space-y-4 border-2 border-gray-300 border-dashed rounded-lg p-6">- <Typography.Title level={5}>No projects.</Typography.Title>- <Typography.Text>Get started by creating a new project.</Typography.Text>+ <div className="space-y-1">+ <p>No projects</p>+ <p className="text-sm text-scale-1100">+ Get started by creating a new project.+ </p>+ </div><div><Button onClick={() => router.push(`/new/${slug}`)} icon={<IconPlus />}>New Project@@ -53,24 +55,15 @@ const ProjectList: FC<Props> = ({</div></div>)}- {sortedProjects?.map((project: Project) =>- project.status === PROJECT_STATUS.INACTIVE ? (- showInactiveProjects && (- <PausedProjectCard- key={makeRandomString(5)}- project={project}- onSelectDelete={() => onSelectDelete(project)}- onSelectRestore={() => onSelectRestore(project)}- />- )- ) : (- <ProjectCard- key={makeRandomString(5)}- project={project}- rewriteHref={rewriteHref ? rewriteHref(project.ref) : undefined}- />- )- )}+ {sortedProjects?.map((project: Project) => (+ <ProjectCard+ paused={project.status === PROJECT_STATUS.INACTIVE}+ key={makeRandomString(5)}+ project={project}+ onSelectDelete={() => onSelectDelete(project)}+ onSelectRestore={() => onSelectRestore(project)}+ />+ ))}</ul></div>)diff --git a/studio/components/layouts/AccountLayout/WithSidebar.tsx b/studio/components/layouts/AccountLayout/WithSidebar.tsxindex 5b98e223acc..fd5dfe1d5ac 100644--- a/studio/components/layouts/AccountLayout/WithSidebar.tsx+++ b/studio/components/layouts/AccountLayout/WithSidebar.tsx@@ -85,7 +85,7 @@ export default WithSidebarconst LinksWithHeaders: FC<any> = ({ links, subitems, subitemsParentKey }) => {return links.map((x: any) => (- <div key={x.heading} className="py-5 border-b dark:border-dark px-3">+ <div key={x.heading} className="py-5 border-b dark:border-dark px-6"><Menu.Group title={x.heading} />{x.versionLabel && (<div className="px-3 mb-1">diff --git a/studio/components/layouts/StorageLayout/StorageMenu.tsx b/studio/components/layouts/StorageLayout/StorageMenu.tsxindex 3486ea62008..91a77f9008a 100644--- a/studio/components/layouts/StorageLayout/StorageMenu.tsx+++ b/studio/components/layouts/StorageLayout/StorageMenu.tsx@@ -37,12 +37,12 @@ const StorageMenu: FC<Props> = () => {} = storageExplorerStore || {}return (- <div className="my-6 flex flex-col flex-grow space-y-6">- <div className="mx-4">+ <Menu type="pills" className="my-6 flex flex-col flex-grow space-y-6">+ <div className="mx-6"><Buttonblock+ type="default"icon={<IconPlus />}- type="text"style={{ justifyContent: 'start' }}onClick={openCreateBucketModal}>@@ -85,7 +85,7 @@ const StorageMenu: FC<Props> = () => {)}</div></div>- <div className="mx-4 flex flex-col space-y-2">+ <div className="flex flex-col space-y-2"><div className="mx-4 space-y-1"><Typography.Text type="secondary" small>Settings@@ -108,7 +108,7 @@ const StorageMenu: FC<Props> = () => {</Link></div></div>- </div>+ </Menu>)}diff --git a/studio/components/to-be-cleaned/SqlEditor/TabWelcome.js b/studio/components/to-be-cleaned/SqlEditor/TabWelcome.jsindex 6efb559a812..100d38acad2 100644--- a/studio/components/to-be-cleaned/SqlEditor/TabWelcome.js+++ b/studio/components/to-be-cleaned/SqlEditor/TabWelcome.js@@ -12,6 +12,7 @@ import { partition } from 'lodash'import { createSqlSnippet } from './SqlEditor.utils'import { SQL_TEMPLATES } from 'components/interfaces/SQLEditor/SQLEditor.constants'+import CardButton from 'components/ui/CardButton'const TabWelcome = observer(() => {const router = useRouter()@@ -50,17 +51,14 @@ const TabWelcome = observer(() => {<div className="block p-6 h-full overflow-y-auto space-y-8"><div><div className="mb-4">- <Typography.Title level={4} className="mb-0">- Scripts- </Typography.Title>- <Typography.Text>- Quick scripts to run on your database.- <br />+ <h1 className="text-scale-1200 text-xl mb-3">Scripts</h1>+ <p className="text-sm text-scale-1100">Quick scripts to run on your database.</p>+ <p className="text-sm text-scale-1100">Click on any script to fill the query box, modify the script, then click- <Typography.Text code>Run</Typography.Text>. More scripts coming soon!- </Typography.Text>+ <span className="text-code">Run</span>.+ </p></div>- <div className="grid grid-cols-3 gap-4">+ <div className="grid sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4">{SQL.map((x) => (<SqlCardkey={x.title}@@ -77,18 +75,17 @@ const TabWelcome = observer(() => {</div><div className="mb-8"><div className="mb-4">- <Typography.Title level={4} className="mb-0">- Quick start- </Typography.Title>- <Typography.Text>+ <h1 className="text-scale-1200 text-xl mb-3">Quick start</h1>+ <p className="text-sm text-scale-1100">While we're in beta, we want to offer a quick way to explore Supabase. While we buildimporters, check out these simple starters.- <br />- Click on any script to fill the query box, modify the script, then click{' '}- <Typography.Text code>Run</Typography.Text>. More coming soon!- </Typography.Text>+ </p>+ <p className="text-sm text-scale-1100">+ Click on any script to fill the query box, modify the script, then click+ <span className="text-code">Run</span>.+ </p></div>- <div className="grid grid-cols-3 gap-4">+ <div className="grid sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4">{QuickStart.map((x) => (<SqlCardkey={x.title}@@ -117,14 +114,19 @@ const SqlCard = ({ title, description, sql, onClick }) => {onClick(sql, title)}return (- <a- className="rounded bg-panel-header-light dark:bg-panel-header-dark transition-colors+ <CardButton+ onClick={() => handleOnClick()}+ title={title}+ footer={<span className="text-sm text-scale-1100">{description}</span>}+ >+ {/* <a+ className="rounded bg-panel-header-light dark:bg-panel-header-dark transition-colorsborder border-panel-border-light dark:border-panel-border-darkhover:border-panel-border-hover-light dark:hover:border-panel-border-hover-darkcursor-pointer"- onClick={() => handleOnClick()}- >- <div className="px-6 py-3 border-b dark:border-dark flex items-center justify-between">+ onClick={() => handleOnClick()}+ > */}+ {/* <div className="px-6 py-3 border-b dark:border-dark flex items-center justify-between"><Typography.Title level={6} className="m-0">{title}</Typography.Title>@@ -138,8 +140,9 @@ const SqlCard = ({ title, description, sql, onClick }) => {</div><p className="px-6 py-4 capitalize-first"><Typography.Text type="secondary">{description}</Typography.Text>- </p>- </a>+ </p> */}+ {/* </a> */}+ </CardButton>)}diff --git a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePolicies.js b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePolicies.jsindex c693f498499..6d6e6f5b03b 100644--- a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePolicies.js+++ b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePolicies.js@@ -8,7 +8,7 @@ import { formatPoliciesForStorage } from '../Storage.utils'import StoragePoliciesPlaceholder from './StoragePoliciesPlaceholder'import StoragePoliciesBucketRow from './StoragePoliciesBucketRow'import StoragePoliciesEditPolicyModal from './StoragePoliciesEditPolicyModal'-import ConfirmModal from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModalV2'+import ConfirmModal from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'import PolicyEditorModal from 'components/to-be-cleaned/Auth/PolicyEditorModal'diff --git a/studio/components/ui/CardButton.tsx b/studio/components/ui/CardButton.tsxnew file mode 100644index 00000000000..4742c429d45--- /dev/null+++ b/studio/components/ui/CardButton.tsx@@ -0,0 +1,110 @@+import React, { FC } from 'react'+import { IconChevronRight } from '@supabase/ui'+import Link from 'next/link'++interface Props {+ title: string | React.ReactNode+ description?: string+ children?: React.ReactNode+ footer?: React.ReactNode+ url?: string+ linkHref?: string+ imgUrl?: string+ imgAlt?: string+ onClick?: () => void+}++const CardButton: FC<Props> = ({+ title,+ description,+ children,+ footer,+ url = '',+ linkHref = '',+ imgUrl,+ imgAlt,+ onClick,+}) => {+ const LinkContainer = ({ children }: { children: React.ReactNode }) => (+ <Link href={linkHref}>{children}</Link>+ )+ const UrlContainer = ({ children }: { children: React.ReactNode }) => <a href={url}>{children}</a>+ const NonLinkContainer = ({ children }: { children: React.ReactNode }) => <div>{children}</div>+ const ButtonContainer = ({ children }: { children: React.ReactNode }) => (+ <button onClick={onClick}>{children}</button>+ )++ const isLink = url || linkHref || onClick++ let containerClasses = [+ 'group relative text-left',+ 'bg-panel-header-light dark:bg-panel-header-dark',+ 'border border-panel-border-light dark:border-panel-border-dark',+ 'rounded-md py-4 px-6 flex flex-row h-32',+ 'transition ease-in-out duration-150',+ ]++ if (isLink) {+ containerClasses = [+ ...containerClasses,+ 'cursor-pointer',+ 'hover:bg-panel-border-light dark:hover:bg-panel-border-dark',+ 'hover:border-panel-border-hover-light',+ 'dark:hover:border-panel-border-hover-dark hover:border-gray-300',+ ]+ }++ const contents = (+ <div className={containerClasses.join(' ')}>+ {imgUrl && (+ <div className="flex flex-col mr-4">+ <img+ className="+ transition-all+ group-hover:scale-110+ "+ src={`${imgUrl}`}+ alt={`${imgAlt}`}+ width="26"+ />+ </div>+ )}+ <div className="flex flex-col space-y-2 w-full h-full">+ <h5 className="text-scale-1200">{title}</h5>+ <div className="flex flex-1 w-full">+ <p className="text-scale-1100 text-sm">{description}</p>+ <div className="w-full">{children && children}</div>+ </div>+ <div className="w-full">{footer && footer}</div>+ </div>+ {isLink && (+ <div+ className="+ absolute+ right-4+ top-3+ text-scale-900+ transition-all+ duration-200+ group-hover:right-3+ group-hover:text-scale-1200+ "+ >+ <IconChevronRight />+ </div>+ )}+ </div>+ )++ if (onClick) {+ return <ButtonContainer children={contents} />+ } else if (linkHref) {+ return <LinkContainer children={contents} />+ } else if (url) {+ return <UrlContainer children={contents} />+ } else {+ return <NonLinkContainer children={contents} />+ }+}++export default CardButtondiff --git a/studio/styles/ui.scss b/studio/styles/ui.scssindex 590d9e06a31..648604b68cf 100644--- a/studio/styles/ui.scss+++ b/studio/styles/ui.scss@@ -201,37 +201,49 @@/* Docs */.Docs {&--inner-wrapper {- background: linear-gradient(90deg, #ffffff 50%, #f3f4f6 50%); /* bg-white bg-coolGray-100 */+ background: linear-gradient(+ 90deg,+ var(--colors-scale1) 50%,+ var(--colors-scale3) 50%+ ); /* bg-white bg-coolGray-100 */width: 100%;}.dark &--inner-wrapper {- background: linear-gradient(90deg, #1f1f1f 50%, #2a2a2a 50%); /* bg-gray-700 bg-gray-600 */+ background: linear-gradient(+ 90deg,+ var(--colors-scale3) 50%,+ var(--colors-scale2) 50%+ ); /* bg-gray-700 bg-gray-600 */}- h1,- h2,- h3 {- @apply p-4 m-0;- }+ // h1,+ // h2,+ // h3 {+ // @apply p-4 m-0;+ // }.doc-heading {- @apply text-black dark:text-white capitalize mt-4 w-1/2;+ @apply text-black dark:text-white capitalize mt-4 px-6 w-1/2;hyphens: auto;max-width: 50%;}.doc-section {- @apply border-b dark:border-dark text-gray-600 dark:text-gray-300 flex;+ @apply border-b flex border-scale-500;+ }++ .doc-section article:first-child {+ @apply prose prose-docs prose-sm max-w-none;}.text {- @apply flex-1 p-4 w-1/2;+ @apply p-4 px-6 w-1/2;max-width: 50%;- a:not(.btn-primary):not(.btn-secondary) {- @apply text-green-500;- }+ // a:not(.btn-primary):not(.btn-secondary) {+ // @apply text-green-500;+ // }a:hover {@apply text-green-600;@@ -243,11 +255,11 @@}.code {- @apply flex-1 p-2 w-1/2 pb-4;+ @apply flex-1 p-2 px-6 w-1/2 pb-4;max-width: 50%;h4 {- @apply uppercase font-medium m-1 p-0 text-sm;+ @apply uppercase font-normal m-1 p-0 text-sm text-scale-1100;}h4:not(:first-child) {@@ -260,19 +272,19 @@}.is-highlighted {- @apply text-green-500;+ @apply text-brand-900;}}}::-moz-selection {/* Code for Firefox */- @apply bg-green-400;+ @apply bg-brand-900;color: #333 !important;}::selection {- @apply bg-green-400;+ @apply bg-brand-900;color: #333 !important;}