Skip to content

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

Feature flag roles helper modal

Joshen Lim5f0e4a04d3e9
diff --git a/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx
index f7aa3c7ddb3..094c92d7c0a 100644
--- a/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx
+++ b/studio/components/interfaces/Organization/TeamSettings/RolesHelperModal/RolesHelperModal.tsx
@@ -1,11 +1,23 @@
import { FC, Fragment, useState } from 'react'
import { IconCheck, IconHelpCircle, Modal } from '@supabase/ui'
+import { useFlag } from 'hooks'
import { PERMISSIONS_MAPPING } from './RolesHelperModal.constants'
interface Props {}
const RolesHelperModal: FC<Props> = ({}) => {
const [showModal, setShowModal] = useState(false)
+ const enableBillingOnlyReadOnlyRoles = useFlag('enableBillingOnlyReadOnlyRoles')
+
+ const permissionColumnClassName = [
+ `${enableBillingOnlyReadOnlyRoles ? 'w-[40%]' : 'w-[49%]'}`,
+ 'text-sm pl-4 font-bold',
+ ].join(' ')
+ const roleColumnClassName = [
+ `${enableBillingOnlyReadOnlyRoles ? 'w-[12%]' : 'w-[17%]'}`,
+ 'text-sm h-8 flex items-center justify-center border-l border-scale-600 font-bold',
+ ].join(' ')
+
return (
<>
<IconHelpCircle
@@ -18,7 +30,7 @@ const RolesHelperModal: FC<Props> = ({}) => {
closable
hideFooter
visible={showModal}
- size="xxlarge"
+ size={enableBillingOnlyReadOnlyRoles ? 'xxlarge' : 'xlarge'}
header="Permissions for each role"
onCancel={() => setShowModal(!showModal)}
>
@@ -32,22 +44,16 @@ const RolesHelperModal: FC<Props> = ({}) => {
<Modal.Content>
<div className="bg-scale-400 border border-scale-500 rounded">
<div className="flex items-center border-b border-scale-600">
- <div className="text-sm w-[40%] pl-4 font-bold">Permissions</div>
- <div className="text-sm w-[12%] h-8 flex items-center justify-center border-l border-scale-600 font-bold">
- Owner
- </div>
- <div className="text-sm w-[12%] h-8 flex items-center justify-center border-l border-scale-600 font-bold">
- Adminstrator
- </div>
- <div className="text-sm w-[12%] h-8 flex items-center justify-center border-l border-scale-600 font-bold">
- Developer
- </div>
- <div className="text-sm w-[12%] h-8 flex items-center justify-center border-l border-scale-600 font-bold">
- Read-only
- </div>
- <div className="text-sm w-[12%] h-8 flex items-center justify-center border-l border-scale-600 font-bold">
- Billing-only
- </div>
+ <div className={permissionColumnClassName}>Permissions</div>
+ <div className={roleColumnClassName}>Owner</div>
+ <div className={roleColumnClassName}>Adminstrator</div>
+ <div className={roleColumnClassName}>Developer</div>
+ {enableBillingOnlyReadOnlyRoles && (
+ <div className={roleColumnClassName}>Read-only</div>
+ )}
+ {enableBillingOnlyReadOnlyRoles && (
+ <div className={roleColumnClassName}>Billing-only</div>
+ )}
</div>
<div className="max-h-[425px] overflow-y-auto">
@@ -61,49 +67,30 @@ const RolesHelperModal: FC<Props> = ({}) => {
key={`${group.title}-${idx}`}
className="bg-scale-500 flex items-center border-b border-scale-600 last:border-none"
>
- <div className="text-sm w-[40%] pl-4">{action.description}</div>
- <div
- className={[
- 'h-8 text-center border-l border-scale-600',
- 'text-sm w-[12%] flex items-center justify-center',
- ].join(' ')}
- >
+ <div className={permissionColumnClassName}>{action.description}</div>
+ <div className={roleColumnClassName}>
{action.permissions.owner && <IconCheck size={14} strokeWidth={2} />}
</div>
- <div
- className={[
- 'h-8 text-center border-l border-scale-600',
- 'text-sm w-[12%] flex items-center justify-center',
- ].join(' ')}
- >
+ <div className={roleColumnClassName}>
{action.permissions.admin && <IconCheck size={14} strokeWidth={2} />}
</div>
- <div
- className={[
- 'h-8 text-center border-l border-scale-600',
- 'text-sm w-[12%] flex items-center justify-center',
- ].join(' ')}
- >
+ <div className={roleColumnClassName}>
{action.permissions.developer && <IconCheck size={14} strokeWidth={2} />}
</div>
- <div
- className={[
- 'h-8 text-center border-l border-scale-600',
- 'text-sm w-[12%] flex items-center justify-center',
- ].join(' ')}
- >
- {action.permissions.read_only && <IconCheck size={14} strokeWidth={2} />}
- </div>
- <div
- className={[
- 'h-8 text-center border-l border-scale-600',
- 'text-sm w-[12%] flex items-center justify-center',
- ].join(' ')}
- >
- {action.permissions.billing_only && (
- <IconCheck size={14} strokeWidth={2} />
- )}
- </div>
+ {enableBillingOnlyReadOnlyRoles && (
+ <div className={roleColumnClassName}>
+ {action.permissions.read_only && (
+ <IconCheck size={14} strokeWidth={2} />
+ )}
+ </div>
+ )}
+ {enableBillingOnlyReadOnlyRoles && (
+ <div className={roleColumnClassName}>
+ {action.permissions.billing_only && (
+ <IconCheck size={14} strokeWidth={2} />
+ )}
+ </div>
+ )}
</div>
))}
</Fragment>