Skip to content

Commit 4408090

Browse files
committed
Revert "conditionally hide push notification button"
This reverts commit af7b58f.
1 parent 46f7519 commit 4408090

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

site/src/contexts/usePushNotifications.ts

-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useQuery } from "react-query";
77
interface PushNotifications {
88
readonly subscribed: boolean;
99
readonly loading: boolean;
10-
readonly enabled: boolean;
1110

1211
subscribe(): Promise<void>;
1312
unsubscribe(): Promise<void>;
@@ -20,17 +19,6 @@ export const usePushNotifications = (): PushNotifications => {
2019
const [subscribed, setSubscribed] = useState<boolean>(false);
2120
const [loading, setLoading] = useState<boolean>(true);
2221

23-
// Disable push notifications if the server is not configured to send them.
24-
const enabled = !!buildInfoQuery.data?.push_notifications_public_key;
25-
if (!enabled) {
26-
return {
27-
enabled: false,
28-
subscribed: false,
29-
loading: false,
30-
subscribe: async () => {},
31-
unsubscribe: async () => {},
32-
};
33-
}
3422
useEffect(() => {
3523
// Check if browser supports push notifications
3624
if (!("Notification" in window) || !("serviceWorker" in navigator)) {
@@ -107,7 +95,6 @@ export const usePushNotifications = (): PushNotifications => {
10795
};
10896

10997
return {
110-
enabled,
11198
subscribed,
11299
loading: loading || buildInfoQuery.isLoading,
113100
subscribe,

site/src/modules/dashboard/Navbar/NavbarView.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const NavbarView: FC<NavbarViewProps> = ({
4444
canViewAuditLog,
4545
proxyContextValue,
4646
}) => {
47-
const { enabled, subscribed, loading, subscribe, unsubscribe } =
47+
const { subscribed, loading, subscribe, unsubscribe } =
4848
usePushNotifications();
4949

5050
return (
@@ -59,13 +59,13 @@ export const NavbarView: FC<NavbarViewProps> = ({
5959

6060
<NavItems className="ml-4" />
6161

62-
{enabled && (
63-
subscribed ? (
64-
<button onClick={unsubscribe}>Unsubscribe</button>
65-
) : (
66-
<button onClick={subscribe}>Subscribe</button>
67-
)
62+
{/* // TODO: styling required here.
63+
{subscribed ? (
64+
<button onClick={unsubscribe}>Unsubscribe</button>
65+
) : (
66+
<button onClick={subscribe}>Subscribe</button>
6867
)}
68+
*/}
6969

7070
<div className=" hidden md:flex items-center gap-3 ml-auto">
7171
{proxyContextValue && (

0 commit comments

Comments
 (0)