import React, { useState, useMemo } from 'react'; import { Link, useOutletContext, useParams } from 'react-router-dom'; import { useForm, Controller } from 'react-hook-form'; import toast from 'react-hot-toast'; import { Button, Typography, Input, Select, Option, } from '@material-tailwind/react'; import DeleteProjectDialog from './DeleteProjectDialog'; import ConfirmDialog from '../../../shared/ConfirmDialog'; import { ProjectSearchOutletContext } from '../../../../types/project'; const TEAMS = ['Airfoil']; const DEFAULT_SELECT_TEAM = undefined; const CopyIcon = ({ value }: { value: string }) => { return ( { navigator.clipboard.writeText(value); toast.success('Project ID copied'); }} className="cursor-pointer" > ^ ); }; const GeneralTabPanel = () => { const { id } = useParams(); const { projects } = useOutletContext(); const currentProject = useMemo(() => { return projects.find((project: any) => project.id === id); }, [id]); const { handleSubmit: handleTransfer, control, formState, } = useForm({ defaultValues: { team: DEFAULT_SELECT_TEAM, }, }); const [openTransferDialog, setOpenTransferDialog] = useState(false); const handleTransferProjectDialog = () => setOpenTransferDialog(!openTransferDialog); const [openDeleteDialog, setOpenDeleteDialog] = useState(false); const handleDeleteProjectDialog = () => setOpenDeleteDialog(!openDeleteDialog); const { handleSubmit, register } = useForm({ defaultValues: { appName: currentProject?.name, description: currentProject?.description, }, }); return ( <> {currentProject && ( <>
{})}> Project info App name Description (Optional) Project ID } />
Transfer project Transfer this app to your personal account or a team you are a member of. Learn more
{ handleTransferProjectDialog(); })} > Choose team ( )} /> Upon confirmation, your project nextjs-boilerplate will be transferred from saugat to Airfoil.
Delete project The project will be permanently deleted, including its deployments and domains. This action is irreversible and can not be undone.
)} ); }; export default GeneralTabPanel;