Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd4ca160

Browse files
committed
Revert "conditionally hide push notification button"
This reverts commitaf7b58f.
1 parentd27f4dd commitd4ca160

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

‎site/src/contexts/usePushNotifications.ts‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useQuery } from "react-query";
77
interfacePushNotifications{
88
readonlysubscribed:boolean;
99
readonlyloading:boolean;
10-
readonlyenabled: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-
constenabled=!!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"inwindow)||!("serviceWorker"innavigator)){
@@ -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‎

Lines changed: 7 additions & 7 deletions
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
<NavItemsclassName="ml-4"/>
6161

62-
{enabled&&(
63-
subscribed ?(
64-
<buttononClick={unsubscribe}>Unsubscribe</button>
65-
) :(
66-
<buttononClick={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
<divclassName=" hidden md:flex items-center gap-3 ml-auto">
7171
{proxyContextValue&&(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp