mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
Made tool expanding on isWide nicer
This commit is contained in:
@@ -78,7 +78,6 @@ export function ToolInput({ blockId, subBlockId }: ToolInputProps) {
|
||||
}
|
||||
|
||||
const toolId = getToolIdFromBlock(toolBlock.type)
|
||||
|
||||
const newTool: StoredTool = {
|
||||
type: toolBlock.type,
|
||||
title: toolBlock.toolbar.title,
|
||||
@@ -86,7 +85,21 @@ export function ToolInput({ blockId, subBlockId }: ToolInputProps) {
|
||||
isExpanded: true,
|
||||
}
|
||||
|
||||
setValue([...selectedTools.map((tool) => ({ ...tool, isExpanded: false })), newTool])
|
||||
// If isWide, keep tools in the same row expanded
|
||||
if (isWide) {
|
||||
setValue([
|
||||
...selectedTools.map((tool, index) => ({
|
||||
...tool,
|
||||
// Keep expanded if it's in the same row as the new tool
|
||||
isExpanded: Math.floor(selectedTools.length / 2) === Math.floor(index / 2),
|
||||
})),
|
||||
newTool,
|
||||
])
|
||||
} else {
|
||||
// Original behavior for non-wide mode
|
||||
setValue([...selectedTools.map((tool) => ({ ...tool, isExpanded: false })), newTool])
|
||||
}
|
||||
|
||||
setOpen(false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user