refactor(app): convert getProjectAvatarSource to early returns (#24896)
This commit is contained in:
@@ -20,9 +20,10 @@ import { childSessionOnPath, hasProjectPermissions } from "./helpers"
|
|||||||
const OPENCODE_PROJECT_ID = "4b0ea68d7af9a6031a7ffda7ad66e0cb83315750"
|
const OPENCODE_PROJECT_ID = "4b0ea68d7af9a6031a7ffda7ad66e0cb83315750"
|
||||||
|
|
||||||
export function getProjectAvatarSource(id?: string, icon?: { color?: string; url?: string; override?: string }) {
|
export function getProjectAvatarSource(id?: string, icon?: { color?: string; url?: string; override?: string }) {
|
||||||
return id === OPENCODE_PROJECT_ID
|
if (id === OPENCODE_PROJECT_ID) return "https://opencode.ai/favicon.svg"
|
||||||
? "https://opencode.ai/favicon.svg"
|
if (icon?.override) return icon?.override
|
||||||
: (icon?.override ?? (icon?.color ? undefined : icon?.url))
|
if (icon?.color) return undefined
|
||||||
|
return icon?.url
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProjectIcon = (props: { project: LocalProject; class?: string; notify?: boolean }): JSX.Element => {
|
export const ProjectIcon = (props: { project: LocalProject; class?: string; notify?: boolean }): JSX.Element => {
|
||||||
|
|||||||
Reference in New Issue
Block a user