mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-27 20:22:58 +01:00
Make action bar match theme colour when run as PWA
This commit is contained in:
parent
f78389b6ef
commit
6b4c04c390
2 changed files with 21 additions and 5 deletions
|
@ -19,11 +19,14 @@ import Navigation from "./Navigation";
|
||||||
import accountApi from "../app/AccountApi";
|
import accountApi from "../app/AccountApi";
|
||||||
import PopupMenu from "./PopupMenu";
|
import PopupMenu from "./PopupMenu";
|
||||||
import { SubscriptionPopup } from "./SubscriptionPopup";
|
import { SubscriptionPopup } from "./SubscriptionPopup";
|
||||||
|
import { useIsLaunchedPWA } from "./hooks";
|
||||||
|
|
||||||
const ActionBar = (props) => {
|
const ActionBar = (props) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const isLaunchedPWA = useIsLaunchedPWA();
|
||||||
|
|
||||||
let title = "ntfy";
|
let title = "ntfy";
|
||||||
if (props.selected) {
|
if (props.selected) {
|
||||||
title = topicDisplayName(props.selected);
|
title = topicDisplayName(props.selected);
|
||||||
|
@ -32,6 +35,22 @@ const ActionBar = (props) => {
|
||||||
} else if (location.pathname === routes.account) {
|
} else if (location.pathname === routes.account) {
|
||||||
title = t("action_bar_account");
|
title = t("action_bar_account");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getActionBarBackground = () => {
|
||||||
|
if (isLaunchedPWA) {
|
||||||
|
return "#317f6f";
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (theme.palette.mode) {
|
||||||
|
case "dark":
|
||||||
|
return "linear-gradient(150deg, #203631 0%, #2a6e60 100%)";
|
||||||
|
|
||||||
|
case "light":
|
||||||
|
default:
|
||||||
|
return "linear-gradient(150deg, #338574 0%, #56bda8 100%)";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<AppBar
|
||||||
position="fixed"
|
position="fixed"
|
||||||
|
@ -44,10 +63,7 @@ const ActionBar = (props) => {
|
||||||
<Toolbar
|
<Toolbar
|
||||||
sx={{
|
sx={{
|
||||||
pr: "24px",
|
pr: "24px",
|
||||||
background:
|
background: getActionBarBackground(),
|
||||||
theme.palette.mode === "light"
|
|
||||||
? "linear-gradient(150deg, #338574 0%, #56bda8 100%)"
|
|
||||||
: "linear-gradient(150deg, #203631 0%, #2a6e60 100%)",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|
|
@ -132,7 +132,7 @@ const NavList = (props) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Toolbar sx={{ display: { xs: "none", sm: "block" } }} />
|
<Toolbar sx={{ display: { xs: "none", sm: "block" } }} />
|
||||||
<List component="nav" sx={{ paddingTop: alertVisible ? "0" : "" }}>
|
<List component="nav" sx={{ paddingTop: { xs: 0, sm: alertVisible ? 0 : "" } }}>
|
||||||
{showNotificationPermissionRequired && <NotificationPermissionRequired refreshPermissions={refreshPermissions} />}
|
{showNotificationPermissionRequired && <NotificationPermissionRequired refreshPermissions={refreshPermissions} />}
|
||||||
{showNotificationPermissionDenied && <NotificationPermissionDeniedAlert />}
|
{showNotificationPermissionDenied && <NotificationPermissionDeniedAlert />}
|
||||||
{showNotificationBrowserNotSupportedBox && <NotificationBrowserNotSupportedAlert />}
|
{showNotificationBrowserNotSupportedBox && <NotificationBrowserNotSupportedAlert />}
|
||||||
|
|
Loading…
Reference in a new issue