-
Notifications
You must be signed in to change notification settings - Fork 891
refactor: Refactor template resources #4789
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f542eaa
Remove error logic from Resources
BrunoQuaresma 3f499e9
Accept different resource card
BrunoQuaresma 046c436
Extract agent row rendering
BrunoQuaresma 00e4cfe
refactor: Refactor template resources table
BrunoQuaresma 49c3a4e
Fix stories
BrunoQuaresma 212c4ef
Refactor
BrunoQuaresma f7300f4
Fix tests and fix mobile
BrunoQuaresma 6197cf7
Fix mobile breakpoints
BrunoQuaresma 927a68e
Apply suggestions from code review
BrunoQuaresma 6c5cfd5
Add translation
BrunoQuaresma e1b3b91
Update site/src/components/AppLink/AppLink.stories.tsx
BrunoQuaresma ecb41a9
Add translations to preview card
BrunoQuaresma 528bc42
Fix translations
BrunoQuaresma ac6a5de
Merge branch 'bq/update-resource-preview' of github.com:coder/coder i…
BrunoQuaresma 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
This file contains hidden or 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 hidden or 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 hidden or 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,43 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import { Stack } from "components/Stack/Stack" | ||
import { FC } from "react" | ||
import * as TypesGen from "api/typesGenerated" | ||
import { BaseIcon } from "./BaseIcon" | ||
import { ShareIcon } from "./ShareIcon" | ||
|
||
export interface AppPreviewProps { | ||
app: TypesGen.WorkspaceApp | ||
} | ||
|
||
export const AppPreviewLink: FC<AppPreviewProps> = ({ app }) => { | ||
const styles = useStyles() | ||
|
||
return ( | ||
<Stack | ||
className={styles.appPreviewLink} | ||
alignItems="center" | ||
direction="row" | ||
spacing={1} | ||
> | ||
<BaseIcon app={app} /> | ||
{app.name} | ||
<ShareIcon app={app} /> | ||
</Stack> | ||
) | ||
} | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
appPreviewLink: { | ||
padding: theme.spacing(0.25, 1.5), | ||
borderRadius: 9999, | ||
border: `1px solid ${theme.palette.divider}`, | ||
color: theme.palette.text.primary, | ||
background: theme.palette.background.paper, | ||
flexShrink: 0, | ||
width: "fit-content", | ||
|
||
"& img, & svg": { | ||
width: 14, | ||
}, | ||
}, | ||
})) |
This file contains hidden or 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,11 @@ | ||
import { WorkspaceApp } from "api/typesGenerated" | ||
import { FC } from "react" | ||
import ComputerIcon from "@material-ui/icons/Computer" | ||
|
||
export const BaseIcon: FC<{ app: WorkspaceApp }> = ({ app }) => { | ||
return app.icon ? ( | ||
<img alt={`${app.name} Icon`} src={app.icon} /> | ||
) : ( | ||
<ComputerIcon /> | ||
) | ||
} |
This file contains hidden or 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,28 @@ | ||
import PublicOutlinedIcon from "@material-ui/icons/PublicOutlined" | ||
import LockOutlinedIcon from "@material-ui/icons/LockOutlined" | ||
import GroupOutlinedIcon from "@material-ui/icons/GroupOutlined" | ||
import { FC } from "react" | ||
import * as TypesGen from "../../api/typesGenerated" | ||
import Tooltip from "@material-ui/core/Tooltip" | ||
import { useTranslation } from "react-i18next" | ||
|
||
export interface ShareIconProps { | ||
app: TypesGen.WorkspaceApp | ||
} | ||
|
||
export const ShareIcon: FC<ShareIconProps> = ({ app }) => { | ||
const { t } = useTranslation("agent") | ||
|
||
let shareIcon = <LockOutlinedIcon /> | ||
let shareTooltip = t("shareTooltip.private") | ||
if (app.sharing_level === "authenticated") { | ||
shareIcon = <GroupOutlinedIcon /> | ||
shareTooltip = t("shareTooltip.authenticated") | ||
} | ||
if (app.sharing_level === "public") { | ||
shareIcon = <PublicOutlinedIcon /> | ||
shareTooltip = t("shareTooltip.public") | ||
} | ||
|
||
return <Tooltip title={shareTooltip}>{shareIcon}</Tooltip> | ||
} |
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.