mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-22 19:33:27 +01:00
Home button
This commit is contained in:
parent
94296e7dd8
commit
a4fbb1b4c5
3 changed files with 26 additions and 1 deletions
|
@ -89,6 +89,8 @@ const SettingsIcon = (props) => {
|
|||
const newSelected = await subscriptionManager.first(); // May be undefined
|
||||
if (newSelected) {
|
||||
navigate(subscriptionRoute(newSelected));
|
||||
} else {
|
||||
navigate("/");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) => {
|
|||
/>
|
||||
<Divider sx={{my: 1}}/>
|
||||
</>}
|
||||
<ListItemButton onClick={() => navigate("/")} selected={location.pathname === "/"}>
|
||||
<ListItemIcon><HomeIcon/></ListItemIcon>
|
||||
<ListItemText primary="Home"/>
|
||||
</ListItemButton>
|
||||
<ListItemButton onClick={() => navigate("/settings")} selected={location.pathname === "/settings"}>
|
||||
<ListItemIcon><SettingsIcon/></ListItemIcon>
|
||||
<ListItemText primary="Settings"/>
|
||||
|
|
Loading…
Reference in a new issue