-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: [M3-6273] - MUI v5 Migration - SRC > Features > Lish #9774
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
87da676
refactor: [M3-6273] - MUI v5 Migration - SRC > Features > Lish
jaalah 229937f
Update hovers
jaalah 62c3011
Revert
jaalah 3cc982a
Added changeset: MUI v5 Migration - `SRC > Features > Lish`
jaalah 9fafc2c
Add hover to selected
jaalah 7614606
Update packages/manager/src/components/ReachTab.tsx
jaalah-akamai 24b6ef8
Update packages/manager/src/components/ReachTab.tsx
jaalah-akamai 444b603
Review updates
jaalah 0548f76
Merge branch 'develop' of github.com:linode/manager into M3-6273
jaalah a934aae
Merge branch 'M3-6273' of github.com:jaalah-akamai/manager into M3-6273
jaalah 6c00ff8
Review updates 02
jaalah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9774-tech-stories-1696952177563.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
MUI v5 Migration - `SRC > Features > Lish` ([#9774](https://github.com/linode/manager/pull/9774)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,27 @@ | ||
import { Theme } from '@mui/material/styles'; | ||
import { makeStyles } from '@mui/styles'; | ||
import { styled } from '@mui/material/styles'; | ||
import * as React from 'react'; | ||
import { useHistory, useParams } from 'react-router-dom'; | ||
|
||
import { CircleProgress } from 'src/components/CircleProgress'; | ||
import { ErrorState } from 'src/components/ErrorState/ErrorState'; | ||
import { TabPanels } from 'src/components/ReachTabPanels'; | ||
import { Tabs } from 'src/components/ReachTabs'; | ||
import { SafeTabPanel } from 'src/components/SafeTabPanel/SafeTabPanel'; | ||
import { TabLinkList } from 'src/components/TabLinkList/TabLinkList'; | ||
import { Tab } from 'src/components/TabLinkList/TabLinkList'; | ||
import { TabPanels } from 'src/components/ReachTabPanels'; | ||
import { Tabs } from 'src/components/ReachTabs'; | ||
import { | ||
useLinodeLishTokenQuery, | ||
useLinodeQuery, | ||
} from 'src/queries/linodes/linodes'; | ||
|
||
import '../../assets/weblish/weblish.css'; | ||
import '../../assets/weblish/xterm.css'; | ||
import Glish from './Glish'; | ||
import Weblish from './Weblish'; | ||
|
||
const AUTH_POLLING_INTERVAL = 2000; | ||
|
||
const useStyles = makeStyles((theme: Theme) => ({ | ||
notFound: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was never used |
||
'& h1': { | ||
color: '#f4f4f4 !important', | ||
}, | ||
color: '#f4f4f4 !important', | ||
}, | ||
progress: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has no effect whatsoever, so I removed since we're centering this anyways |
||
height: 'auto', | ||
}, | ||
tabs: { | ||
'& [role="tab"]': { | ||
'&[aria-selected="true"]': { | ||
'&:hover': { | ||
backgroundColor: theme.palette.primary.light, | ||
color: 'white', | ||
}, | ||
backgroundColor: theme.palette.primary.main, | ||
borderBottom: 'none !important', | ||
color: 'white !important', | ||
}, | ||
backgroundColor: theme.bg.offWhite, | ||
color: theme.color.tableHeaderText, | ||
flex: 'auto', | ||
margin: 0, | ||
maxWidth: 'none !important', | ||
}, | ||
'& [role="tablist"]': { | ||
backgroundColor: theme.bg.offWhite, | ||
display: 'flex', | ||
margin: 0, | ||
overflow: 'hidden', | ||
}, | ||
backgroundColor: 'black', | ||
margin: 0, | ||
}, | ||
})); | ||
|
||
const Lish = () => { | ||
const classes = useStyles(); | ||
const history = useHistory(); | ||
|
||
const { linodeId, type } = useParams<{ linodeId: string; type: string }>(); | ||
|
@@ -83,10 +45,6 @@ const Lish = () => { | |
const token = data?.lish_token; | ||
|
||
React.useEffect(() => { | ||
const webLishCss = import('' + '../../assets/weblish/weblish.css'); | ||
const xtermCss = import('' + '../../assets/weblish/xterm.css'); | ||
Promise.all([webLishCss, xtermCss]); | ||
|
||
const interval = setInterval(checkAuthentication, AUTH_POLLING_INTERVAL); | ||
|
||
return () => { | ||
|
@@ -127,7 +85,7 @@ const Lish = () => { | |
}; | ||
|
||
if (isLoading) { | ||
return <CircleProgress className={classes.progress} noInner />; | ||
return <StyledCircleProgress />; | ||
} | ||
|
||
if (linodeError) { | ||
|
@@ -149,44 +107,63 @@ const Lish = () => { | |
); | ||
} | ||
|
||
return ( | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
<React.Fragment> | ||
{linode && token && ( | ||
<Tabs | ||
index={ | ||
type && | ||
tabs.findIndex((tab) => tab.title.toLocaleLowerCase() === type) !== | ||
-1 | ||
? tabs.findIndex((tab) => tab.title.toLocaleLowerCase() === type) | ||
: 0 | ||
} | ||
className={classes.tabs} | ||
onChange={navToURL} | ||
> | ||
<TabLinkList tabs={tabs} /> | ||
<TabPanels> | ||
<SafeTabPanel data-qa-tab="Weblish" index={0}> | ||
<Weblish | ||
linode={linode} | ||
refreshToken={refreshToken} | ||
token={token} | ||
/> | ||
</SafeTabPanel> | ||
{!isBareMetal && ( | ||
<SafeTabPanel data-qa-tab="Glish" index={1}> | ||
<Glish | ||
linode={linode} | ||
refreshToken={refreshToken} | ||
token={token} | ||
/> | ||
</SafeTabPanel> | ||
)} | ||
</TabPanels> | ||
</Tabs> | ||
)} | ||
</React.Fragment> | ||
); | ||
return linode && token ? ( | ||
<StyledTabs | ||
index={ | ||
type && | ||
tabs.findIndex((tab) => tab.title.toLocaleLowerCase() === type) !== -1 | ||
? tabs.findIndex((tab) => tab.title.toLocaleLowerCase() === type) | ||
: 0 | ||
} | ||
onChange={navToURL} | ||
> | ||
<TabLinkList tabs={tabs} /> | ||
<TabPanels> | ||
<SafeTabPanel data-qa-tab="Weblish" index={0}> | ||
<Weblish linode={linode} refreshToken={refreshToken} token={token} /> | ||
</SafeTabPanel> | ||
{!isBareMetal && ( | ||
<SafeTabPanel data-qa-tab="Glish" index={1}> | ||
<Glish linode={linode} refreshToken={refreshToken} token={token} /> | ||
</SafeTabPanel> | ||
)} | ||
</TabPanels> | ||
</StyledTabs> | ||
) : null; | ||
}; | ||
|
||
export default Lish; | ||
|
||
const StyledTabs = styled(Tabs)(({ theme }) => ({ | ||
'& [data-reach-tab][role="tab"]': { | ||
'&[aria-selected="true"]': { | ||
'&:hover': { | ||
backgroundColor: theme.palette.primary.light, | ||
color: theme.name === 'light' ? theme.color.white : theme.color.black, | ||
}, | ||
backgroundColor: theme.palette.primary.main, | ||
borderBottom: 'none !important', | ||
color: theme.name === 'light' ? theme.color.white : theme.color.black, | ||
}, | ||
backgroundColor: theme.bg.offWhite, | ||
color: theme.color.tableHeaderText, | ||
flex: 'auto', | ||
margin: 0, | ||
maxWidth: 'none !important', | ||
}, | ||
'& [role="tablist"]': { | ||
backgroundColor: theme.bg.offWhite, | ||
display: 'flex', | ||
margin: 0, | ||
overflow: 'hidden', | ||
}, | ||
backgroundColor: 'black', | ||
margin: 0, | ||
})); | ||
|
||
export const StyledCircleProgress = styled(CircleProgress)(() => ({ | ||
left: '50%', | ||
position: 'absolute', | ||
top: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
!important
was added because there was nohover
style for selected tabs. I added that styled and the hover color for selected tabs should stay blue.You can test this by going through the create linode flow and looking at the

plan
tabs