0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

Merge pull request #571 from logto-io/charles-log-1879-logto-loading-state-animation

feat(console): draft logto loading state animation page
This commit is contained in:
Charles Zhao 2022-04-19 11:31:41 +08:00 committed by GitHub
commit 217261e9b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 2 deletions

View file

@ -3,6 +3,7 @@ import React, { useEffect } from 'react';
import { Outlet, useHref } from 'react-router-dom';
import ErrorBoundary from '../ErrorBoundary';
import LogtoLoading from '../LogtoLoading';
import Sidebar from './components/Sidebar';
import Topbar from './components/Topbar';
import * as styles from './index.module.scss';
@ -33,7 +34,7 @@ const AppContent = ({ theme }: Props) => {
}, [href, isAuthenticated, signIn]);
if (!isAuthenticated) {
return <>loading</>;
return <LogtoLoading message="general.loading" />;
}
return (

View file

@ -0,0 +1,14 @@
@use '@/scss/underscore' as _;
.container {
display: flex;
flex-direction: column;
color: var(--color-text);
align-items: center;
overflow: hidden;
img {
height: 300px;
margin: _.unit(25) 0 _.unit(6);
}
}

View file

@ -0,0 +1,24 @@
import { I18nKey } from '@logto/phrases';
import React from 'react';
import { useTranslation } from 'react-i18next';
import highFive from '@/assets/images/high-five.svg';
import * as styles from './index.module.scss';
type Props = {
message: I18nKey;
};
const LogtoLoading = ({ message }: Props) => {
const { t } = useTranslation();
return (
<div className={styles.container}>
<img src={highFive} alt="yeah" />
<p>{t(message)}</p>
</div>
);
};
export default LogtoLoading;

View file

@ -2,6 +2,8 @@ import { useHandleSignInCallback, useLogto } from '@logto/react';
import React, { useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import LogtoLoading from '@/components/LogtoLoading';
const Callback = () => {
const { isAuthenticated, isLoading } = useLogto();
const navigate = useNavigate();
@ -15,7 +17,7 @@ const Callback = () => {
}
}, [isAuthenticated, isLoading, navigate]);
return <p>Redirecting...</p>;
return <LogtoLoading message="general.redirecting" />;
};
export default Callback;

View file

@ -8,6 +8,8 @@ const translation = {
done: 'Done',
search: 'Search',
save_changes: 'Save changes',
loading: 'Loading...',
redirecting: 'Redirecting...',
},
main_flow: {
input: {

View file

@ -10,6 +10,8 @@ const translation = {
done: '完成',
search: '搜索',
save_changes: '保存更改',
loading: '读取中...',
redirecting: '页面跳转中...',
},
main_flow: {
input: {