Skip to content

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

chore: Triggers, Functions and Hooks SidePanels updated

Jonathan Summers-Muird0dd6f6bd0dc
diff --git a/studio/components/interfaces/Database/Functions/CreateFunction.tsx b/studio/components/interfaces/Database/Functions/CreateFunction.tsx
index 4c54b15e5e2..46f2f96dfdc 100644
--- a/studio/components/interfaces/Database/Functions/CreateFunction.tsx
+++ b/studio/components/interfaces/Database/Functions/CreateFunction.tsx
@@ -350,13 +350,10 @@ const CreateFunction: FC<CreateFunctionProps> = ({ func, visible, setVisible })
return (
<>
<SidePanel
- wide
+ size="large"
visible={visible}
onCancel={() => setVisible(!visible)}
- // @ts-ignore
- contentStyle={{ padding: 0 }}
- footerBackground={true}
- title={_localState.title}
+ header={_localState.title}
className="hooks-sidepanel transform transition-all duration-300 ease-in-out mr-0"
loading={_localState.loading}
onConfirm={handleSubmit}
@@ -365,34 +362,33 @@ const CreateFunction: FC<CreateFunctionProps> = ({ func, visible, setVisible })
<div className="space-y-10 mt-4">
{_localState.isEditing ? (
<>
- <div className="px-6 space-y-6">
+ <div className="px-6 space-y-10">
<InputName />
<SelectSchema />
</div>
- <Divider light />
- <div className="px-6 space-y-6">
- <InputMultiArguments readonly={true} />
- <InputDefinition />
- </div>
+ <SidePanel.Seperator />
+ <InputMultiArguments readonly={true} />
+ <InputDefinition />
</>
) : (
<div className="space-y-6">
<InputName />
- <Divider light />
+ <SidePanel.Seperator />
<SelectSchema />
<SelectReturnType />
- <Divider light />
+ <SidePanel.Seperator />
<InputMultiArguments />
- <Divider light />
+ <SidePanel.Seperator />
<InputDefinition />
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6">
<Panel>
- <div className={`space-y-8 py-4 dark:bg-bg-alt-dark rounded`}>
+ <div className={`space-y-8 py-4 bg-bg-alt-light dark:bg-bg-alt-dark rounded`}>
<div className={`px-6`}>
<Toggle
onChange={() => _localState.toggleAdvancedVisible()}
label="Show advanced settings"
+ checked={_localState.advancedVisible}
labelOptional="These are settings that might be familiar for postgres heavy users "
/>
</div>
@@ -402,12 +398,12 @@ const CreateFunction: FC<CreateFunctionProps> = ({ func, visible, setVisible })
</div>
{_localState.advancedVisible && (
<>
- {/* <Divider light /> */}
+ {/* <SidePanel.Seperator /> */}
<SelectLanguage />
<SelectBehavior />
- <Divider light />
+ <SidePanel.Seperator />
<InputMultiConfigParams />
- <Divider light />
+ <SidePanel.Seperator />
<RadioSecurity />
</>
)}
@@ -425,24 +421,22 @@ export default observer(CreateFunction)
const InputName: FC = observer(({}) => {
const _localState = useContext(CreateFunctionContext)
return (
- <div className={'px-6'}>
- <Input
- id="name"
- label="Name of function"
- layout="horizontal"
- placeholder="Name of function"
- value={_localState!.formState.name.value}
- onChange={(e) =>
- _localState!.onFormChange({
- key: 'name',
- value: e.target.value,
- })
- }
- size="small"
- error={_localState!.formState.name.error}
- descriptionText="Name will also be used for the function name in postgres"
- />
- </div>
+ <Input
+ id="name"
+ label="Name of function"
+ layout="horizontal"
+ placeholder="Name of function"
+ value={_localState!.formState.name.value}
+ onChange={(e) =>
+ _localState!.onFormChange({
+ key: 'name',
+ value: e.target.value,
+ })
+ }
+ size="small"
+ error={_localState!.formState.name.error}
+ descriptionText="Name will also be used for the function name in postgres"
+ />
)
})
@@ -464,16 +458,14 @@ const InputMultiArguments: FC<InputMultiArgumentsProps> = observer(({ readonly }
return (
<div className={'px-6'}>
<div className="flex flex-col">
- <Typography.Text>Arguments</Typography.Text>
- <Typography.Text type="secondary">
+ <h5 className="text-base text-scale-1200">Arguments</h5>
+ <p className="text-sm text-scale-1100">
Arguments can be referenced in the function body using either names or numbers.
- </Typography.Text>
+ </p>
</div>
<div className="pt-4 space-y-2">
{readonly && isEmpty(_localState!.formState.args.value) && (
- <Typography.Text type="secondary" className="opacity-50">
- No argument for this function
- </Typography.Text>
+ <span className="text-scale-900">No argument for this function</span>
)}
{_localState!.formState.args.value.map(
(x: { name: string; type: string; error?: string }, idx: number) => (
@@ -489,7 +481,7 @@ const InputMultiArguments: FC<InputMultiArgumentsProps> = observer(({ readonly }
)}
{!readonly && (
<div className="">
- <Button type="dashed" icon={<IconPlus />} onClick={onAddArgument} disabled={readonly}>
+ <Button type="default" icon={<IconPlus />} onClick={onAddArgument} disabled={readonly}>
Add a new argument
</Button>
</div>
@@ -568,7 +560,7 @@ const InputArgument: FC<InputArgumentProps> = observer(({ idx, name, type, error
<div>
<Button
danger
- type="primary"
+ type="default"
icon={<IconTrash size="tiny" />}
onClick={onDelete}
size="small"
@@ -593,7 +585,7 @@ const InputMultiConfigParams: FC = observer(({}) => {
return (
<div className={'px-6'}>
<div className="flex justify-between items-center">
- <Typography.Text>Config Params</Typography.Text>
+ <h5 className="text-base text-scale-1200">Config Params</h5>
</div>
<div className="pt-4 space-y-2">
{_localState!.formState.configParams.value.map(
@@ -612,7 +604,7 @@ const InputMultiConfigParams: FC = observer(({}) => {
)}
</div>
<div className="pt-2">
- <Button type="dashed" icon={<IconPlus />} onClick={onAddArgument}>
+ <Button type="default" icon={<IconPlus />} onClick={onAddArgument}>
Add a new config
</Button>
</div>
@@ -680,7 +672,7 @@ const InputConfigParam: FC<InputConfigParamProps> = observer(({ idx, name, value
<div>
<Button
danger
- type="primary"
+ type="default"
icon={<IconTrash size="tiny" />}
onClick={onDelete}
size="small"
@@ -695,13 +687,13 @@ const InputDefinition: FC = observer(({}) => {
return (
<div className={`space-y-4 px-6`}>
<div className="flex flex-col">
- <Typography.Text>Definition</Typography.Text>
- <Typography.Text type="secondary">
+ <h5 className="text-base text-scale-1200">Definition</h5>
+ <p className="text-sm text-scale-1100">
The language below should be written in `{_localState!.formState.language.value}`.
- </Typography.Text>
- <Typography.Text type="secondary">
+ </p>
+ <p className="text-sm text-scale-1100">
Change the language in the Advanced Settings below.
- </Typography.Text>
+ </p>
</div>
<div className="h-40 border dark:border-dark">
{/* @ts-ignore */}
@@ -725,29 +717,27 @@ const SelectSchema: FC = observer(({}) => {
const _localState = useContext(CreateFunctionContext)
return (
- <div className={`space-y-4 px-6`}>
- <Select
- id="schema"
- label="Schema"
- layout="horizontal"
- value={_localState!.formState.schema.value}
- onChange={(e) =>
- _localState!.onFormChange({
- key: 'schema',
- value: e.target.value,
- })
- }
- placeholder="Pick a schema"
- size="small"
- descriptionText="Tables made in the table editor will be in 'public'"
- >
- {_localState!.schemas.map((x) => (
- <Select.Option key={x.name} value={x.name}>
- {x.name}
- </Select.Option>
- ))}
- </Select>
- </div>
+ <Select
+ id="schema"
+ label="Schema"
+ layout="horizontal"
+ value={_localState!.formState.schema.value}
+ onChange={(e) =>
+ _localState!.onFormChange({
+ key: 'schema',
+ value: e.target.value,
+ })
+ }
+ placeholder="Pick a schema"
+ size="small"
+ descriptionText="Tables made in the table editor will be in 'public'"
+ >
+ {_localState!.schemas.map((x) => (
+ <Select.Option key={x.name} value={x.name}>
+ {x.name}
+ </Select.Option>
+ ))}
+ </Select>
)
})
@@ -878,7 +868,7 @@ const RadioSecurity: FC = observer(({}) => {
label="SECURITY INVOKER"
value="SECURITY_INVOKER"
checked={!_localState!.formState.securityDefiner.value}
- description="function is to be executed with the privileges of the user that calls it."
+ description="Function is to be executed with the privileges of the user that calls it."
/>
<Radio
id="SECURITY_DEFINER"
diff --git a/studio/components/interfaces/Database/Hooks/CreateHook.tsx b/studio/components/interfaces/Database/Hooks/CreateHook.tsx
index 84e36ab2768..3403000117b 100644
--- a/studio/components/interfaces/Database/Hooks/CreateHook.tsx
+++ b/studio/components/interfaces/Database/Hooks/CreateHook.tsx
@@ -17,6 +17,7 @@ import {
Badge,
IconTrash,
IconPlus,
+ Alert,
} from '@supabase/ui'
import Image from 'next/image'
@@ -428,13 +429,10 @@ const CreateHook: FC<CreateHookProps> = ({ hook, visible = true, setVisible }) =
return (
<SidePanel
- wide
+ size="large"
visible={visible}
onCancel={() => setVisible(!visible)}
- // @ts-ignore
- contentStyle={{ padding: 0 }}
- footerBackground={true}
- title={_localState.title}
+ header={_localState.title}
className={
'hooks-sidepanel transform transition-all duration-300 ease-in-out mr-0 ' + '' // (showCreateFunctionSidePanel ? 'mr-16' : '')
}
@@ -442,9 +440,9 @@ const CreateHook: FC<CreateHookProps> = ({ hook, visible = true, setVisible }) =
onConfirm={handleSubmit}
>
<CreateHookContext.Provider value={_localState}>
- <div className="space-y-6 mt-4 pb-8">
+ <div className="space-y-10 py-6">
{_localState.isEditing ? (
- <div className="px-6 space-y-6">
+ <div className="px-6 space-y-10 py-6">
<InputName />
<SelectEnabledMode />
</div>
@@ -453,15 +451,15 @@ const CreateHook: FC<CreateHookProps> = ({ hook, visible = true, setVisible }) =
<div className="px-6">
<InputName />
</div>
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6 space-y-6">
- <Typography.Title level={5}>Conditions to fire hook</Typography.Title>
+ <h5 className="text-base text-scale-1200">Conditions to fire hook</h5>
<ListboxTable />
<CheckboxEvents />
</div>
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6 space-y-6">
- <Typography.Title level={5}>Type of hook</Typography.Title>
+ <h5 className="text-base text-scale-1200">Type of hook</h5>
<RadioGroupHookService />
</div>
<ServiceConfigForm />
@@ -546,18 +544,21 @@ const CheckboxEvents: FC = observer(({}) => {
>
<Checkbox
value="INSERT"
+ id="INSERT"
label="Insert"
description={'Any insert operation on the table'}
checked={_localState.formState.events.value.includes('INSERT')}
/>
<Checkbox
value="UPDATE"
+ id="UPDATE"
label="Update"
description="Any update operation, of any column in the table"
checked={_localState.formState.events.value.includes('UPDATE')}
/>
<Checkbox
value="DELETE"
+ id="DELETE"
label="Delete"
description="Any deletion of a record"
checked={_localState.formState.events.value.includes('DELETE')}
@@ -632,7 +633,7 @@ const ListboxTable: FC = observer(({}) => {
value={x.id}
label={x.name}
addOnBefore={() => (
- <div className="bg-green-600 p-1 flex items-center justify-center rounded text-typography-body-dark ">
+ <div className="bg-scale-1200 p-1 flex items-center justify-center rounded text-scale-100 ">
<SVG
src={'/img/table-editor.svg'}
style={{ width: `16px`, height: `16px`, strokeWidth: '1px' }}
@@ -661,7 +662,7 @@ const hookServiceOptions: {
id: string
label: string
badge: string
- badgeType: 'green' | 'blue'
+ badgeType: 'brand' | 'amber'
description: string
img_url: string
}[] = [
@@ -669,7 +670,7 @@ const hookServiceOptions: {
id: 'http_request',
label: 'HTTP Request',
badge: 'Alpha',
- badgeType: 'green',
+ badgeType: 'brand',
description: 'Send an HTTP request to any URL.',
img_url: 'http-request.png',
},
@@ -677,7 +678,7 @@ const hookServiceOptions: {
id: 'supabase_function',
label: 'Supabase Function',
badge: 'Coming soon',
- badgeType: 'blue',
+ badgeType: 'amber',
description: 'Choose a Supabase Function to run.',
img_url: 'supabase-severless-function.png',
},
@@ -685,7 +686,7 @@ const hookServiceOptions: {
id: 'google_cloud_function',
label: 'Google cloud run',
badge: 'Coming soon',
- badgeType: 'blue',
+ badgeType: 'amber',
description: 'Choose a google cloud function to run',
img_url: 'google-cloud-run.png',
},
@@ -693,7 +694,7 @@ const hookServiceOptions: {
id: 'aws_lambda_function',
label: 'AWS Lambda',
badge: 'Coming soon',
- badgeType: 'blue',
+ badgeType: 'amber',
description: 'Choose an AWS Lambda function to run.',
img_url: 'aws-lambda-severless-function.png',
},
@@ -729,7 +730,7 @@ interface RadioHookService {
description: string
label: string
img_url: string
- badgeType: 'green' | 'blue'
+ badgeType: 'brand' | 'amber'
badge: string
}
@@ -739,13 +740,12 @@ const RadioHookService: FC<RadioHookService> = observer(
return (
<Radio
id={id}
- // label={label}
value={id}
checked={_localState.formState.hookService.value == id}
// @ts-ignore
beforeLabel={
<>
- <div className="flex items-center space-x-3">
+ <div className="flex items-center space-x-5">
{/* <div className="h-3 w-3"> */}
<Image
src={`/img/function-providers/${img_url}`}
@@ -756,16 +756,14 @@ const RadioHookService: FC<RadioHookService> = observer(
{/* </div> */}
<div className="flex-col space-y-0">
<div className="flex space-x-1">
- <Typography.Text>{label}</Typography.Text>
+ <span className="text-scale-1200">{label}</span>
<Badge color={badgeType}>{badge}</Badge>
</div>
- <Typography.Text type="secondary">{description}</Typography.Text>
+ <span className="text-scale-900">{description}</span>
</div>
</div>
</>
}
- // @ts-ignore
- // description={description}
/>
)
}
@@ -777,7 +775,7 @@ const ServiceConfigForm: FC = observer(({}) => {
<>
{_localState.formState.hookService.value === 'http_request' ? (
<>
- <Divider light />
+ <SidePanel.Seperator />
<div className="space-y-10">
<div className="px-6 space-y-6">
<Typography.Title level={5}>HTTP Request</Typography.Title>
@@ -785,18 +783,20 @@ const ServiceConfigForm: FC = observer(({}) => {
<InputServiceUrl />
{/* <InputServiceTimeout /> */}
</div>
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6">
<InputMultiServiceHeaders />
</div>
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6">
<InputMultiServiceParams />
</div>
</div>
</>
) : (
- <ServiceUnavailableBox />
+ <div className="px-6">
+ <ServiceUnavailableBox />
+ </div>
)}
</>
)
@@ -1092,37 +1092,22 @@ const InputServiceParam: FC<InputServiceParamsProps> = observer(({ idx, name, va
const ServiceUnavailableBox: FC = observer(({}) => {
const _localState: any = useContext(CreateHookContext)
return (
- <div className="px-6">
- <div className="block w-full bg-yellow-500 bg-opacity-5 p-3 px-6 border border-yellow-600 border-opacity-40 rounded">
- <div className="flex space-x-3">
- {/* <div className="mt-1">
- <IconTool className="text-white" size="large" />
- </div> */}
- <div className="flex justify-between w-full items-center">
- <div>
- <Typography.Text>Service under development.</Typography.Text>
- <div>
- <Typography.Text type="secondary">
- We currently do not support this service.
- </Typography.Text>
- </div>
- </div>
-
- <Button
- type="outline"
- className="flex-grow"
- onClick={() =>
- _localState.onFormChange({
- key: 'hookService',
- value: 'http_request',
- })
- }
- >
- Switch to HTTP
- </Button>
- </div>
- </div>
+ <Alert variant="warning" title="Service under development" withIcon>
+ <div className="space-y-4">
+ <div>We currently do not support this service.</div>
+ <Button
+ type="default"
+ className="flex-grow"
+ onClick={() =>
+ _localState.onFormChange({
+ key: 'hookService',
+ value: 'http_request',
+ })
+ }
+ >
+ Switch to HTTP
+ </Button>
</div>
- </div>
+ </Alert>
)
})
diff --git a/studio/components/interfaces/Database/Triggers/ChooseFunctionForm.tsx b/studio/components/interfaces/Database/Triggers/ChooseFunctionForm.tsx
index f6b74870fc7..fe5420d04dd 100644
--- a/studio/components/interfaces/Database/Triggers/ChooseFunctionForm.tsx
+++ b/studio/components/interfaces/Database/Triggers/ChooseFunctionForm.tsx
@@ -6,6 +6,7 @@ import { Transition } from '@headlessui/react'
import {
Button,
IconChevronDown,
+ IconHelpCircle,
IconTerminal,
IconTool,
SidePanel,
@@ -14,6 +15,7 @@ import {
import { Dictionary } from '@supabase/grid'
import SqlEditor from 'components/to-be-cleaned/SqlEditor'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
+import InformationBox from 'components/ui/InformationBox'
interface IChooseFunctionFormStore {
functionSchemas: string[]
@@ -55,16 +57,16 @@ const ChooseFunctionForm: React.FC<ChooseFunctionFormProps> = ({
return (
<SidePanel
- wide
- title="Pick a function"
+ size="large"
+ header="Pick a function"
visible={visible}
onCancel={() => setVisible(!visible)}
className="hooks-sidepanel"
>
{hasPublicSchemaFunctions ? (
<ChooseFunctionFormContext.Provider value={_localState}>
- <NoticeBox />
<div className="space-y-6">
+ <NoticeBox />
{_localState.functionSchemas.map((schema: string) => (
<SchemaFunctionGroup key={schema} schema={schema} selectFunction={selectFunction} />
))}
@@ -83,36 +85,22 @@ const NoticeBox: React.FC = ({}) => {
const router = useRouter()
const { ref } = router.query
return (
- <div className="px-6 mb-8">
- <div className="block w-full bg-white bg-opacity-5 p-3 px-6 border border-white border-opacity-20 rounded">
- <div className="flex space-x-3">
- <div className="mt-1">
- <IconTool className="text-white" size="large" />
- </div>
- <div className="flex justify-between w-full items-center">
- <div>
- <Typography.Text>
- Only functions that return a trigger will be displayed below
- </Typography.Text>
- <div>
- <Typography.Text type="secondary">
- You can make functions by using the Database Functions
- </Typography.Text>
- </div>
- </div>
-
- <Button
- type="secondary"
- className="flex-grow"
- onClick={() => {
- router.push(`/project/${ref}/database/functions`)
- }}
- >
- Go to Functions
- </Button>
- </div>
- </div>
- </div>
+ <div className="px-6">
+ <InformationBox
+ icon={<IconHelpCircle size="large" strokeWidth={1.5} />}
+ title="Only functions that return a trigger will be displayed below"
+ description={`You can make functions by using the Database Functions`}
+ button={
+ <Button
+ type="secondary"
+ onClick={() => {
+ router.push(`/project/${ref}/database/functions`)
+ }}
+ >
+ Go to Functions
+ </Button>
+ }
+ />
</div>
)
}
@@ -148,7 +136,7 @@ const SchemaFunctionGroup: React.FC<SchemaFunctionGroupProps> = observer(
const _functions = _pageState!.triggerFunctions.filter((x) => x.schema == schema)
return (
<div className="space-y-4">
- <div className="z-10 sticky top-0 backdrop-filter backdrop-blur px-6 flex items-center space-x-1">
+ <div className="sticky top-0 backdrop-filter backdrop-blur px-6 flex items-center space-x-1">
<Typography.Title level={5} className="opacity-50">
schema
</Typography.Title>
@@ -186,8 +174,8 @@ const Function: React.FC<FunctionProps> = ({ id, completeStatement, name, onClic
>
<div className="flex items-center space-x-3 justify-between">
<div className="flex items-center space-x-3">
- <div className="bg-green-600 p-1 flex items-center justify-center rounded text-typography-body-dark ">
- <IconTerminal size="small" strokeWidth={2} />
+ <div className="bg-scale-1200 p-1 flex items-center justify-center rounded text-scale-100 ">
+ <IconTerminal size="small" strokeWidth={2} size={14} />
</div>
<Typography.Title level={5} className="mb-0">
{name}
diff --git a/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx b/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx
index 7a360c39481..f43f2b50ec0 100644
--- a/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx
+++ b/studio/components/interfaces/Database/Triggers/CreateTrigger.tsx
@@ -14,6 +14,7 @@ import {
IconTerminal,
IconTool,
Badge,
+ Button,
} from '@supabase/ui'
import { Dictionary } from '@supabase/grid'
import { useRouter } from 'next/router'
@@ -325,13 +326,10 @@ const CreateTrigger: FC<CreateTriggerProps> = ({ trigger, visible, setVisible })
return (
<>
<SidePanel
- wide
+ size="large"
visible={visible}
onCancel={() => setVisible(!visible)}
- // @ts-ignore
- contentStyle={{ padding: 0 }}
- footerBackground={true}
- title={_localState.title}
+ header={_localState.title}
hideFooter={!hasPublicTables}
className={
_localState.chooseFunctionFormVisible
@@ -342,9 +340,9 @@ const CreateTrigger: FC<CreateTriggerProps> = ({ trigger, visible, setVisible })
onConfirm={handleSubmit}
>
{hasPublicTables ? (
- <div className="pb-8">
+ <div className="">
<CreateTriggerContext.Provider value={_localState}>
- <div className="space-y-10 mt-4">
+ <div className="space-y-10 my-6">
{_localState.isEditing ? (
<div className="px-6 space-y-6">
<InputName />
@@ -355,7 +353,7 @@ const CreateTrigger: FC<CreateTriggerProps> = ({ trigger, visible, setVisible })
<div className="px-6">
<InputName />
</div>
- <Divider light />
+ <SidePanel.Seperator />
<div className="px-6 space-y-12">
<Typography.Title level={5}>Conditions to fire trigger</Typography.Title>
<ListboxTable />
@@ -363,7 +361,7 @@ const CreateTrigger: FC<CreateTriggerProps> = ({ trigger, visible, setVisible })
<ListboxActivation />
<SelectOrientation />
</div>
- <Divider light />
+ <SidePanel.Seperator />
<FunctionForm />
</>
)}
@@ -448,52 +446,54 @@ const SelectEnabledMode: FC = observer(({}) => {
<Listbox.Option
addOnBefore={({ active, selected }: any) => {
return (
- <div className="bg-green-500 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
+ <div className="bg-green-900 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
)
}}
value="ORIGIN"
label="Origin"
>
Origin
- <span className="opacity-50 block">This is a default behaviour</span>
+ <span className="text-scale-900 block">This is a default behaviour</span>
</Listbox.Option>
<Listbox.Option
addOnBefore={({ active, selected }: any) => {
return (
- <div className="bg-green-500 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
+ <div className="bg-green-900 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
)
}}
value="REPLICA"
label="Replica"
>
Replica
- <span className="opacity-50 block">Will only fire if the session is in “replica” mode</span>
+ <span className="text-scale-900 block">
+ Will only fire if the session is in “replica” mode
+ </span>
</Listbox.Option>
<Listbox.Option
addOnBefore={({ active, selected }: any) => {
return (
- <div className="bg-green-500 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
+ <div className="bg-green-900 border border-green-700 shadow-sm w-3 h-3 rounded-full"></div>
)
}}
value="ALWAYS"
label="Always"
>
Always
- <span className="opacity-50 block">
+ <span className="text-scale-900 block">
Will fire regardless of the current replication role
</span>
</Listbox.Option>
<Listbox.Option
addOnBefore={({ active, selected }: any) => {
return (
- <div className="bg-red-500 border border-red-700 shadow-sm w-3 h-3 rounded-full"></div>
+ <div className="bg-red-900 border border-red-700 shadow-sm w-3 h-3 rounded-full"></div>
)
}}
value="DISABLED"
label="Disabled"
>
Disabled
- <span className="opacity-50 block">Will not fire</span>
+ <span className="text-scale-900 block">Will not fire</span>
</Listbox.Option>
</Listbox>
)
@@ -518,11 +518,11 @@ const SelectOrientation: FC = observer(({}) => {
>
<Listbox.Option value="ROW" label="Row">
Row
- <span className="opacity-50 block">fires once for each processed row</span>
+ <span className="text-scale-900 block">fires once for each processed row</span>
</Listbox.Option>
<Listbox.Option value="STATEMENT" label="Statement">
Statement
- <span className="opacity-50 block">fires once for each statement</span>
+ <span className="text-scale-900 block">fires once for each statement</span>
</Listbox.Option>
</Listbox>
)
@@ -566,7 +566,7 @@ const ListboxTable: FC = observer(({}) => {
value={x.id}
label={x.name}
addOnBefore={() => (
- <div className="bg-green-600 p-1 flex items-center justify-center rounded text-typography-body-dark ">
+ <div className="bg-scale-1200 p-1 flex items-center justify-center rounded text-scale-100 ">
<SVG
src={'/img/table-editor.svg'}
style={{ width: `16px`, height: `16px`, strokeWidth: '1px' }}
@@ -580,7 +580,7 @@ const ListboxTable: FC = observer(({}) => {
<div className="flex flex-row items-center space-x-1">
<Typography.Text>{x.name}</Typography.Text>
<Divider light type="vertical" />
- <Typography.Text type="secondary" className="opacity-50" small>
+ <Typography.Text type="secondary" className="text-scale-900" small>
{x.schema}
</Typography.Text>
</div>
@@ -617,19 +617,19 @@ const CheckboxEvents: FC = observer(({}) => {
>
<Checkbox
value="INSERT"
- label="INSERT"
+ label="Insert"
description={'Any insert operation on the table'}
checked={_localState!.formState.events.value.includes('INSERT')}
/>
<Checkbox
value="UPDATE"
- label="UPDATE"
+ label="Update"
description="Any update operation, of any column in the table"
checked={_localState!.formState.events.value.includes('UPDATE')}
/>
<Checkbox
value="DELETE"
- label="DELETE"
+ label="Delete"
description="Any deletion of a record"
checked={_localState!.formState.events.value.includes('DELETE')}
/>
@@ -660,14 +660,16 @@ const ListboxActivation: FC = observer(({}) => {
value={'BEFORE'}
label={'Before the event'}
addOnBefore={() => (
- <div className="bg-green-600 p-1 flex items-center justify-center rounded text-typography-body-dark ">
+ <div className="bg-scale-1200 p-1 flex items-center justify-center rounded text-scale-100 ">
<IconPauseCircle strokeWidth={2} size="small" />
</div>
)}
>
<div className="flex flex-col">
<span>{'before'}</span>
- <span className="opacity-50 block">Trigger fires before the operation is attempted</span>
+ <span className="text-scale-900 block">
+ Trigger fires before the operation is attempted
+ </span>
</div>
</Listbox.Option>
<Listbox.Option
@@ -675,14 +677,16 @@ const ListboxActivation: FC = observer(({}) => {
value={'AFTER'}
label={'After the event'}
addOnBefore={() => (
- <div className="bg-green-600 p-1 flex items-center justify-center rounded text-typography-body-dark ">
+ <div className="bg-green-1200 p-1 flex items-center justify-center rounded text-scale-100 ">
<IconPlayCircle strokeWidth={2} size="small" />
</div>
)}
>
<div className="flex flex-col">
<span>{'after'}</span>
- <span className="opacity-50 block">Trigger fires after the operation has completed</span>
+ <span className="text-scale-900 block">
+ Trigger fires after the operation has completed
+ </span>
</div>
</Listbox.Option>
</Listbox>
@@ -714,19 +718,23 @@ const FunctionEmpty: FC = observer(({}) => {
<button
type="button"
onClick={() => _localState!.setChooseFunctionFormVisible(true)}
- className="w-full relative transition-shadow shadow-sm
- border-2 border-dashed dark:border-dark rounded hover:border-gray-300
- px-6 py-4
- hover:bg-bg-alt-light dark:hover:bg-bg-alt-dark hover:bg-opacity-25 hover:shadow-md cursor-pointer
- flex space-x-3 items-center"
+ className="w-full relative
+ transition-all
+
+ shadow-sm
+ border bg-scale-200 dark:bg-scale-400
+ border-scale-600
+ rounded
+ hover:border-scale-700
+ hover:bg-scale-300 dark:hover:bg-scale-500
+ px-5 py-1
+
+ "
>
<FormEmptyBox
- icon={<IconTerminal size={21} strokeWidth={2} />}
+ icon={<IconTerminal size={14} strokeWidth={2} />}
text="Choose a function to trigger"
/>
- <div className="form-info-panel__edit-icon transition-all opacity-0 absolute right-3 top-3 mt-0 bg-gray-600 w-8 h-8 rounded-full flex items-center justify-center text-white">
- <IconTool size="small" />
- </div>
</button>
)
})
@@ -736,34 +744,38 @@ const FunctionWithArguments: FC = observer(({}) => {
return (
<>
- <button
- type="button"
- onClick={() => _localState!.setChooseFunctionFormVisible(true)}
- className="bg-bg-alt-light dark:bg-bg-alt-dark
+ <div
+ className="
+
+
w-full
- form-info-panel
+
relative
transition-shadow shadow-sm
- border dark:border-dark rounded hover:border-gray-300
- px-6 py-4
- hover:bg-gray-100 hover:bg-opacity-25 hover:shadow-md cursor-pointer
- flex space-x-3 items-center"
+ border border-scale-200 dark:border-scale-500
+ rounded
+
+
+ px-5 py-4
+ flex space-x-3 items-center justify-between"
>
- <div className="flex rounded-full w-8 h-8 bg-green-700 bg-opacity-10 items-center justify-center">
- <IconTerminal size="small" strokeWidth={2} />
- </div>
- <div className="flex items-center justify-center space-x-4">
- <Typography.Text type="secondary">
- {_localState!.formState.functionName.value}
- </Typography.Text>
- <div>
- <Badge>{_localState!.formState.functionSchema.value}</Badge>
+ <div className="flex items-center gap-2">
+ <div className="flex rounded w-6 h-6 bg-scale-1200 text-scale-100 focus-within:bg-opacity-10 items-center justify-center">
+ <IconTerminal size="small" strokeWidth={2} width={14} />
+ </div>
+ <div className="flex items-center gap-2">
+ <Typography.Text type="secondary">
+ {_localState!.formState.functionName.value}
+ </Typography.Text>
+ <div>
+ <Badge>{_localState!.formState.functionSchema.value}</Badge>
+ </div>
</div>
</div>
- <div className="form-info-panel__edit-icon transition-all opacity-0 absolute right-3 top-3 mt-0 bg-gray-600 w-8 h-8 rounded-full flex items-center justify-center text-white">
- <IconTool size="small" />
- </div>
- </button>
+ <Button type="default" onClick={() => _localState!.setChooseFunctionFormVisible(true)}>
+ Change function
+ </Button>
+ </div>
</>
)
})
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx
index 8ce73246e20..1f83f01908b 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationIconButton.tsx
@@ -16,11 +16,11 @@ const NavigationIconButton: FC<Props> = ({ route, isActive = false }) => {
<Link href={route.link}>
<a
className={[
- 'transition-all',
+ 'transition-colors duration-200',
'flex items-center justify-center h-10 w-10 rounded', // Layout
'bg-scale-200 hover:bg-scale-500', // Light mode
'text-scale-900 hover:text-scale-1200 ', // Dark mode
- `${isActive ? 'bg-scale-500 shadow-sm hover:bg-scale-1200 text-scale-1200' : ''}`,
+ `${isActive ? 'bg-scale-500 shadow-sm text-scale-1200' : ''}`,
].join(' ')}
>
{route.icon}
diff --git a/studio/components/to-be-cleaned/AlphaPreview.tsx b/studio/components/to-be-cleaned/AlphaPreview.tsx
index e2f86b91076..364d0c19c15 100644
--- a/studio/components/to-be-cleaned/AlphaPreview.tsx
+++ b/studio/components/to-be-cleaned/AlphaPreview.tsx
@@ -1,22 +1,10 @@
-import { Typography, IconAlertCircle } from '@supabase/ui'
+import { Typography, IconAlertCircle, Alert } from '@supabase/ui'
const AlphaPreview = () => {
return (
- <div className="block w-full bg-yellow-500 bg-opacity-5 p-3 border border-yellow-500 border-opacity-50 rounded">
- <div className="flex space-x-3">
- <div>
- <IconAlertCircle className="text-yellow-500" size="large" />
- </div>
- <div className="flex flex-col">
- <Typography.Text type="warning">Alpha preview</Typography.Text>
- <div>
- <Typography.Text type="warning" small>
- This is not suitable for production
- </Typography.Text>
- </div>
- </div>
- </div>
- </div>
+ <Alert title="Alpha preview" withIcon variant="warning">
+ This is not suitable for production
+ </Alert>
)
}
diff --git a/studio/components/to-be-cleaned/FormBoxEmpty.tsx b/studio/components/to-be-cleaned/FormBoxEmpty.tsx
index 15a47f8a8d8..c2c29f4e203 100644
--- a/studio/components/to-be-cleaned/FormBoxEmpty.tsx
+++ b/studio/components/to-be-cleaned/FormBoxEmpty.tsx
@@ -4,7 +4,7 @@ import { Typography } from '@supabase/ui'
const EmptyPanel: FC<any> = ({ icon, text }) => {
return (
<div className="flex items-center justify-center flex-row py-4 space-x-2">
- <div className="relative bg-bg-secondary-light w-12 h-12 rounded-full flex items-center justify-center text-gray-300">
+ <div className="relative bg-scale-300 text-scale-900 w-6 h-6 rounded-full flex items-center justify-center">
{icon}
</div>
<Typography.Text type="secondary">{text}</Typography.Text>
diff --git a/studio/components/to-be-cleaned/ProductEmptyState.tsx b/studio/components/to-be-cleaned/ProductEmptyState.tsx
index 24c9e17eea8..a2e0f74ee6c 100644
--- a/studio/components/to-be-cleaned/ProductEmptyState.tsx
+++ b/studio/components/to-be-cleaned/ProductEmptyState.tsx
@@ -19,7 +19,7 @@ const ProductEmptyState: FC<Props> = ({
onClickCta = () => {},
}) => (
<div className="flex items-center justify-center w-full h-full">
- <div className="flex space-x-4 p-6 border rounded dark:border-dark bg-bg-secondary-light dark:bg-bg-secondary-dark shadow-md">
+ <div className="flex space-x-4 p-6 rounded border border-panel-border-light dark:border-panel-border-dark bg-panel-body-light dark:bg-panel-body-dark shadow-md">
{/* A graphic can probably be placed here as a sibling to the div below*/}
<div className="flex flex-col">
<div className="w-80 space-y-4">
diff --git a/studio/pages/project/[ref]/database/functions.tsx b/studio/pages/project/[ref]/database/functions.tsx
index f7f17344937..23e40caf939 100644
--- a/studio/pages/project/[ref]/database/functions.tsx
+++ b/studio/pages/project/[ref]/database/functions.tsx
@@ -120,13 +120,13 @@ const PageLayout: FC<any> = observer(
onClickCta={() => createFunction()}
>
<AlphaPreview />
- <Typography.Text type="secondary">
+ <p className="text-sm text-scale-1100">
PostgreSQL functions, also known as stored procedures, is a set of SQL and
procedural commands such as declarations, assignments, loops, flow-of-control, etc.
- </Typography.Text>
- <Typography.Text type="secondary">
+ </p>
+ <p className="text-sm text-scale-1100">
It's stored on the database server and can be invoked using the SQL interface.
- </Typography.Text>
+ </p>
</ProductEmptyState>
</div>
) : (
@@ -176,7 +176,7 @@ const SchemaTable: FC<SchemaTableProps> = observer(
({ schema, filterString, editFunction = () => {}, deleteFunction = () => {} }) => {
return (
<div key={schema} className="">
- <div className="z-10 sticky top-0 backdrop-filter backdrop-blur">
+ <div className="sticky top-0 backdrop-filter backdrop-blur">
<div className="flex space-x-1 items-baseline py-2 px-6">
<Typography.Title level={5} className="opacity-50">
schema
diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks/index.tsx
index be5f5ca4df0..343447c7dda 100644
--- a/studio/pages/project/[ref]/database/hooks/index.tsx
+++ b/studio/pages/project/[ref]/database/hooks/index.tsx
@@ -127,9 +127,7 @@ const TriggersList: FC<any> = observer(
return (
<>
{schemas.length === 0 ? (
- <Typography.Text className="px-6 py-4">
- Checking if hooks are enabled...
- </Typography.Text>
+ <span className="text-scale-1100 px-6 py-4">Checking if hooks are enabled...</span>
) : (
<ProductEmptyState
title="Hooks"
@@ -137,7 +135,7 @@ const TriggersList: FC<any> = observer(
onClickCta={() => enableHooks()}
>
<AlphaPreview />
- <Typography.Text type="secondary">Enable hooks on your project.</Typography.Text>
+ <span className="text-sm text-scale-1100">Enable hooks on your project.</span>
</ProductEmptyState>
)}
</>
@@ -168,14 +166,14 @@ const TriggersList: FC<any> = observer(
<div className="flex h-full w-full items-center justify-center">
<ProductEmptyState
title="Function Hooks"
- ctaButtonLabel="Create a Function Hook"
+ ctaButtonLabel="Create Function Hook"
onClickCta={() => createHook()}
>
<AlphaPreview />
- <Typography.Text type="secondary">
+ <span className="text-sm text-scale-1100">
Function Hooks can be used to trigger serverless functions or send requests to an
HTTP endpoint.
- </Typography.Text>
+ </span>
</ProductEmptyState>
</div>
) : (
@@ -225,7 +223,7 @@ const SchemaTable: FC<SchemaTableProps> = observer(
({ schema, filterString, editHook = () => {}, deleteHook = () => {} }) => {
return (
<div key={schema} className="">
- <div className="z-10 sticky top-0 backdrop-filter backdrop-blur">
+ <div className="sticky top-0 backdrop-filter backdrop-blur">
<div className="flex space-x-1 items-baseline py-2 px-6">
<Typography.Title level={5} className="opacity-50">
schema
diff --git a/studio/pages/project/[ref]/database/triggers.tsx b/studio/pages/project/[ref]/database/triggers.tsx
index 79651ffb0cc..b87181bdd3b 100644
--- a/studio/pages/project/[ref]/database/triggers.tsx
+++ b/studio/pages/project/[ref]/database/triggers.tsx
@@ -177,7 +177,7 @@ const SchemaTable: FC<SchemaTableProps> = observer(
({ filterString, schema, editTrigger, deleteTrigger }) => {
return (
<div key={schema} className="">
- <div className="z-10 sticky top-0 backdrop-filter backdrop-blur">
+ <div className="sticky top-0 backdrop-filter backdrop-blur">
<div className="flex space-x-1 items-baseline py-2 px-6">
<Typography.Title level={5} className="opacity-50">
schema