Skip to content

Commit

Permalink
removing toolboxPreview flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopezalvas committed Dec 2, 2024
1 parent 4ba68c6 commit e02cf15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ import { useThemeContext } from "../../../../../theme/ThemeContext";

export const ToolBoxEditor = () => {

const shouldShow = process.env.NODE_ENV !== 'production'

const [contentHeight,] = useState(window.innerHeight*0.7)
const [contentHeight,] = useState(window.innerHeight * 0.7)

const { t } = useTranslation('creator');
const { isSmallScreen } = useThemeContext()
Expand Down Expand Up @@ -63,17 +61,15 @@ export const ToolBoxEditor = () => {
onCancel={handleOnCancel}
title={`${t('toolbox.title')}${t(`selection.cards.${challenge.scene.type}.name`)}`}
noScrollable={true}
dialogProps={{ maxWidth: "md"}}>
dialogProps={{ maxWidth: "md" }}>
<Stack direction="row">
<PBCard sx={{display:"flex", maxWidth: isSmallScreen ? '50%' : 'inherit', flexDirection:"column", padding:"5px", maxHeight:`${contentHeight}px`}}>
<CategorizedToggle toolboxState={toolboxState} isCategorized={isCategorized} setIsCategorized={setIsCategorized}/>
<BlocksSelector toolboxState={toolboxState} setToolBoxItems={setToolBoxItems} toolBoxItems={toolBoxItems} availableBlocks={availableBlocksFor(challenge!.scene.type)}/>
<PBCard sx={{ display: "flex", maxWidth: isSmallScreen ? '50%' : 'inherit', flexDirection: "column", padding: "5px", maxHeight: `${contentHeight}px` }}>
<CategorizedToggle toolboxState={toolboxState} isCategorized={isCategorized} setIsCategorized={setIsCategorized} />
<BlocksSelector toolboxState={toolboxState} setToolBoxItems={setToolBoxItems} toolBoxItems={toolBoxItems} availableBlocks={availableBlocksFor(challenge!.scene.type)} />
</PBCard>
{shouldShow ? <ToolboxPreview
<ToolboxPreview
blockIds={toolBoxItems}
categorized={isCategorized || toolboxState.categorizationShouldBeForced()}/>
:<></>
}
categorized={isCategorized || toolboxState.categorizationShouldBeForced()} />
</Stack>
</GenericModalDialog>
</>
Expand Down Expand Up @@ -108,7 +104,7 @@ export class ToolboxState {
return this.categories.find(category => category.id === categoryId)!.isSelected()
}

categorizationShouldBeForced() {
categorizationShouldBeForced() {
return this.isCategorySelected(PROCEDURE_CATEGORY) //If this category is selected, the categorization should always be enabled
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ToolboxPreview = ({ categorized, blockIds }: ToolboxPreviewProps) =
} : {} // used only in toolboxpreview to show blocks under the categories

return <PBBlocklyWorkspace
sx={{ minWidth: isSmallScreen ? "auto" : "50%", padding: "5px", display: "flex", flexDirection: "column", ...sx }}
sx={{ minWidth: isSmallScreen ? "auto" : "58%", padding: "5px", display: "flex", flexDirection: "column", ...sx }}
title
blockIds={blockIds}
categorized={categorized}
Expand Down

0 comments on commit e02cf15

Please sign in to comment.