Skip to content

Commit

Permalink
feat(extension): Add optional login element to AppRouter
Browse files Browse the repository at this point in the history
- Update AppRouter to accept an optional loginElement prop
- Modify floating sphere content script to provide an empty login div
- Enhance routing flexibility for login page rendering
  • Loading branch information
pftom committed Feb 2, 2025
1 parent 8e589f5 commit c43f53b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export default defineContentScript({
}}
>
<MemoryRouter>
<AppRouter loadingElement={<div />}>
<AppRouter loadingElement={<div />} loginElement={<div />}>
<Route path="/" element={<App />} />
<Route path="/login" element={<App />} />
<Route path="/login" element={<div />} />
</AppRouter>
</MemoryRouter>
</ConfigProvider>,
Expand Down
3 changes: 2 additions & 1 deletion apps/extension/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SuspenseLoading } from '@refly-packages/ai-workspace-common/components/
export const AppRouter = (props: {
children: React.ReactNode;
loadingElement?: React.ReactNode;
loginElement?: React.ReactNode;
}) => {
const userStore = useUserStore((state) => ({
localSettings: state.localSettings,
Expand Down Expand Up @@ -45,7 +46,7 @@ export const AppRouter = (props: {
if (!userStore.userProfile) {
return (
<Routes>
<Route path="*" element={<Login />} />
<Route path="*" element={props.loginElement || <Login />} />
</Routes>
);
}
Expand Down

0 comments on commit c43f53b

Please sign in to comment.