mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
feat(console): add interactionMode qs to AC (#3522)
This commit is contained in:
parent
ee3135a536
commit
10dca5891b
4 changed files with 56 additions and 7 deletions
|
@ -24,7 +24,7 @@
|
|||
"@logto/language-kit": "workspace:*",
|
||||
"@logto/phrases": "workspace:*",
|
||||
"@logto/phrases-ui": "workspace:*",
|
||||
"@logto/react": "1.0.0",
|
||||
"@logto/react": "1.1.0",
|
||||
"@logto/schemas": "workspace:*",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"@microsoft/applicationinsights-react-js": "^3.4.1",
|
||||
|
|
|
@ -10,3 +10,7 @@ export const appearanceModeStorageKey = 'logto:admin_console:appearance_mode';
|
|||
export const profileSocialLinkingKeyPrefix = 'logto:admin_console:linking_social_connector';
|
||||
export const requestTimeout = 20_000;
|
||||
export const defaultPageSize = 20;
|
||||
|
||||
export enum searchKeys {
|
||||
signUp = 'sign_up',
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { LogtoClientError, LogtoError, useLogto } from '@logto/react';
|
||||
import { conditional } from '@silverhand/essentials';
|
||||
import { conditional, yes } from '@silverhand/essentials';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Outlet, useHref, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Outlet, useHref, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import AppError from '@/components/AppError';
|
||||
import AppLoading from '@/components/AppLoading';
|
||||
import SessionExpired from '@/components/SessionExpired';
|
||||
import { searchKeys } from '@/consts';
|
||||
import { isCloud } from '@/consts/cloud';
|
||||
import useConfigs from '@/hooks/use-configs';
|
||||
import useScroll from '@/hooks/use-scroll';
|
||||
|
@ -29,6 +30,7 @@ const AppContent = () => {
|
|||
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [searchParameters] = useSearchParams();
|
||||
const { firstItem } = useSidebarMenuItems();
|
||||
const scrollableContent = useRef<HTMLDivElement>(null);
|
||||
const { scrollTop } = useScroll(scrollableContent.current);
|
||||
|
@ -36,9 +38,14 @@ const AppContent = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated && !isLogtoLoading) {
|
||||
void signIn(new URL(href, window.location.origin).toString());
|
||||
const signUpFirst = searchParameters.get(searchKeys.signUp);
|
||||
|
||||
void signIn(
|
||||
new URL(href, window.location.origin).toString(),
|
||||
conditional(yes(signUpFirst) && 'signUp')
|
||||
);
|
||||
}
|
||||
}, [href, isAuthenticated, isLogtoLoading, signIn]);
|
||||
}, [href, isAuthenticated, isLogtoLoading, searchParameters, signIn]);
|
||||
|
||||
useEffect(() => {
|
||||
// Navigate to the first menu item after configs are loaded.
|
||||
|
|
|
@ -187,7 +187,7 @@ importers:
|
|||
'@logto/language-kit': workspace:*
|
||||
'@logto/phrases': workspace:*
|
||||
'@logto/phrases-ui': workspace:*
|
||||
'@logto/react': 1.0.0
|
||||
'@logto/react': 1.1.0
|
||||
'@logto/schemas': workspace:*
|
||||
'@mdx-js/react': ^1.6.22
|
||||
'@microsoft/applicationinsights-react-js': ^3.4.1
|
||||
|
@ -267,7 +267,7 @@ importers:
|
|||
'@logto/language-kit': link:../toolkit/language-kit
|
||||
'@logto/phrases': link:../phrases
|
||||
'@logto/phrases-ui': link:../phrases-ui
|
||||
'@logto/react': 1.0.0_react@18.2.0
|
||||
'@logto/react': 1.1.0_react@18.2.0
|
||||
'@logto/schemas': link:../schemas
|
||||
'@mdx-js/react': 1.6.22_react@18.2.0
|
||||
'@microsoft/applicationinsights-react-js': 3.4.1_ru3n4sc2jwbij7oomq3xpksl5a
|
||||
|
@ -2485,6 +2485,14 @@ packages:
|
|||
js-base64: 3.7.4
|
||||
dev: true
|
||||
|
||||
/@logto/browser/1.1.0:
|
||||
resolution: {integrity: sha512-0NpRVM+D1d4bCwpQb0OcgE6cKKwLevqdMCBjVLlosi527ydMa25X3cEuvRw+bojxSF3QfS/Ig9GktS7xvUAnCg==}
|
||||
dependencies:
|
||||
'@logto/client': 1.1.0
|
||||
'@silverhand/essentials': 1.3.0
|
||||
js-base64: 3.7.4
|
||||
dev: true
|
||||
|
||||
/@logto/client/1.0.0:
|
||||
resolution: {integrity: sha512-80tqgNdZRT9hmxznpkpb1UjOdtBO5FMyFU2GYvym5j6zCTQxi3dGXlgNRzOUDX2sHM1PqkUvsVM2IzgMGGNjvg==}
|
||||
dependencies:
|
||||
|
@ -2496,6 +2504,17 @@ packages:
|
|||
lodash.once: 4.1.1
|
||||
dev: true
|
||||
|
||||
/@logto/client/1.1.0:
|
||||
resolution: {integrity: sha512-HdUuH6vwbKzhLoa7JgWu85CMTU8a7lux9Uadv5yitMaJMEsYERUU0SntQC8jZ7K5/Ktc8r/3kbfo0MKyFNffMA==}
|
||||
dependencies:
|
||||
'@logto/js': 1.1.0
|
||||
'@silverhand/essentials': 1.3.0
|
||||
camelcase-keys: 7.0.2
|
||||
jose: 4.11.1
|
||||
lodash.get: 4.4.2
|
||||
lodash.once: 4.1.1
|
||||
dev: true
|
||||
|
||||
/@logto/js/1.0.0:
|
||||
resolution: {integrity: sha512-brhyDIIDzIpsvcvQZHWjiYknKO//py3YnxfdWx9P1OkcyF1iIAiYv0o25/XXzfsb3XS0TkP1FdvLhLp/LDLz5g==}
|
||||
dependencies:
|
||||
|
@ -2505,6 +2524,15 @@ packages:
|
|||
lodash.get: 4.4.2
|
||||
dev: true
|
||||
|
||||
/@logto/js/1.1.0:
|
||||
resolution: {integrity: sha512-YW8ou7DifY0T9Pfli3sZG9sdm5UbINcHEi9pkj6pGxVUX5lBWRxT+ZWGgOsRl4KtrPXzg9ivAAJHzyPRwZAf7g==}
|
||||
dependencies:
|
||||
'@silverhand/essentials': 1.3.0
|
||||
camelcase-keys: 7.0.2
|
||||
jose: 4.11.1
|
||||
lodash.get: 4.4.2
|
||||
dev: true
|
||||
|
||||
/@logto/node/1.0.0:
|
||||
resolution: {integrity: sha512-I/sC+JKbmJiufBXmqWFYpp+bpYHb15hoiieexzIDbsaoosQjHjSdAwqQjz6w60e2yQuWvxctP7Cc44L0BVgaSQ==}
|
||||
dependencies:
|
||||
|
@ -2526,6 +2554,16 @@ packages:
|
|||
react: 18.2.0
|
||||
dev: true
|
||||
|
||||
/@logto/react/1.1.0_react@18.2.0:
|
||||
resolution: {integrity: sha512-uz7kevuDVd9CMXVhQ3Mt7eVcV0a5Ghcmn6YabS6Sjv9kJCmpRHXGJrVHP4mah+vSEUGirGtoKLVNE8kyPdDVIA==}
|
||||
peerDependencies:
|
||||
react: '>=16.8.0 || ^18.0.0'
|
||||
dependencies:
|
||||
'@logto/browser': 1.1.0
|
||||
'@silverhand/essentials': 1.3.0
|
||||
react: 18.2.0
|
||||
dev: true
|
||||
|
||||
/@manypkg/find-root/1.1.0:
|
||||
resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==}
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in a new issue