Conversation
manas-qm
left a comment
There was a problem hiding this comment.
There are some important things that must be done the right way, so please check the comments and implement changes acording to comments.
| gap: 8px; | ||
| padding: 4px; | ||
| display: inline-flex; | ||
| border: 1px solid #444; |
There was a problem hiding this comment.
Add #444 color to the index.scss first!
| left: 0; | ||
| width: 100%; | ||
| height: 100%; | ||
| background-color: #2ccbe599; |
| {!toggleSwitch && <h1 style={{ paddingTop: "10px", paddingBottom: "5px" }}>{title}</h1>} | ||
| {toggleSwitch && <ToggleSwitch title={title} activeTab={activeTab} setActiveTab={setActiveTab} />} | ||
| {toggleSwitch && ( | ||
| <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", paddingTop: "10px", paddingBottom: "5px" }}> |
There was a problem hiding this comment.
Please remove inline styles!
There was a problem hiding this comment.
done
But looking at the rest of JSONEditor.tsx; inline styles are used everywhere. At some point we should refactor all of these into JSONEditor.module.scss (which btw wasn't even imported)
| {toggleSwitch && <ToggleSwitch title={title} activeTab={activeTab} setActiveTab={setActiveTab} />} | ||
| {toggleSwitch && ( | ||
| <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", paddingTop: "10px", paddingBottom: "5px" }}> | ||
| <h1 style={{ margin: 0 }}>{title}</h1> |
There was a problem hiding this comment.
done - refer to comment above
| | undefined | ||
| >(undefined); | ||
| const [selectedPageName, setSelectedPageName] = useState<ModuleKey | null>(null); | ||
| const [graphTab, setGraphTab] = useState<string>("run"); |
There was a problem hiding this comment.
We won't use this! It's not needed. We can use selectedPageName instead! So please remove graphTab and setGraphTab since FlexLayoutContext is global context wrapper so this is not a place to add some values that are needed for some specfic cases.
| path?: string; | ||
| dataCy?: string; | ||
| }; | ||
| hidden?: boolean; |
There was a problem hiding this comment.
This isn't a good aproach. This page should have two tabs, not two separate pages where one of it is hidden. Please revert this and find a workaround.
| .refreshButton { | ||
| background: none; | ||
| border: none; | ||
| cursor: pointer; |
There was a problem hiding this comment.
Why background: none; border: none?
Are they needed?
Please check the WHOLE css added in this PR if it's needed!
There was a problem hiding this comment.
Pull Request Overview
This PR implements a toggle switch component in the top bar menu to allow switching between "Run graph" and "Active graph" views for graph-related pages. The changes consolidate graph navigation into a single sidebar menu item with dynamic behavior based on the toggle state.
- Refactored ToggleSwitch component to be more flexible with configurable options
- Added graph tab state management to FlexLayoutContext for coordinating between graph library and graph status views
- Replaced text-based refresh buttons with icon-based buttons across multiple modules
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/ui-lib/Icons/RefreshIcon.tsx | New refresh icon component with button styling |
| frontend/src/common/ui-components/common/ToggleSwitch/ToggleSwitch.tsx | Refactored to accept configurable options instead of hardcoded Live/Final |
| frontend/src/routing/flexLayout/FlexLayoutContext.tsx | Added graphTab state management for coordinating graph views |
| frontend/src/modules/TopbarMenu/TitleBarMenu.tsx | Integrated toggle switch for graph pages with tab switching logic |
| frontend/src/modules/SidebarMenu/SidebarMenu.tsx | Modified graph menu behavior to respect toggle state |
| frontend/src/modules/GraphLibrary/index.tsx | Replaced text refresh button with icon button |
| frontend/src/modules/Nodes/index.tsx | Replaced text refresh button with icon button |
| frontend/src/routing/ModulesRegistry.ts | Hidden graph-status from sidebar and updated titles |
Comments suppressed due to low confidence (3)
frontend/src/ui-lib/Icons/RefreshIcon.tsx:3
- The component is named RefreshButton but the file is named RefreshIcon.tsx. The component name should be RefreshIcon to match the filename and export, or the file should be renamed to RefreshButton.tsx.
const RefreshButton: React.FC<{ onClick?: () => void }> = ({ onClick }) => {
frontend/src/ui-lib/Icons/RefreshIcon.tsx:34
- The export name RefreshButton doesn't match the filename RefreshIcon.tsx. This should export RefreshIcon to maintain consistency.
export default RefreshButton;
| const isGraphMenu = item.keyId === "graph-library"; | ||
|
|
||
| const handleClick = () => { | ||
| if (isGraphMenu) { openTab(graphTab === "run" ? "graph-library" : "graph-status"); } |
There was a problem hiding this comment.
[nitpick] The conditional logic should be moved to a separate line for better readability. Also consider extracting the ternary operation to make the intent clearer.
| if (isGraphMenu) { openTab(graphTab === "run" ? "graph-library" : "graph-status"); } | |
| if (isGraphMenu) { | |
| const targetTab = graphTab === "run" ? "graph-library" : "graph-status"; | |
| openTab(targetTab); | |
| } |
| return ( | ||
| <div className={styles.refreshButtonWrapper} data-testid="refresh-button"> | ||
| <BlueButton onClick={() => fetchAllNodes()}>Refresh</BlueButton> | ||
| <button onClick={() => fetchAllNodes()} title="Refresh node parameters"> <RefreshIcon /> </button> |
There was a problem hiding this comment.
[nitpick] The button should use consistent styling classes instead of inline elements. Consider applying the same styling pattern used in other refresh buttons.
| return ( | ||
| <div className={styles.buttonWrapper}> | ||
| <BlueButton onClick={() => fetchAllCalibrationGraphs(true)}>Refresh</BlueButton> | ||
| <button onClick={() => fetchAllCalibrationGraphs(true)} title="Refresh graph parameters"> <RefreshIcon /> </button> |
There was a problem hiding this comment.
[nitpick] The button should use consistent styling classes instead of inline elements. Consider applying the same styling pattern used in other refresh buttons.
| <button onClick={() => fetchAllCalibrationGraphs(true)} title="Refresh graph parameters"> <RefreshIcon /> </button> | |
| <button className={styles.refreshButton} onClick={() => fetchAllCalibrationGraphs(true)} title="Refresh graph parameters"> <RefreshIcon /> </button> |







https://quantum-machines.atlassian.net/jira/software/c/projects/QUAL/boards/173?assignee=712020%3A2a0fc73a-d6d7-4126-9576-6e44837c6a01&selectedIssue=QUAL-1396