Skip to content

Commit

Permalink
feat(dashboard): ♿️ Hide create buttons for guests
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jun 18, 2022
1 parent 5ef89f7 commit 4e62175
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions apps/builder/components/dashboard/FolderContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DashboardFolder } from 'db'
import { DashboardFolder, WorkspaceRole } from 'db'
import {
Flex,
Heading,
Expand Down Expand Up @@ -34,7 +34,7 @@ const dragDistanceTolerance = 20

export const FolderContent = ({ folder }: Props) => {
const { user } = useUser()
const { workspace } = useWorkspace()
const { workspace, currentRole } = useWorkspace()
const [isCreatingFolder, setIsCreatingFolder] = useState(false)
const {
setDraggedTypebot,
Expand Down Expand Up @@ -170,17 +170,21 @@ export const FolderContent = ({ folder }: Props) => {
<Stack>
<HStack>
{folder && <BackButton id={folder.parentFolderId} />}
<CreateFolderButton
onClick={handleCreateFolder}
isLoading={isCreatingFolder || isFolderLoading}
/>
{currentRole !== WorkspaceRole.GUEST && (
<CreateFolderButton
onClick={handleCreateFolder}
isLoading={isCreatingFolder || isFolderLoading}
/>
)}
</HStack>
<Wrap spacing={4}>
<CreateBotButton
folderId={folder?.id}
isLoading={isTypebotLoading}
isFirstBot={typebots?.length === 0 && folder === null}
/>
{currentRole !== WorkspaceRole.GUEST && (
<CreateBotButton
folderId={folder?.id}
isLoading={isTypebotLoading}
isFirstBot={typebots?.length === 0 && folder === null}
/>
)}
{isFolderLoading && <ButtonSkeleton />}
{folders &&
folders.map((folder) => (
Expand Down

0 comments on commit 4e62175

Please sign in to comment.