import { Stack, FormControl, FormLabel, Flex, Button, useDisclosure, Text, } from '@chakra-ui/react' import { ConfirmModal } from 'components/modals/ConfirmModal' import { EditableEmojiOrImageIcon } from 'components/shared/EditableEmojiOrImageIcon' import { Input } from 'components/shared/Textbox' import { useWorkspace } from 'contexts/WorkspaceContext' import React from 'react' export const WorkspaceSettingsForm = ({ onClose }: { onClose: () => void }) => { const { workspace, workspaces, updateWorkspace, deleteCurrentWorkspace } = useWorkspace() const handleNameChange = (name: string) => { if (!workspace?.id) return updateWorkspace(workspace?.id, { name }) } const handleChangeIcon = (icon: string) => { if (!workspace?.id) return updateWorkspace(workspace?.id, { icon }) } const handleDeleteClick = async () => { await deleteCurrentWorkspace() onClose() } return ( Icon {workspace && ( )} Name {workspace && ( )} {workspace && workspaces && workspaces.length > 1 && ( )} ) } const DeleteWorkspaceButton = ({ workspaceName, onConfirm, }: { workspaceName: string onConfirm: () => Promise }) => { const { isOpen, onOpen, onClose } = useDisclosure() return ( <> Are you sure you want to delete {workspaceName} workspace? All its folders, typebots and results will be deleted forever.' } confirmButtonLabel="Delete" /> ) }