feat(dashboard): ♿️ Hide create buttons for guests
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { DashboardFolder } from 'db'
|
import { DashboardFolder, WorkspaceRole } from 'db'
|
||||||
import {
|
import {
|
||||||
Flex,
|
Flex,
|
||||||
Heading,
|
Heading,
|
||||||
@ -34,7 +34,7 @@ const dragDistanceTolerance = 20
|
|||||||
|
|
||||||
export const FolderContent = ({ folder }: Props) => {
|
export const FolderContent = ({ folder }: Props) => {
|
||||||
const { user } = useUser()
|
const { user } = useUser()
|
||||||
const { workspace } = useWorkspace()
|
const { workspace, currentRole } = useWorkspace()
|
||||||
const [isCreatingFolder, setIsCreatingFolder] = useState(false)
|
const [isCreatingFolder, setIsCreatingFolder] = useState(false)
|
||||||
const {
|
const {
|
||||||
setDraggedTypebot,
|
setDraggedTypebot,
|
||||||
@ -170,17 +170,21 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
<Stack>
|
<Stack>
|
||||||
<HStack>
|
<HStack>
|
||||||
{folder && <BackButton id={folder.parentFolderId} />}
|
{folder && <BackButton id={folder.parentFolderId} />}
|
||||||
|
{currentRole !== WorkspaceRole.GUEST && (
|
||||||
<CreateFolderButton
|
<CreateFolderButton
|
||||||
onClick={handleCreateFolder}
|
onClick={handleCreateFolder}
|
||||||
isLoading={isCreatingFolder || isFolderLoading}
|
isLoading={isCreatingFolder || isFolderLoading}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</HStack>
|
</HStack>
|
||||||
<Wrap spacing={4}>
|
<Wrap spacing={4}>
|
||||||
|
{currentRole !== WorkspaceRole.GUEST && (
|
||||||
<CreateBotButton
|
<CreateBotButton
|
||||||
folderId={folder?.id}
|
folderId={folder?.id}
|
||||||
isLoading={isTypebotLoading}
|
isLoading={isTypebotLoading}
|
||||||
isFirstBot={typebots?.length === 0 && folder === null}
|
isFirstBot={typebots?.length === 0 && folder === null}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
{isFolderLoading && <ButtonSkeleton />}
|
{isFolderLoading && <ButtonSkeleton />}
|
||||||
{folders &&
|
{folders &&
|
||||||
folders.map((folder) => (
|
folders.map((folder) => (
|
||||||
|
Reference in New Issue
Block a user