Skip to content

Commit

Permalink
bring plugin component to front when either tab is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
bacalj committed Aug 15, 2024
1 parent 91564c2 commit 9522b37
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { clsx } from "clsx";
import { ILocation } from "../types";
import { debounce } from "../grasp-seasons/utils/utils";
import { kInitialDimensions, kVersion, kPluginName, kDefaultOnAttributes, kSimulationTabDimensions, kDataContextName } from "../constants";
import { initializePlugin, codapInterface, addDataContextChangeListener, ClientNotification } from "@concord-consortium/codap-plugin-api";
import { initializePlugin, codapInterface, selectSelf, addDataContextChangeListener, ClientNotification } from "@concord-consortium/codap-plugin-api";
import { useCodapData } from "../hooks/useCodapData";
import { LocationTab } from "./location-tab";
import { SimulationTab } from "./simulation-tab";
Expand Down Expand Up @@ -96,6 +96,11 @@ export const App: React.FC = () => {
values: {
dimensions: tab === "location" ? kInitialDimensions : kSimulationTabDimensions
}
}).then(() => {
// After updating dimensions, call selectSelf to bring the plugin to the front
selectSelf();
}).catch((error) => {
console.error("Error updating dimensions or selecting self:", error);
});
};

Expand Down

0 comments on commit 9522b37

Please sign in to comment.