diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b9911c4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,63 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Start", + "type": "node", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/node_modules/.bin/concurrently", + "args": [ + "yarn workspace app start", + "yarn workspace backend start" + ], + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal" + }, + { + "name": "Start Backend", + "type": "node", + "request": "launch", + "args": [ + "package", + "start" + ], + "cwd": "${workspaceFolder}/packages/backend", + "program": "${workspaceFolder}/node_modules/.bin/backstage-cli", + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal" + }, + { + "name": "Start App", + "type": "node", + "request": "launch", + "args": [ + "package", + "start" + ], + "cwd": "${workspaceFolder}/packages/app", + "program": "${workspaceFolder}/node_modules/.bin/backstage-cli", + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal" + }, + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/src", + "sourceMapPathOverrides": { + "webpack:///src/*": "${webRoot}/*" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..26a025f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "jest.jestCommandLine": "node_modules/.bin/jest --config node_modules/@backstage/cli/config/jest.js", +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23c1d56..1ee2c23 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,10 +11,6 @@ This is similar to other open source projects. Here are the steps to get started ``` git clone ``` -- Install dependencies - ``` - make install - ``` - Start the app ``` make dev diff --git a/docs/development.md b/docs/development.md index cb81712..7f5c473 100644 --- a/docs/development.md +++ b/docs/development.md @@ -38,3 +38,8 @@ export default function CustomizedButtons() { ## Theme Providers https://mui.com/material-ui/customization/theming/#accessing-the-theme-in-a-component + +## Guides + +- [Debugging Jest Tests](https://backstage.io/docs/tooling/cli/build-system/#debugging-jest-tests) +- [Testing with Jest](https://backstage.io/docs/plugins/testing) diff --git a/packages/app/src/components/Root/Root.tsx b/packages/app/src/components/Root/Root.tsx index ed17ba4..16cce8f 100644 --- a/packages/app/src/components/Root/Root.tsx +++ b/packages/app/src/components/Root/Root.tsx @@ -1,4 +1,4 @@ -import React, { PropsWithChildren } from 'react'; +import React, { PropsWithChildren, useState } from 'react'; import { styled } from '@mui/material/styles'; import Home from '@mui/icons-material/Home'; import CreateComponent from '@mui/icons-material/AddCircleOutline'; @@ -19,6 +19,7 @@ import { SidebarSpace, useSidebarOpenState, Link, + SidebarExpandButton, } from '@backstage/core-components'; import MenuIcon from '@mui/icons-material/Menu'; import SearchIcon from '@mui/icons-material/Search'; @@ -31,6 +32,10 @@ import MonitorHeartRoundedIcon from '@mui/icons-material/MonitorHeartRounded'; import ScoreRoundedIcon from '@mui/icons-material/ScoreRounded'; import { IconComponent } from '@backstage/core-plugin-api'; +export enum LocalStorageKeys { + SIDEBAR_PIN_STATE = 'sidebarPinState', +} + const SidebarLogoRoot = styled('div')(() => ({ width: sidebarConfig.drawerWidthClosed, height: 3 * sidebarConfig.logoHeight, @@ -57,64 +62,76 @@ const SidebarLogo = () => { ); }; -export const Root = ({ children }: PropsWithChildren<{}>) => ( - - - - } to="/search"> - - - - }> - {/* Global nav, not org-specific */} - - +export const Root = ({ children }: PropsWithChildren<{}>) => { + if ( + window.localStorage.getItem(LocalStorageKeys.SIDEBAR_PIN_STATE) === null + ) { + window.localStorage.setItem( + LocalStorageKeys.SIDEBAR_PIN_STATE, + JSON.stringify(false), + ); + } + + return ( + + + + } to="/search"> + + + + }> + {/* Global nav, not org-specific */} + + + + + + + - - - - - - - - } - to="/settings" - > - - - - {children} - -); + + + } + to="/settings" + > + + + + + {children} + + ); +}; diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index 8149ff0..362e319 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -123,7 +123,7 @@ const entityWarningContent = ( ); const overviewContent = ( - + {entityWarningContent} @@ -190,7 +190,7 @@ const websiteEntityPage = ( - + @@ -242,7 +242,7 @@ const componentPage = ( const apiPage = ( - + {entityWarningContent} @@ -250,7 +250,7 @@ const apiPage = ( - + @@ -265,7 +265,7 @@ const apiPage = ( - +