Shortcut plugin mig new#9416
Conversation
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Changed Packages
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Migrates the shortcuts plugin UI away from Material-UI components/icons to Backstage UI (BUI) components with CSS modules, and updates dependencies accordingly.
Changes:
- Replaces MUI icons/components with
@backstage/uiand@remixicon/react. - Re-implements Add/Edit shortcut popovers and form styling using CSS modules + BUI components.
- Replaces MUI Avatar-based shortcut icon with a CSS-module-backed avatar div and custom contrast calculation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| workspaces/shortcuts/plugins/shortcuts/src/Shortcuts.tsx | Switches the sidebar “Add Shortcuts” icon from MUI to Remixicon. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutItem.tsx | Replaces MUI edit button/tooltip styling with BUI components + CSS modules. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutItem.module.css | Adds CSS-module hover behavior for showing the edit button. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutIcon.tsx | Replaces MUI Avatar with a styled div and manual contrast color computation. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutIcon.module.css | Adds CSS-module styles for the new avatar div. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutForm.tsx | Migrates form UI to BUI components and custom CSS-module styling. |
| workspaces/shortcuts/plugins/shortcuts/src/ShortcutForm.module.css | Adds CSS-module styles for fields/actions (borders, spacing, dark mode). |
| workspaces/shortcuts/plugins/shortcuts/src/EditShortcut.tsx | Replaces MUI Popover/Card with a custom fixed-position container + click-outside handling. |
| workspaces/shortcuts/plugins/shortcuts/src/EditShortcut.module.css | Adds CSS-module styles for the edit “popover” card/header. |
| workspaces/shortcuts/plugins/shortcuts/src/AddShortcut.tsx | Replaces MUI Popover/Card with a custom fixed-position container + click-outside handling. |
| workspaces/shortcuts/plugins/shortcuts/src/AddShortcut.module.css | Adds CSS-module styles for the add “popover” card/header. |
| workspaces/shortcuts/plugins/shortcuts/package.json | Swaps MUI dependencies for @backstage/ui and @remixicon/react. |
| workspaces/shortcuts/.changeset/many-poems-tan.md | Adds a changeset documenting the BUI migration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Calculate contrast text color based on background color | ||
| const rgb = parseInt(props.color.substring(1), 16); | ||
| const r = (rgb >> 16) & 0xff; | ||
| const g = (rgb >> 8) & 0xff; | ||
| const b = (rgb >> 0) & 0xff; | ||
| const luma = 0.299 * r + 0.587 * g + 0.114 * b; | ||
| const contrastColor = luma > 128 ? '#000000' : '#ffffff'; | ||
|
|
||
| return <Avatar className={classes.avatar}>{props.text}</Avatar>; | ||
| return ( | ||
| <div | ||
| className={styles.avatar} | ||
| style={ | ||
| { | ||
| '--avatar-bg-color': props.color, | ||
| '--avatar-contrast-text': contrastColor, | ||
| } as React.CSSProperties | ||
| } | ||
| > |
| const handleClick = () => { | ||
| if (buttonRef.current) { | ||
| setAnchorEl(buttonRef.current); | ||
| } | ||
| }; |
| <ButtonIcon | ||
| ref={buttonRef} | ||
| id="edit" | ||
| data-testid="edit" | ||
| className={styles.button} |
| .root:hover #edit { | ||
| visibility: visible; | ||
| } |
| <div | ||
| ref={popoverRef} | ||
| style={{ | ||
| position: 'fixed', | ||
| zIndex: 1300, | ||
| top: anchorEl ? (anchorEl as any).getBoundingClientRect().top : 0, | ||
| left: anchorEl | ||
| ? (anchorEl as any).getBoundingClientRect().right + 10 | ||
| : 0, | ||
| }} | ||
| > |
There was a problem hiding this comment.
Anchor button is in stable Backstage sidebar (not scrolling)
User interactions confined to sidebar area
Form closes on outside click (handles visibility concerns)
Lightweight implementation improves bundle size
Acceptable UX for this specific use case
✅ Future Improvements Listed:
Option to add @floating-ui/react if scroll/viewport collisions become an issue
Path to integrate Popper/Floating UI if panel flipping is needed
✅ Trade-offs Explicitly Stated:
✓ Simpler, lighter implementation
✓ Fewer dependencies
✗ No auto viewport collision detection (not needed in sidebar)
✗ No auto reposition on scroll (sidebar typically fixed)
| <div | ||
| ref={popoverRef} | ||
| style={{ | ||
| position: 'fixed', | ||
| zIndex: 1300, | ||
| top: anchorEl ? (anchorEl as any).getBoundingClientRect().top : 0, | ||
| left: anchorEl | ||
| ? (anchorEl as any).getBoundingClientRect().right + 10 | ||
| : 0, | ||
| }} | ||
| > |
| <div | ||
| style={{ | ||
| padding: 'var(--bui-space-4)', | ||
| backgroundColor: 'light-dark(#ffffff, #424242)', | ||
| }} | ||
| > |
| .field :global(input) { | ||
| border: 1px solid #cccccc !important; | ||
| border-radius: 4px !important; | ||
| } |
| <SidebarScrollWrapper> | ||
| <SidebarItem | ||
| icon={props.icon ?? PlayListAddIcon} | ||
| icon={props.icon ?? (() => <RiPlayList2Line size={24} />)} |
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Signed-off-by: amitkumar489 <amit.kumar489@infosys.com>
Hey, I just made a Pull Request!
The shortcuts plugin is now fully migrated to BUI with production-ready styling that automatically adapts to light and dark system themes, improved positioning, and modern Backstage UI components. All ESLint checks pass, and the plugin maintains backward compatibility with existing functionality.
✔️ Checklist
Signed-off-byline in the message. (more info)