Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: hide app icon if not found#16684

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 4 commits intomainfrom14759-app
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletionsite/src/modules/resources/AppLink/AppLink.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,6 +37,7 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
const preferredPathBase = proxy.preferredPathAppURL;
const appsHost = proxy.preferredWildcardHostname;
const [fetchingSessionToken, setFetchingSessionToken] = useState(false);
const [iconError, setIconError] = useState(false);

const theme = useTheme();
const username = workspace.owner_name;
Expand DownExpand Up@@ -67,7 +68,9 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
// To avoid bugs in the healthcheck code locking users out of apps, we no
// longer block access to apps if they are unhealthy/initializing.
let canClick = true;
let icon = <BaseIcon app={app} />;
let icon = !iconError && (
<BaseIcon app={app} onIconPathError={() => setIconError(true)} />
);

let primaryTooltip = "";
if (app.health === "initializing") {
Expand Down
9 changes: 8 additions & 1 deletionsite/src/modules/resources/AppLink/BaseIcon.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,14 +4,21 @@ import type { FC } from "react";

interface BaseIconProps {
app: WorkspaceApp;
onIconPathError?: () => void;
}

export const BaseIcon: FC<BaseIconProps> = ({ app }) => {
export const BaseIcon: FC<BaseIconProps> = ({ app, onIconPathError }) => {
return app.icon ? (
<img
alt={`${app.display_name} Icon`}
src={app.icon}
style={{ pointerEvents: "none" }}
onError={() => {
console.warn(
`Application icon for "${app.id}" has invalid source "${app.icon}".`,
);
onIconPathError?.();
}}
/>
) : (
<ComputerIcon />
Expand Down
37 changes: 37 additions & 0 deletionssite/src/pages/WorkspacePage/Workspace.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,6 +80,43 @@ export const Running: Story = {
},
};

export const AppIcons: Story = {
args: {
...Running.args,
workspace: {
...Mocks.MockWorkspace,
latest_build: {
...Mocks.MockWorkspace.latest_build,
resources: [
{
...Mocks.MockWorkspaceResource,
agents: [
{
...Mocks.MockWorkspaceAgent,
apps: [
{
...Mocks.MockWorkspaceApp,
id: "test-app-1",
slug: "test-app-1",
display_name: "Default Icon",
},
{
...Mocks.MockWorkspaceApp,
id: "test-app-2",
slug: "test-app-2",
display_name: "Broken Icon",
icon: "/foobar/broken.png",
},
],
},
],
},
],
},
},
},
};

export const Favorite: Story = {
args: {
...Running.args,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp