diff --git a/frontend/app/[team]/apps/[app]/settings/page.tsx b/frontend/app/[team]/apps/[app]/settings/page.tsx index 1bf04bb04..80bf72cdc 100644 --- a/frontend/app/[team]/apps/[app]/settings/page.tsx +++ b/frontend/app/[team]/apps/[app]/settings/page.tsx @@ -7,6 +7,7 @@ import { AppType } from '@/apollo/graphql' import { useContext, useEffect } from 'react' import DeleteAppDialog from '@/components/apps/DeleteAppDialog' import { organisationContext } from '@/contexts/organisationContext' +import { FaCube } from 'react-icons/fa' export default function AppSettings({ params }: { params: { team: string; app: string } }) { const { activeOrganisation: organisation } = useContext(organisationContext) @@ -26,30 +27,53 @@ export default function AppSettings({ params }: { params: { team: string; app: s const app = data?.apps[0] as AppType + const readableDate = + app && + `${new Date(app.createdAt).toDateString()}, ${new Date(app.createdAt).toLocaleTimeString()}` + return ( -
+
+

Settings

{app && ( -
- - created - - {app.createdAt} +
+
+

App

+

App name and information

+
+
+ +
+ {app.name} + +
+
Created
+ {readableDate} +
+ {app.id} +
+
)} -
-
-

Delete app

-

Permanently delete this app

+
+
+

Danger Zone

+

These actions may result in permanent loss of data

+
+
+

Delete App

+

Permanently delete this App

+
- {organisation && app && ( - - )} + {organisation && app && ( + + )} +
) diff --git a/frontend/app/[team]/apps/page.tsx b/frontend/app/[team]/apps/page.tsx index 82c966792..b51fd9ec8 100644 --- a/frontend/app/[team]/apps/page.tsx +++ b/frontend/app/[team]/apps/page.tsx @@ -47,19 +47,8 @@ export default function AppsHome({ params }: { params: { team: string } }) { ))} {organisation && apps && ( -
-
- - -
- } - buttonVariant="text" - organisation={organisation} - appCount={apps.length} - /> -
+
+
)}
diff --git a/frontend/app/globals.css b/frontend/app/globals.css index 8371afa03..22a718230 100644 --- a/frontend/app/globals.css +++ b/frontend/app/globals.css @@ -40,7 +40,7 @@ --card-rgb: 180, 185, 188; --card-border-rgb: 131, 134, 135; - --toastify-color-success: rgb(16 185 129)!important; + --toastify-color-success: rgb(16 185 129) !important; } @media (prefers-color-scheme: dark) { @@ -89,6 +89,11 @@ body { max-width: 100vw; overflow-x: hidden; } + +::-ms-reveal { + display: none; +} + /* body { color: rgb(var(--foreground-rgb)); @@ -113,7 +118,7 @@ a { @layer components { input { - @apply p-2 focus:outline-none + @apply p-2 focus:outline-none; } input:not(.custom) { diff --git a/frontend/components/apps/DeleteAppDialog.tsx b/frontend/components/apps/DeleteAppDialog.tsx index e6c6c5b76..564218260 100644 --- a/frontend/components/apps/DeleteAppDialog.tsx +++ b/frontend/components/apps/DeleteAppDialog.tsx @@ -83,7 +83,7 @@ export default function DeleteAppDialog(props: { return ( <>
-
@@ -163,10 +163,15 @@ export default function DeleteAppDialog(props: {
- -
diff --git a/frontend/components/apps/NewAppDialog.tsx b/frontend/components/apps/NewAppDialog.tsx index 649afe62d..a55c2a509 100644 --- a/frontend/components/apps/NewAppDialog.tsx +++ b/frontend/components/apps/NewAppDialog.tsx @@ -3,7 +3,7 @@ import { copyToClipBoard } from '@/utils/clipboard' import { Dialog, Switch, Transition } from '@headlessui/react' import { useSession } from 'next-auth/react' import { Fragment, ReactNode, useContext, useEffect, useState } from 'react' -import { FaCopy, FaExclamationTriangle, FaEye, FaEyeSlash, FaTimes } from 'react-icons/fa' +import { FaCopy, FaExclamationTriangle, FaEye, FaEyeSlash, FaPlus, FaTimes } from 'react-icons/fa' import { toast } from 'react-toastify' import { Button } from '../common/Button' import { GetApps } from '@/graphql/queries/getApps.gql' @@ -37,12 +37,7 @@ import { const FREE_APP_LIMIT = 3 const PRO_APP_LIMIT = 10 -export default function NewAppDialog(props: { - appCount: number - organisation: OrganisationType - buttonLabel?: ReactNode - buttonVariant?: string -}) { +export default function NewAppDialog(props: { appCount: number; organisation: OrganisationType }) { const { organisation, appCount } = props const [isOpen, setIsOpen] = useState(false) const [name, setName] = useState('') @@ -51,6 +46,8 @@ export default function NewAppDialog(props: { const [appId, setAppId] = useState('') const [createStarters, setCreateStarters] = useState(appCount === 0) const [appSecret, setAppSecret] = useState('') + const [appCreating, setAppCreating] = useState(false) + const { data: session } = useSession() const [createApp] = useMutation(CreateApplication) @@ -62,11 +59,6 @@ export default function NewAppDialog(props: { const IS_CLOUD_HOSTED = process.env.APP_HOST || process.env.NEXT_PUBLIC_APP_HOST - const DEFAULT_BUTTON = { - label: 'Create an app', - variant: 'primary', - } - const { keyring, setKeyring } = useContext(KeyringContext) useEffect(() => { @@ -89,19 +81,16 @@ export default function NewAppDialog(props: { } const closeModal = () => { - reset() - setIsOpen(false) + if (!appCreating) { + reset() + setIsOpen(false) + } } const openModal = () => { setIsOpen(true) } - const handleCopy = (val: string) => { - copyToClipBoard(val) - toast.info('Copied') - } - const validateKeyring = async (password: string) => { return new Promise(async (resolve, reject) => { if (keyring) resolve(keyring) @@ -332,6 +321,7 @@ export default function NewAppDialog(props: { const handleCreateApp = async () => { const APP_VERSION = 1 + setAppCreating(true) return new Promise(async (resolve, reject) => { setTimeout(async () => { @@ -380,10 +370,11 @@ export default function NewAppDialog(props: { setAppSecret(`pss:v${APP_VERSION}:${appToken}:${appKeyShares[0]}:${wrapKey}`) setAppId(`phApp:v${APP_VERSION}:${appKeys.publicKey}`) - + setAppCreating(false) resolve(true) closeModal() } catch (error) { + setAppCreating(false) reject(error) } }, 500) @@ -392,10 +383,11 @@ export default function NewAppDialog(props: { const handleSubmit = async (event: { preventDefault: () => void }) => { event.preventDefault() + toast.promise(handleCreateApp, { pending: 'Setting up your app', success: 'App created!', - error: 'Something went wrong! Please check your sudo password and try again.', + error: 'Something went wrong!', }) } @@ -424,14 +416,15 @@ export default function NewAppDialog(props: { return ( <> -
- +
+
+ + Create an App +
@@ -473,8 +466,8 @@ export default function NewAppDialog(props: {

- Create a new app by entering an app name below. A new set of encryption - keys will be created to secure your app. + Create a new App by entering an App name below. Your App will be + initialized with 3 new environments.

)} - {complete() && ( -
-
-
- app name -
- {name} -
- -
-
- app id - -
- {appId} -
- -
-
- - app secret - -
-
- -
- {"Copy this value. You won't see it again!"} -
-
- - -
-
- {appSecret} -
-
- )}