Skip to content

Commit

Permalink
Merge master into hflatval/update-release-instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
cognite-bulldozer[bot] authored Jun 24, 2024
2 parents 74738fd + ac73823 commit 60aaf5c
Show file tree
Hide file tree
Showing 26 changed files with 909 additions and 732 deletions.
2 changes: 1 addition & 1 deletion documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"typedoc": "0.25.13",
"typedoc-plugin-markdown": "3.17.1",
"typedoc-plugin-no-inherit": "1.4.0",
"typescript": "5.4.5"
"typescript": "5.5.2"
},
"browserslist": {
"production": [
Expand Down
48 changes: 24 additions & 24 deletions documentation/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions examples/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"@storybook/blocks": "^8.0.9",
"@storybook/react": "^8.0.9",
"@storybook/react-vite": "^8.0.9",
"@storybook/test": "8.1.9",
"@storybook/test": "8.1.10",
"@tanstack/react-query-devtools": "^5.32.0",
"@testing-library/react": "^15.0.5",
"@testing-library/react": "^16.0.0",
"@types/lodash": "^4.17.0",
"@types/node": "^20.12.7",
"@types/react": "^18.3.1",
Expand Down
34 changes: 25 additions & 9 deletions react-components/src/components/Architecture/CommandButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ export const CommandButtons = ({
return (
<>
{commands.map(
(command, index): ReactElement => addCommandButton(command, isHorizontal, index)
(command, index): ReactElement => (
<CommandButtonWrapper
command={command}
isHorizontal={isHorizontal}
key={getKey(command, index)}
/>
)
)}
</>
);
Expand Down Expand Up @@ -60,7 +66,7 @@ export const CommandButton = ({
return () => {
newCommand.removeEventListener(update);
};
}, [newCommand]);
}, [newCommand.isEnabled, newCommand.isChecked, newCommand.isVisible]);

if (!isVisible) {
return <></>;
Expand Down Expand Up @@ -106,14 +112,24 @@ function getDefaultCommand(newCommand: BaseCommand, renderTarget: RevealRenderTa
return newCommand;
}

function addCommandButton(
command: BaseCommand | undefined,
isHorizontal: boolean,
index: number
): ReactElement {
function getKey(command: BaseCommand | undefined, index: number): number {
if (command === undefined) {
return -index;
}

return command.uniqueId;
}

function CommandButtonWrapper({
command,
isHorizontal
}: {
command: BaseCommand | undefined;
isHorizontal: boolean;
}): ReactElement {
if (command === undefined) {
const direction = !isHorizontal ? 'horizontal' : 'vertical';
return <Divider key={index} weight="2px" length="24px" direction={direction} />;
return <Divider weight="2px" length="24px" direction={direction} />;
}
return <CommandButton key={command.uniqueId} command={command} isHorizontal={isHorizontal} />;
return <CommandButton command={command} isHorizontal={isHorizontal} />;
}
Loading

0 comments on commit 60aaf5c

Please sign in to comment.