Skip to content

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

Cleanup settings markup

Terry Sutton1d82236854b8
diff --git a/studio/pages/org/[slug]/join.tsx b/studio/pages/org/[slug]/join.tsx
deleted file mode 100644
index 6d73e5c5d28..00000000000
--- a/studio/pages/org/[slug]/join.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import React from 'react'
-import { observer } from 'mobx-react-lite'
-import { useProfile, useStore, withAuth } from 'hooks'
-import { AccountLayout } from 'components/layouts'
-import { NextPageWithLayout } from 'types'
-import { toJS } from 'mobx'
-import { Button, Typography } from '@supabase/ui';
-import { useState } from 'react';
-import router, { useRouter } from 'next/router';
-import Link from 'next/link';
-import { API_URL } from 'lib/constants'
-import { get } from 'lib/common/fetch'
-import { useEffect } from 'react'
-
-const User = () => {
- const router = useRouter()
- const {email, slug, token} = router.query;
- const { app, ui } = useStore()
- const user = ui.profile
- const [isSubmitting, setIsSubmitting] = useState( false )
- // console.log( 'router', router.query )
- // console.log( 'join-a user:', toJS( user ) )
- console.log( 'ui org slug:', toJS( ui.selectedOrganization?.slug ) )
-
- //console.log('org name: ', toJS(app.organizations.data['91']))
- //console.log('org name: ', toJS(app.organizations.list()))
-
- // const organizationsLinks = app.organizations
- // .list()
- // .map((x: any) => ({
- // isActive: router.pathname.startsWith('/org/') && ui.selectedOrganization?.slug == x.slug,
- // label: x.name,
- // href: `/org/${x.slug}/settings`,
- // }))
-
-
- async function handleSubmitForm() {
- setIsSubmitting( true )
- // curl -X GET 'http://localhost:8080/platform/organizations/slug/members/join?token=XXX'
- const response = await get( `${API_URL}/organizations/${slug}/members/join?token=${token}`, {} )
- if ( response.error ) {
- ui.setNotification( {
- category: 'error',
- message: `Failed to join organization: ${response.error.message}`,
- } )
- setIsSubmitting( false )
- } else {
- setIsSubmitting( false )
- router.push( '/' )
- }
- }
-
- return (
- <div className="flex flex-col items-center justify-center w-full h-full min-h-screen px-3 place-items-center bg-secondary">
- <div className="max-w-md p-12 mx-auto mt-16 space-y-4 border-2 rounded-md ">
- <div className="space-y-4">
- <Link href="/">
- <a className="flex items-center gap-4">
- <img
- src="/img/supabase-logo.svg"
- alt="Supabase"
- className="h-[30px] block cursor-pointer rounded"
- />
- <Typography.Title level={3} className="mb-0">Supabase</Typography.Title>
-
- </a>
- </Link>
-
- <h2 className="text-xl">Join ORG NAME</h2>
- <p className="text-md">We sent an invite code to <u>{email}</u> to join this organization.</p>
- </div>
-
- {/* Check that the user in the query param matches the current logged in users email */}
- {user && user?.primary_email == email && (
- <div className='flex items-center gap-2 mt-8'>
- <Button onClick={handleSubmitForm} htmlType="submit" loading={isSubmitting} size="small">
- Join this organization
- </Button>
-
- <Button htmlType="submit" loading={isSubmitting} size="small" type="text">
- Decline
- </Button>
- </div>
- )}
-
- {user?.primary_email !== email && (
- <div className='pt-4 mt-4 border-t'>Sign to that account to accept this invitation.</div>
- )}
- </div>
- </div>
- )
-}
-
-export default withAuth( observer( User ) )
\ No newline at end of file
diff --git a/studio/pages/org/[slug]/join2.tsx b/studio/pages/org/[slug]/join2.tsx
deleted file mode 100644
index 73fa0931794..00000000000
--- a/studio/pages/org/[slug]/join2.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-
-import { AccountLayout } from 'components/layouts'
-import { NextPageWithLayout } from 'types'
-import AuthCode, { AuthCodeRef } from 'react-auth-code-input';
-import { useState } from 'react';
-import { useRef } from 'react';
-import { Button } from '@supabase/ui';
-import router, {useRouter} from 'next/router';
-import { useOrganizationDetail, useStore } from 'hooks'
-import { getAccessToken, get } from 'lib/common/fetch'
-import { API_URL } from 'lib/constants'
-import { Transition } from '@headlessui/react';
-import { useEffect } from 'react';
-
-const JoinOrg: NextPageWithLayout = () => {
- const router = useRouter();
- const slug = router.query.slug;
- console.log(router);
- return (
- <div className="mt-8 space-y-4 p-4 pt-0">
- <div className="space-y-4">
- <h2 className="text-xl">Join organization</h2>
- <p className="text-md">We sent an invite code to <u>[email protected]</u> to join this organization.</p>
- </div>
-
- <div className='mt-12'>
- <p className="text-md my-6">Enter or paste the code to join:</p>
- <div className='mb-6'>
- <InviteCodeInput />
- </div>
- </div>
- </div>
- )
-}
-
-const InviteCodeInput = () => {
- const router = useRouter();
- const slug = router.query.slug;
- const { ui } = useStore()
- const [result, setResult] = useState('');
- const [isValidInviteCode, setIsValidInviteCode] = useState( false );
- const [isInputDirty, setIsInputDirty] = useState( false );
- const [isSubmitting, setIsSubmitting] = useState( false )
- const AuthInputRef = useRef<AuthCodeRef>( null );
- const AuthInputFormRef = useRef<HTMLFormElement>( null );
-
- useEffect(() => {
- if(router.query.token) {
- console.log('yup')
- setResult(router.query.token)
- }
- })
- function handleOnChange( res: string ) {
- res.length < 15 ? setIsValidInviteCode(false) : setIsValidInviteCode(true)
- res.length > 0 ? setIsInputDirty(true) : setIsInputDirty(false)
- setResult( res );
- };
-
- async function handleSubmitForm( e: any ) {
- //const access_token = getAccessToken()
- e.preventDefault();
- setIsSubmitting( true )
-
- // Need proper endpoint
- const response = await get( `${API_URL}/organizations/${slug}/join?token=${result}`, {} )
- if ( response.error ) {
- ui.setNotification( {
- category: 'error',
- message: `Failed to join organization: ${response.error.message}`,
- } )
- setIsSubmitting( false )
- } else {
- setIsSubmitting( false )
- // router.push( '/' )
- }
- }
-
-
-
- return (
- <form onSubmit={handleSubmitForm} ref={AuthInputFormRef}>
- <div>
- {/* <AuthCode
- ref={AuthInputRef}
- allowedCharacters='alphanumeric'
- onChange={handleOnChange}
- length={15}
- autoFocus={true}
- containerClassName="join-auth-code-container flex items-center max-w-full"
- inputClassName="w-[34px]"
- /> */}
-
- <div className='flex items-center gap-2 mt-8'>
- <Button disabled={!isValidInviteCode} htmlType="submit" loading={isSubmitting} size="small">
- Join this organization
- </Button>
-
- <Button htmlType="submit" loading={isSubmitting} size="small" type="text">
- Decline
- </Button>
-
- <Transition
- show={isInputDirty}
- enter="transition ease-out duration-500"
- enterFrom="transform opacity-0 -translate-x-10"
- enterTo="transform opacity-100 translate-x-0"
- >
- <Button
- htmlType="reset"
- type='text'
- size="small"
- onClick={() => AuthInputRef.current?.clear()}
- >
- Clear
- </Button>
- </Transition>
-
- </div>
- </div>
- </form>
- );
-}
-
-JoinOrg.getLayout = ( page ) => (
- <AccountLayout
- title="Join Org"
- breadcrumbs={[
- {
- key: `join-org`,
- label: 'Join Org',
- },
- ]}
- >
- {page}
- </AccountLayout>
-)
-
-export default JoinOrg
diff --git a/studio/pages/org/[slug]/settings.tsx b/studio/pages/org/[slug]/settings.tsx
index 79ea98c651d..9e3409663e1 100644
--- a/studio/pages/org/[slug]/settings.tsx
+++ b/studio/pages/org/[slug]/settings.tsx
@@ -169,6 +169,7 @@ const TabsView = observer(() => {
const [selectedTab, setSelectedTab] = useState('GENERAL')
const organization = ui.selectedOrganization
+ console.log(toJS(organization))
const projects = app.projects.list((x: Project) => x.organization_id == organization?.id)
// useEffect(() => {
@@ -268,7 +269,7 @@ const GeneralSettings = observer(() => {
}
return (
- <article className="container my-4 max-w-4xl space-y-8">
+ <article className="container max-w-4xl my-4 space-y-8">
<SchemaFormPanel
title="General"
schema={pluckJsonSchemaFields(organizations, BASIC_FIELDS)}
@@ -352,8 +353,8 @@ const OrgDeleteModal = observer(() => {
onCancel={toggle}
header={
<div className="flex items-baseline gap-2">
- <h5 className="text-scale-1200 text-sm">Delete organisation</h5>
- <span className="text-scale-900 text-xs">Are you sure?</span>
+ <h5 className="text-sm text-scale-1200">Delete organisation</h5>
+ <span className="text-xs text-scale-900">Are you sure?</span>
</div>
}
size="small"
@@ -392,9 +393,9 @@ const OrgDeleteModal = observer(() => {
}}
>
{({ isSubmitting }: { isSubmitting: boolean }) => (
- <div className="space-y-4 py-3">
+ <div className="py-3 space-y-4">
<Modal.Content>
- <p className="text-scale-900 text-sm">
+ <p className="text-sm text-scale-900">
This action <span className="text-scale-1200">cannot</span> be undone. This will
permanently delete the <span className="text-scale-1200">{orgName}</span>{' '}
organization and remove all of its projects.
@@ -467,7 +468,7 @@ const TeamSettings = observer(() => {
return (
<>
- <div className="container my-4 max-w-4xl space-y-8">
+ <div className="container max-w-4xl my-4 space-y-8">
<div className="flex justify-between">
<MembersFilterInput />
{PageState.isOrgOwner ? (
@@ -487,7 +488,7 @@ const TeamSettings = observer(() => {
)}
</div>
</div>
- <div className="container my-4 max-w-4xl space-y-8">
+ <div className="container max-w-4xl my-4 space-y-8">
<MembersView />
</div>
</>
@@ -535,11 +536,11 @@ const MembersView = observer(() => {
<div className="flex items-center space-x-4">
<div>
{x.invited_id ?
- ( <span className='border-border-secondary-light dark:border-border-secondary-dark flex rounded-full border-2 p-2'><IconUser size={18} strokeWidth={2} /></span> )
+ ( <span className='flex p-2 border-2 rounded-full border-border-secondary-light dark:border-border-secondary-dark'><IconUser size={18} strokeWidth={2} /></span> )
: ( <img
src={`https://github.com/${x.profile?.username}.png?size=80`}
width="40"
- className="border-border-secondary-light dark:border-border-secondary-dark rounded-full border"
+ className="border rounded-full border-border-secondary-light dark:border-border-secondary-dark"
/>
)}