Открыть боковую панель
Teknokomo
universo-react
Коммиты
764da784
Не подтверждена
Коммит
764da784
создал
Апр 30, 2024
по автору
EYHN
Просмотр файлов
feat(core): add enable cloud failed notify (#6741)
владелец
148e058c
Изменения
3
Скрыть пробелы
Построчно
Рядом
packages/frontend/component/src/ui/modal/confirm-modal.tsx
Просмотр файла @
764da784
...
@@ -112,6 +112,7 @@ export const ConfirmModalProvider = ({ children }: PropsWithChildren) => {
...
@@ -112,6 +112,7 @@ export const ConfirmModalProvider = ({ children }: PropsWithChildren) => {
return
Promise
.
resolve
(
_onConfirm
?.())
return
Promise
.
resolve
(
_onConfirm
?.())
.
then
(()
=>
onSuccess
?.())
.
then
(()
=>
onSuccess
?.())
.
catch
(
console
.
error
)
.
catch
(
console
.
error
)
.
finally
(()
=>
setLoading
(
false
))
.
finally
(()
=>
autoClose
&&
closeConfirmModal
());
.
finally
(()
=>
autoClose
&&
closeConfirmModal
());
};
};
setModalProps
({
...
otherProps
,
onConfirm
,
open
:
true
});
setModalProps
({
...
otherProps
,
onConfirm
,
open
:
true
});
...
...
packages/frontend/core/src/hooks/affine/use-enable-cloud.tsx
Просмотр файла @
764da784
import
{
useConfirmModal
}
from
'
@affine/component
'
;
import
{
notify
,
useConfirmModal
}
from
'
@affine/component
'
;
import
{
authAtom
}
from
'
@affine/core/atoms
'
;
import
{
authAtom
}
from
'
@affine/core/atoms
'
;
import
{
AuthService
}
from
'
@affine/core/modules/cloud
'
;
import
{
AuthService
}
from
'
@affine/core/modules/cloud
'
;
import
{
WorkspaceSubPath
}
from
'
@affine/core/shared
'
;
import
{
WorkspaceSubPath
}
from
'
@affine/core/shared
'
;
...
@@ -37,12 +37,19 @@ export const useEnableCloud = () => {
...
@@ -37,12 +37,19 @@ export const useEnableCloud = () => {
const
enableCloud
=
useCallback
(
const
enableCloud
=
useCallback
(
async
(
ws
:
Workspace
|
null
,
options
?:
ConfirmEnableCloudOptions
)
=>
{
async
(
ws
:
Workspace
|
null
,
options
?:
ConfirmEnableCloudOptions
)
=>
{
if
(
!
ws
)
return
;
try
{
const
{
id
:
newId
}
=
await
workspacesService
.
transformLocalToCloud
(
ws
);
if
(
!
ws
)
return
;
openPage
(
newId
,
options
?.
openPageId
||
WorkspaceSubPath
.
ALL
);
const
{
id
:
newId
}
=
await
workspacesService
.
transformLocalToCloud
(
ws
);
options
?.
onSuccess
?.();
openPage
(
newId
,
options
?.
openPageId
||
WorkspaceSubPath
.
ALL
);
options
?.
onSuccess
?.();
}
catch
(
e
)
{
console
.
error
(
e
);
notify
.
error
({
title
:
t
[
'
com.affine.workspace.enable-cloud.failed
'
](),
});
}
},
},
[
openPage
,
workspacesService
]
[
openPage
,
t
,
workspacesService
]
);
);
const
openSignIn
=
useCallback
(()
=>
{
const
openSignIn
=
useCallback
(()
=>
{
...
@@ -95,7 +102,9 @@ export const useEnableCloud = () => {
...
@@ -95,7 +102,9 @@ export const useEnableCloud = () => {
if
(
!
open
)
onFinished
?.();
if
(
!
open
)
onFinished
?.();
},
},
},
},
{
autoClose
:
false
}
{
autoClose
:
false
,
}
);
);
},
},
[
closeConfirmModal
,
loginStatus
,
openConfirmModal
,
signInOrEnableCloud
,
t
]
[
closeConfirmModal
,
loginStatus
,
openConfirmModal
,
signInOrEnableCloud
,
t
]
...
...
packages/frontend/i18n/src/resources/en.json
Просмотр файла @
764da784
...
@@ -1312,5 +1312,6 @@
...
@@ -1312,5 +1312,6 @@
"com.affine.ai.login-required.dialog-content"
:
"To use AFFiNE AI, please sign in to your AFFiNE Cloud account."
,
"com.affine.ai.login-required.dialog-content"
:
"To use AFFiNE AI, please sign in to your AFFiNE Cloud account."
,
"com.affine.ai.login-required.dialog-confirm"
:
"Sign in"
,
"com.affine.ai.login-required.dialog-confirm"
:
"Sign in"
,
"com.affine.ai.login-required.dialog-cancel"
:
"Cancel"
,
"com.affine.ai.login-required.dialog-cancel"
:
"Cancel"
,
"com.affine.ai.action.edgeless-only.dialog-title"
:
"Please switch to edgeless mode"
"com.affine.ai.action.edgeless-only.dialog-title"
:
"Please switch to edgeless mode"
,
"com.affine.workspace.enable-cloud.failed"
:
"Failed to enable Cloud, please try again."
}
}
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать