diff --git a/web/src/components/ActionBar.js b/web/src/components/ActionBar.js index 994cd4e..88e36dc 100644 --- a/web/src/components/ActionBar.js +++ b/web/src/components/ActionBar.js @@ -89,6 +89,8 @@ const SettingsIcon = (props) => { const newSelected = await subscriptionManager.first(); // May be undefined if (newSelected) { navigate(subscriptionRoute(newSelected)); + } else { + navigate("/"); } }; diff --git a/web/src/components/App.js b/web/src/components/App.js index 61fbf18..fa09c82 100644 --- a/web/src/components/App.js +++ b/web/src/components/App.js @@ -23,7 +23,6 @@ import {subscriptionRoute} from "../app/utils"; // TODO support unsubscribed routes // TODO add "home" route that is selected when nothing else fits // TODO new notification indicator -// TODO sound autoplay error warning // TODO "copy url" toast // TODO "copy link url" button // TODO races when two tabs are open @@ -49,6 +48,7 @@ const Root = () => { const subscriptions = useLiveQuery(() => subscriptionManager.all()); const selectedSubscription = findSelected(location, subscriptions); + console.log(window.location); const handleSubscribeSubmit = async (subscription) => { console.log(`[App] New subscription: ${subscription.id}`, subscription); navigate(subscriptionRoute(subscription)); @@ -148,6 +148,24 @@ const findSelected = (location, subscriptions) => { } const [subscription] = subscriptions.filter(s => location.pathname === subscriptionRoute(s)); return subscription; + + /* + if (location.pathname === "/" || location.pathname === "/settings") { + return null; + } + if (!subscription) { + const [, topic] = location.pathname.split("/"); + const subscription = { + id: topicUrl(window.location.origin, topic), + baseUrl: window.location.origin, + topic: topic, + last: "" + } + subscriptionManager.save(subscription); + return subscription; + } + + */ }; export default App; diff --git a/web/src/components/Navigation.js b/web/src/components/Navigation.js index c8f9fd5..ee251a9 100644 --- a/web/src/components/Navigation.js +++ b/web/src/components/Navigation.js @@ -9,6 +9,7 @@ import Toolbar from "@mui/material/Toolbar"; import Divider from "@mui/material/Divider"; import List from "@mui/material/List"; import SettingsIcon from "@mui/icons-material/Settings"; +import HomeIcon from '@mui/icons-material/Home'; import AddIcon from "@mui/icons-material/Add"; import SubscribeDialog from "./SubscribeDialog"; import {Alert, AlertTitle, CircularProgress, ListSubheader} from "@mui/material"; @@ -86,6 +87,10 @@ const NavList = (props) => { /> } + navigate("/")} selected={location.pathname === "/"}> + + + navigate("/settings")} selected={location.pathname === "/settings"}>