Skip to content

Commit 97d1d2f

Browse files
authored
added a default app icon (coder#2595)
resolves coder#2268
1 parent 7dc3f5f commit 97d1d2f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

site/src/components/AppLink/AppLink.tsx

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import Link from "@material-ui/core/Link"
22
import { makeStyles } from "@material-ui/core/styles"
3-
import React, { FC } from "react"
3+
import ComputerIcon from "@material-ui/icons/Computer"
4+
import { FC } from "react"
45
import * as TypesGen from "../../api/typesGenerated"
56
import { combineClasses } from "../../util/combineClasses"
67

78
export interface AppLinkProps {
89
userName: TypesGen.User["username"]
910
workspaceName: TypesGen.Workspace["name"]
1011
appName: TypesGen.WorkspaceApp["name"]
11-
appIcon: TypesGen.WorkspaceApp["icon"]
12+
appIcon?: TypesGen.WorkspaceApp["icon"]
1213
}
1314

1415
export const AppLink: FC<AppLinkProps> = ({ userName, workspaceName, appName, appIcon }) => {
@@ -25,11 +26,15 @@ export const AppLink: FC<AppLinkProps> = ({ userName, workspaceName, appName, ap
2526
window.open(href, appName, "width=900,height=600")
2627
}}
2728
>
28-
<img
29-
className={combineClasses([styles.icon, appIcon === "" ? "empty" : ""])}
30-
alt={`${appName} Icon`}
31-
src={appIcon || ""}
32-
/>
29+
{appIcon ? (
30+
<img
31+
className={combineClasses([styles.icon, appIcon === "" ? "empty" : ""])}
32+
alt={`${appName} Icon`}
33+
src={appIcon || ""}
34+
/>
35+
) : (
36+
<ComputerIcon className={styles.icon} />
37+
)}
3338
{appName}
3439
</Link>
3540
)

0 commit comments

Comments
 (0)