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

feat: display error if app is not installed#16980

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 2 commits intomainfrom13937-zed
Mar 18, 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
14 changes: 14 additions & 0 deletionssite/src/modules/resources/AppLink/AppLink.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,6 +8,7 @@ import {
MockWorkspaceApp,
MockWorkspaceProxies,
} from "testHelpers/entities";
import { withGlobalSnackbar } from "testHelpers/storybook";
import { AppLink } from "./AppLink";

const meta: Meta<typeof AppLink> = {
Expand DownExpand Up@@ -72,6 +73,19 @@ export const ExternalApp: Story = {
},
};

export const ExternalAppNotInstalled: Story = {
decorators: [withGlobalSnackbar],
args: {
workspace: MockWorkspace,
app: {
...MockWorkspaceApp,
external: true,
url: "foobar-foobaz://open-me",
},
agent: MockWorkspaceAgent,
},
};

export const SharingLevelOwner: Story = {
args: {
workspace: MockWorkspace,
Expand Down
16 changes: 16 additions & 0 deletionssite/src/modules/resources/AppLink/AppLink.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,9 @@ import Link from "@mui/material/Link";
import Tooltip from "@mui/material/Tooltip";
import { API } from "api/api";
import type * as TypesGen from "api/typesGenerated";
import { displayError } from "components/GlobalSnackbar/utils";
import { useProxy } from "contexts/ProxyContext";
import { useEffect } from "react";
import { type FC, type MouseEvent, useState } from "react";
import { createAppLinkHref } from "utils/apps";
import { generateRandomString } from "utils/random";
Expand DownExpand Up@@ -152,6 +154,20 @@ export const AppLink: FC<AppLinkProps> = ({ app, workspace, agent }) => {
url = href.replaceAll(magicTokenString, key.key);
setFetchingSessionToken(false);
}

// When browser recognizes the protocol and is able to navigate to the app,
// it will blur away, and will stop the timer. Otherwise,
// an error message will be displayed.
const openAppExternallyFailedTimeout = 500;
const openAppExternallyFailed = setTimeout(() => {
displayError(
`${app.display_name !== "" ? app.display_name : app.slug} must be installed first.`,
);
}, openAppExternallyFailedTimeout);
window.addEventListener("blur", () => {
clearTimeout(openAppExternallyFailed);
});

window.location.href = url;
return;
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp