mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-26 23:53:21 +03:00
Home button
This commit is contained in:
parent
94296e7dd8
commit
a4fbb1b4c5
@ -89,6 +89,8 @@ const SettingsIcon = (props) => {
|
|||||||
const newSelected = await subscriptionManager.first(); // May be undefined
|
const newSelected = await subscriptionManager.first(); // May be undefined
|
||||||
if (newSelected) {
|
if (newSelected) {
|
||||||
navigate(subscriptionRoute(newSelected));
|
navigate(subscriptionRoute(newSelected));
|
||||||
|
} else {
|
||||||
|
navigate("/");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import {subscriptionRoute} from "../app/utils";
|
|||||||
// TODO support unsubscribed routes
|
// TODO support unsubscribed routes
|
||||||
// TODO add "home" route that is selected when nothing else fits
|
// TODO add "home" route that is selected when nothing else fits
|
||||||
// TODO new notification indicator
|
// TODO new notification indicator
|
||||||
// TODO sound autoplay error warning
|
|
||||||
// TODO "copy url" toast
|
// TODO "copy url" toast
|
||||||
// TODO "copy link url" button
|
// TODO "copy link url" button
|
||||||
// TODO races when two tabs are open
|
// TODO races when two tabs are open
|
||||||
@ -49,6 +48,7 @@ const Root = () => {
|
|||||||
const subscriptions = useLiveQuery(() => subscriptionManager.all());
|
const subscriptions = useLiveQuery(() => subscriptionManager.all());
|
||||||
const selectedSubscription = findSelected(location, subscriptions);
|
const selectedSubscription = findSelected(location, subscriptions);
|
||||||
|
|
||||||
|
console.log(window.location);
|
||||||
const handleSubscribeSubmit = async (subscription) => {
|
const handleSubscribeSubmit = async (subscription) => {
|
||||||
console.log(`[App] New subscription: ${subscription.id}`, subscription);
|
console.log(`[App] New subscription: ${subscription.id}`, subscription);
|
||||||
navigate(subscriptionRoute(subscription));
|
navigate(subscriptionRoute(subscription));
|
||||||
@ -148,6 +148,24 @@ const findSelected = (location, subscriptions) => {
|
|||||||
}
|
}
|
||||||
const [subscription] = subscriptions.filter(s => location.pathname === subscriptionRoute(s));
|
const [subscription] = subscriptions.filter(s => location.pathname === subscriptionRoute(s));
|
||||||
return subscription;
|
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;
|
export default App;
|
||||||
|
@ -9,6 +9,7 @@ import Toolbar from "@mui/material/Toolbar";
|
|||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import List from "@mui/material/List";
|
import List from "@mui/material/List";
|
||||||
import SettingsIcon from "@mui/icons-material/Settings";
|
import SettingsIcon from "@mui/icons-material/Settings";
|
||||||
|
import HomeIcon from '@mui/icons-material/Home';
|
||||||
import AddIcon from "@mui/icons-material/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
import SubscribeDialog from "./SubscribeDialog";
|
import SubscribeDialog from "./SubscribeDialog";
|
||||||
import {Alert, AlertTitle, CircularProgress, ListSubheader} from "@mui/material";
|
import {Alert, AlertTitle, CircularProgress, ListSubheader} from "@mui/material";
|
||||||
@ -86,6 +87,10 @@ const NavList = (props) => {
|
|||||||
/>
|
/>
|
||||||
<Divider sx={{my: 1}}/>
|
<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"}>
|
<ListItemButton onClick={() => navigate("/settings")} selected={location.pathname === "/settings"}>
|
||||||
<ListItemIcon><SettingsIcon/></ListItemIcon>
|
<ListItemIcon><SettingsIcon/></ListItemIcon>
|
||||||
<ListItemText primary="Settings"/>
|
<ListItemText primary="Settings"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user