mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-04 23:21:41 +03:00
fix(core): handle the situation where the app cannot be opened after logging in (#8915)
Added buttons to open the web version of AFFiNE and download the latest client to handle the situation where the application cannot be opened after logging in. ![CleanShot 2024-11-25 at 17 19 37@2x](https://github.com/user-attachments/assets/fd4e00fa-61a2-45ac-9bbc-fc4e4a8abc4e)
This commit is contained in:
parent
70633d0d16
commit
31c806ef7e
@ -43,6 +43,7 @@ export const promptLink = style({
|
|||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
fontSize: cssVar('fontSm'),
|
fontSize: cssVar('fontSm'),
|
||||||
|
cursor: 'pointer',
|
||||||
});
|
});
|
||||||
export const centerContent = style({
|
export const centerContent = style({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -54,6 +55,14 @@ export const prompt = style({
|
|||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
marginBottom: 12,
|
marginBottom: 12,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const accidentHandling = style({
|
||||||
|
marginTop: 20,
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
rowGap: 12,
|
||||||
|
alignItems: 'center',
|
||||||
|
});
|
||||||
export const editSettingsLink = style({
|
export const editSettingsLink = style({
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
|
@ -6,6 +6,7 @@ import { LocalWorkspaceIcon, Logo1Icon } from '@blocksuite/icons/rc';
|
|||||||
import { useService } from '@toeverything/infra';
|
import { useService } from '@toeverything/infra';
|
||||||
import type { MouseEvent } from 'react';
|
import type { MouseEvent } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { GlobalDialogService } from '../../dialogs';
|
import { GlobalDialogService } from '../../dialogs';
|
||||||
import { getOpenUrlInDesktopAppLink } from '../utils';
|
import { getOpenUrlInDesktopAppLink } from '../utils';
|
||||||
@ -17,19 +18,19 @@ interface OpenAppProps {
|
|||||||
urlToOpen?: string | null;
|
urlToOpen?: string | null;
|
||||||
openHereClicked?: (e: MouseEvent) => void;
|
openHereClicked?: (e: MouseEvent) => void;
|
||||||
}
|
}
|
||||||
|
const channel = BUILD_CONFIG.appBuildType;
|
||||||
|
const url =
|
||||||
|
'https://affine.pro/download' + (channel !== 'stable' ? '/beta-canary' : '');
|
||||||
|
|
||||||
export const OpenInAppPage = ({ urlToOpen, openHereClicked }: OpenAppProps) => {
|
export const OpenInAppPage = ({ urlToOpen, openHereClicked }: OpenAppProps) => {
|
||||||
// default to open the current page in desktop app
|
// default to open the current page in desktop app
|
||||||
urlToOpen ??= getOpenUrlInDesktopAppLink(window.location.href, true);
|
urlToOpen ??= getOpenUrlInDesktopAppLink(window.location.href, true);
|
||||||
const globalDialogService = useService(GlobalDialogService);
|
const globalDialogService = useService(GlobalDialogService);
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const channel = BUILD_CONFIG.appBuildType;
|
|
||||||
const openDownloadLink = useCallback(() => {
|
const openDownloadLink = useCallback(() => {
|
||||||
const url =
|
|
||||||
'https://affine.pro/download' +
|
|
||||||
(channel !== 'stable' ? '/beta-canary' : '');
|
|
||||||
open(url, '_blank');
|
open(url, '_blank');
|
||||||
}, [channel]);
|
}, []);
|
||||||
|
|
||||||
const appIcon = appIconMap[channel];
|
const appIcon = appIconMap[channel];
|
||||||
const appName = appNames[channel];
|
const appName = appNames[channel];
|
||||||
@ -139,6 +140,22 @@ export const OpenInAppPage = ({ urlToOpen, openHereClicked }: OpenAppProps) => {
|
|||||||
{t['com.affine.auth.open.affine.try-again']()}
|
{t['com.affine.auth.open.affine.try-again']()}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div className={styles.accidentHandling}>
|
||||||
|
<div className={styles.prompt}>
|
||||||
|
{t['com.affine.auth.open.affine.still-have-problems']()}
|
||||||
|
</div>
|
||||||
|
<Link to="/" replace className={styles.promptLink}>
|
||||||
|
{t['com.affine.auth.open.affine.continue-with-browser']()}
|
||||||
|
</Link>
|
||||||
|
<a
|
||||||
|
className={styles.promptLink}
|
||||||
|
href={url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
|
{t['com.affine.auth.open.affine.download-latest-client']()}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{maybeDocLink ? (
|
{maybeDocLink ? (
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"ko": 79,
|
"ko": 79,
|
||||||
"pl": 0,
|
"pl": 0,
|
||||||
"pt-BR": 86,
|
"pt-BR": 86,
|
||||||
"ru": 74,
|
"ru": 73,
|
||||||
"sv-SE": 4,
|
"sv-SE": 4,
|
||||||
"ur": 3,
|
"ur": 3,
|
||||||
"zh-Hans": 100,
|
"zh-Hans": 100,
|
||||||
|
@ -234,6 +234,9 @@
|
|||||||
"com.affine.auth.open.affine.prompt": "Opening <1>AFFiNE</1> app now",
|
"com.affine.auth.open.affine.prompt": "Opening <1>AFFiNE</1> app now",
|
||||||
"com.affine.auth.open.affine.open-doc-prompt": "This doc is now opened in <1>AFFiNE</1> app",
|
"com.affine.auth.open.affine.open-doc-prompt": "This doc is now opened in <1>AFFiNE</1> app",
|
||||||
"com.affine.auth.open.affine.try-again": "Try again",
|
"com.affine.auth.open.affine.try-again": "Try again",
|
||||||
|
"com.affine.auth.open.affine.still-have-problems": "Still have problems?",
|
||||||
|
"com.affine.auth.open.affine.continue-with-browser": "Continue with Browser",
|
||||||
|
"com.affine.auth.open.affine.download-latest-client": "Download Latest Client",
|
||||||
"com.affine.auth.open.affine.doc.open-here": "Open here instead",
|
"com.affine.auth.open.affine.doc.open-here": "Open here instead",
|
||||||
"com.affine.auth.open.affine.doc.edit-settings": "Edit settings",
|
"com.affine.auth.open.affine.doc.edit-settings": "Edit settings",
|
||||||
"com.affine.auth.open.affine.doc.footer-text": "Requires AFFiNE desktop app version 0.18 or later.",
|
"com.affine.auth.open.affine.doc.footer-text": "Requires AFFiNE desktop app version 0.18 or later.",
|
||||||
|
@ -234,6 +234,9 @@
|
|||||||
"com.affine.auth.open.affine.prompt": "正在打开 <1>AFFiNE</1> 应用\n",
|
"com.affine.auth.open.affine.prompt": "正在打开 <1>AFFiNE</1> 应用\n",
|
||||||
"com.affine.auth.open.affine.open-doc-prompt": "已在 <1>AFFiNE</1> 客户端中打开此文档",
|
"com.affine.auth.open.affine.open-doc-prompt": "已在 <1>AFFiNE</1> 客户端中打开此文档",
|
||||||
"com.affine.auth.open.affine.try-again": "重试",
|
"com.affine.auth.open.affine.try-again": "重试",
|
||||||
|
"com.affine.auth.open.affine.still-have-problems": "仍然遇到问题?",
|
||||||
|
"com.affine.auth.open.affine.continue-with-browser": "使用浏览器继续",
|
||||||
|
"com.affine.auth.open.affine.download-latest-client": "下载最新客户端",
|
||||||
"com.affine.auth.open.affine.doc.open-here": "在此处打开",
|
"com.affine.auth.open.affine.doc.open-here": "在此处打开",
|
||||||
"com.affine.auth.open.affine.doc.edit-settings": "编辑设置",
|
"com.affine.auth.open.affine.doc.edit-settings": "编辑设置",
|
||||||
"com.affine.auth.open.affine.doc.footer-text": "需要 AFFiNE 桌面应用程序版本 0.18 或更高。",
|
"com.affine.auth.open.affine.doc.footer-text": "需要 AFFiNE 桌面应用程序版本 0.18 或更高。",
|
||||||
|
Loading…
Reference in New Issue
Block a user