File tree Expand file tree Collapse file tree 5 files changed +33
-24
lines changed Expand file tree Collapse file tree 5 files changed +33
-24
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export default function Peers() {
22
22
return (
23
23
< PageContainer >
24
24
{ permission ?. dashboard_view === "blocked" ? (
25
- < PeersDefaultView />
25
+ < PeersBlockedView />
26
26
) : (
27
27
< PeersView />
28
28
) }
@@ -82,11 +82,11 @@ function PeersView() {
82
82
) ;
83
83
}
84
84
85
- function PeersDefaultView ( ) {
85
+ function PeersBlockedView ( ) {
86
86
return (
87
87
< div className = { "flex items-center justify-center flex-col" } >
88
88
< div className = { "p-default py-6 max-w-3xl text-center" } >
89
- < h1 > Add new peer to your network</ h1 >
89
+ < h1 > Add new device to your network</ h1 >
90
90
< Paragraph className = { "inline" } >
91
91
To get started, install NetBird and log in using your email account.
92
92
After that you should be connected. If you have further questions
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export default function UserDropdown() {
36
36
useHotkeys ( "shift+mod+l" , ( ) => logout ( ) , [ ] ) ;
37
37
38
38
const [ dropdownOpen , setDropdownOpen ] = useState ( false ) ;
39
+ const { permission } = useLoggedInUser ( ) ;
39
40
40
41
return (
41
42
< DropdownMenu
@@ -67,19 +68,23 @@ export default function UserDropdown() {
67
68
</ DropdownMenuLabel >
68
69
69
70
< DropdownMenuSeparator />
70
- < DropdownMenuItem
71
- onClick = { ( ) => {
72
- setDropdownOpen ( false ) ;
73
- if ( loggedInUser ) {
74
- router . push ( `/team/user?id=${ loggedInUser . id } ` ) ;
75
- }
76
- } }
77
- >
78
- < div className = { "flex gap-3 items-center" } >
79
- < User2 size = { 14 } />
80
- Profile Settings
81
- </ div >
82
- </ DropdownMenuItem >
71
+
72
+ { permission . dashboard_view !== "blocked" && (
73
+ < DropdownMenuItem
74
+ onClick = { ( ) => {
75
+ setDropdownOpen ( false ) ;
76
+ if ( loggedInUser ) {
77
+ router . push ( `/team/user?id=${ loggedInUser . id } ` ) ;
78
+ }
79
+ } }
80
+ >
81
+ < div className = { "flex gap-3 items-center" } >
82
+ < User2 size = { 14 } />
83
+ Profile Settings
84
+ </ div >
85
+ </ DropdownMenuItem >
86
+ ) }
87
+
83
88
< DropdownMenuItem onClick = { logoutSession } >
84
89
< div className = { "flex gap-3 items-center" } >
85
90
< LogOutIcon size = { 14 } />
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { AnnouncementVariant } from "@components/ui/AnnouncementBanner";
2
2
import { useLocalStorage } from "@hooks/useLocalStorage" ;
3
3
import md5 from "crypto-js/md5" ;
4
4
import React , { useEffect , useState } from "react" ;
5
+ import { useLoggedInUser } from "@/contexts/UsersProvider" ;
5
6
6
7
const initialAnnouncements : Announcement [ ] = [ ] ;
7
8
@@ -39,8 +40,10 @@ export default function AnnouncementProvider({ children }: Props) {
39
40
string [ ]
40
41
> ( "netbird-closed-announcements" , [ ] ) ;
41
42
const [ announcements , setAnnouncements ] = useState < AnnouncementInfo [ ] > ( ) ;
43
+ const { permission } = useLoggedInUser ( ) ;
42
44
43
45
useEffect ( ( ) => {
46
+ if ( permission ?. dashboard_view === "blocked" ) return ;
44
47
const initial = initialAnnouncements . map ( ( announcement ) => {
45
48
const hash = md5 ( announcement . text ) . toString ( ) ;
46
49
const isOpen = ! closedAnnouncements . some ( ( h ) => h === hash ) ;
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import React from "react";
11
11
import { Toaster } from "react-hot-toast" ;
12
12
import OIDCProvider from "@/auth/OIDCProvider" ;
13
13
import AnalyticsProvider from "@/contexts/AnalyticsProvider" ;
14
- import AnnouncementProvider from "@/contexts/AnnouncementProvider" ;
15
14
import DialogProvider from "@/contexts/DialogProvider" ;
16
15
import ErrorBoundaryProvider from "@/contexts/ErrorBoundary" ;
17
16
import { GlobalThemeProvider } from "@/contexts/GlobalThemeProvider" ;
@@ -36,11 +35,9 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
36
35
< GlobalThemeProvider >
37
36
< ErrorBoundaryProvider >
38
37
< OIDCProvider >
39
- < AnnouncementProvider >
40
- < TooltipProvider delayDuration = { 0 } >
41
- { children }
42
- </ TooltipProvider >
43
- </ AnnouncementProvider >
38
+ < TooltipProvider delayDuration = { 0 } >
39
+ { children }
40
+ </ TooltipProvider >
44
41
</ OIDCProvider >
45
42
</ ErrorBoundaryProvider >
46
43
</ GlobalThemeProvider >
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ import { useIsSm, useIsXs } from "@utils/responsive";
9
9
import { AnimatePresence , motion } from "framer-motion" ;
10
10
import { XIcon } from "lucide-react" ;
11
11
import React from "react" ;
12
- import { useAnnouncement } from "@/contexts/AnnouncementProvider" ;
12
+ import AnnouncementProvider , {
13
+ useAnnouncement ,
14
+ } from "@/contexts/AnnouncementProvider" ;
13
15
import ApplicationProvider , {
14
16
useApplicationContext ,
15
17
} from "@/contexts/ApplicationProvider" ;
@@ -29,7 +31,9 @@ export default function DashboardLayout({
29
31
< UsersProvider >
30
32
< GroupsProvider >
31
33
< CountryProvider >
32
- < DashboardPageContent > { children } </ DashboardPageContent >
34
+ < AnnouncementProvider >
35
+ < DashboardPageContent > { children } </ DashboardPageContent >
36
+ </ AnnouncementProvider >
33
37
</ CountryProvider >
34
38
</ GroupsProvider >
35
39
</ UsersProvider >
You can’t perform that action at this time.
0 commit comments