From 16916db24761c5fa583dfd749a9323712e7b7684 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Tue, 21 Nov 2023 22:17:17 -0800 Subject: [PATCH] Improve routing, and move the action pwa action receiver --- pages/{launch.tsx => link/share_target.tsx} | 13 +++++++------ public/manifest.json | 2 +- src/apps/chat/components/composer/Composer.tsx | 2 +- src/apps/link/AppChatLinkDrawerItems.tsx | 4 ++-- src/apps/news/AppNews.tsx | 4 ++-- src/common/app.routes.ts | 15 +++++++++++---- 6 files changed, 24 insertions(+), 16 deletions(-) rename pages/{launch.tsx => link/share_target.tsx} (91%) diff --git a/pages/launch.tsx b/pages/link/share_target.tsx similarity index 91% rename from pages/launch.tsx rename to pages/link/share_target.tsx index a25fbf174..6f05c4000 100644 --- a/pages/launch.tsx +++ b/pages/link/share_target.tsx @@ -4,11 +4,12 @@ import { useRouter } from 'next/router'; import { Alert, Box, Button, Typography } from '@mui/joy'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; -import { setComposerStartupText } from '../src/apps/chat/components/composer/store-composer'; +import { setComposerStartupText } from '../../src/apps/chat/components/composer/store-composer'; import { AppLayout } from '~/common/layout/AppLayout'; import { LogoProgress } from '~/common/components/LogoProgress'; import { asValidURL } from '~/common/util/urlUtils'; +import { navigateToIndex } from '~/common/app.routes'; /** @@ -28,13 +29,13 @@ function AppShareTarget() { const [isDownloading, setIsDownloading] = React.useState(false); // external state - const { query, push: routerPush, replace: routerReplace } = useRouter(); + const { query } = useRouter(); const queueComposerTextAndLaunchApp = React.useCallback((text: string) => { setComposerStartupText(text); - void routerReplace('/'); - }, [routerReplace]); + void navigateToIndex(true); + }, []); // Detect the share Intent from the query @@ -110,7 +111,7 @@ function AppShareTarget() {