Skip to content

Commit a429bd8

Browse files
committed
chore(UI): remove private icon from apps in dashboard
1 parent 76bdde7 commit a429bd8

File tree

4 files changed

+56
-17
lines changed

4 files changed

+56
-17
lines changed

site/src/components/AppLink/AppLink.stories.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,36 @@ WithIconExternal.args = {
3535
agent: MockWorkspaceAgent,
3636
}
3737

38+
export const SharingLevelOwner = Template.bind({})
39+
SharingLevelOwner.args = {
40+
workspace: MockWorkspace,
41+
app: {
42+
...MockWorkspaceApp,
43+
sharing_level: "owner",
44+
},
45+
agent: MockWorkspaceAgent,
46+
}
47+
48+
export const SharingLevelAuthenticated = Template.bind({})
49+
SharingLevelAuthenticated.args = {
50+
workspace: MockWorkspace,
51+
app: {
52+
...MockWorkspaceApp,
53+
sharing_level: "authenticated",
54+
},
55+
agent: MockWorkspaceAgent,
56+
}
57+
58+
export const SharingLevelPublic = Template.bind({})
59+
SharingLevelPublic.args = {
60+
workspace: MockWorkspace,
61+
app: {
62+
...MockWorkspaceApp,
63+
sharing_level: "public",
64+
},
65+
agent: MockWorkspaceAgent,
66+
}
67+
3868
export const WithoutIcon = Template.bind({})
3969
WithoutIcon.args = {
4070
workspace: MockWorkspace,

site/src/components/AppLink/AppLink.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { makeStyles } from "@material-ui/core/styles"
55
import Tooltip from "@material-ui/core/Tooltip"
66
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
77
import { FC } from "react"
8+
import { combineClasses } from "util/combineClasses"
89
import * as TypesGen from "../../api/typesGenerated"
910
import { generateRandomString } from "../../util/random"
1011
import { BaseIcon } from "./BaseIcon"
@@ -79,15 +80,19 @@ export const AppLink: FC<AppLinkProps> = ({
7980
"Your admin has not configured subdomain application access"
8081
}
8182

83+
const isPrivateApp = app.sharing_level === "owner"
84+
8285
const button = (
8386
<Button
8487
size="small"
8588
startIcon={icon}
86-
endIcon={<ShareIcon app={app} />}
89+
endIcon={isPrivateApp ? undefined : <ShareIcon app={app} />}
8790
className={styles.button}
8891
disabled={!canClick}
8992
>
90-
<span className={styles.appName}>{appDisplayName}</span>
93+
<span className={combineClasses({ [styles.appName]: !isPrivateApp })}>
94+
{appDisplayName}
95+
</span>
9196
</Button>
9297
)
9398

site/src/components/AppLink/ShareIcon.stories.tsx

Whitespace-only changes.
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import PublicOutlinedIcon from "@material-ui/icons/PublicOutlined"
2-
import LockOutlinedIcon from "@material-ui/icons/LockOutlined"
32
import GroupOutlinedIcon from "@material-ui/icons/GroupOutlined"
43
import LaunchOutlinedIcon from "@material-ui/icons/LaunchOutlined"
5-
import { FC } from "react"
64
import * as TypesGen from "../../api/typesGenerated"
75
import Tooltip from "@material-ui/core/Tooltip"
86
import { useTranslation } from "react-i18next"
@@ -11,23 +9,29 @@ export interface ShareIconProps {
119
app: TypesGen.WorkspaceApp
1210
}
1311

14-
export const ShareIcon: FC<ShareIconProps> = ({ app }) => {
12+
export const ShareIcon = ({ app }: ShareIconProps) => {
1513
const { t } = useTranslation("agent")
16-
17-
let shareIcon = <LockOutlinedIcon />
18-
let shareTooltip = t("shareTooltip.private")
14+
if (app.external) {
15+
return (
16+
<Tooltip title={t("shareTooltip.external")}>
17+
<LaunchOutlinedIcon />
18+
</Tooltip>
19+
)
20+
}
1921
if (app.sharing_level === "authenticated") {
20-
shareIcon = <GroupOutlinedIcon />
21-
shareTooltip = t("shareTooltip.authenticated")
22+
return (
23+
<Tooltip title={t("shareTooltip.authenticated")}>
24+
<GroupOutlinedIcon />
25+
</Tooltip>
26+
)
2227
}
2328
if (app.sharing_level === "public") {
24-
shareIcon = <PublicOutlinedIcon />
25-
shareTooltip = t("shareTooltip.public")
26-
}
27-
if (app.external) {
28-
shareIcon = <LaunchOutlinedIcon />
29-
shareTooltip = t("shareTooltip.external")
29+
return (
30+
<Tooltip title={t("shareTooltip.public")}>
31+
<PublicOutlinedIcon />
32+
</Tooltip>
33+
)
3034
}
3135

32-
return <Tooltip title={shareTooltip}>{shareIcon}</Tooltip>
36+
return null
3337
}

0 commit comments

Comments
 (0)