Skip to content

Commit

Permalink
fix: refresh brick info
Browse files Browse the repository at this point in the history
  • Loading branch information
weareoutman committed Oct 10, 2023
1 parent ff5c436 commit daf9eea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/panel/components/PropView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function PropView(): React.ReactElement {
<PropList
list={brickInfo[key]}
overrideProps={overrideProps}
editable={key !== "events"}
editable={key !== "events" && key !== "tplState"}
/>
</div>
</React.Fragment>
Expand Down
9 changes: 8 additions & 1 deletion src/panel/components/SelectedBrickToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useSelectedBrickContext } from "../libs/SelectedBrickContext";
import { useEvalOptions } from "../libs/useEvalOptions";

export function SelectedBrickToolbar(): React.ReactElement {
const { selectedBrick } = useSelectedBrickContext();
const { selectedBrick, setSelectedBrick } = useSelectedBrickContext();
const evalOptions = useEvalOptions();

const handleInspectElement = React.useCallback((): void => {
Expand All @@ -23,6 +23,10 @@ export function SelectedBrickToolbar(): React.ReactElement {
);
}, [evalOptions, selectedBrick]);

const handleRefreshBrickInfo = React.useCallback(() => {
setSelectedBrick({ ...selectedBrick });
}, [selectedBrick, setSelectedBrick]);

return (
<div className="selected-brick-toolbar">
{selectedBrick && (
Expand All @@ -36,6 +40,9 @@ export function SelectedBrickToolbar(): React.ReactElement {
{selectedBrick.tagName}
</span>
<ButtonGroup>
<Tooltip content="Refresh brick info" hoverOpenDelay={300}>
<Button icon="refresh" minimal onClick={handleRefreshBrickInfo} />
</Tooltip>
<Tooltip content="Inspect the brick element" hoverOpenDelay={300}>
<Button icon="eye-open" minimal onClick={handleInspectElement} />
</Tooltip>
Expand Down

0 comments on commit daf9eea

Please sign in to comment.