@@ -13,13 +13,14 @@ import EventNoteIcon from '@mui/icons-material/EventNote';
13
13
import EventNoteOutlinedIcon from '@mui/icons-material/EventNoteOutlined' ;
14
14
import FormatPaintIcon from '@mui/icons-material/FormatPaint' ;
15
15
import FormatPaintOutlinedIcon from '@mui/icons-material/FormatPaintOutlined' ;
16
+ import ImageIcon from '@mui/icons-material/Image' ;
17
+ import ImageOutlinedIcon from '@mui/icons-material/ImageOutlined' ;
18
+ import IosShareIcon from '@mui/icons-material/IosShare' ;
19
+ import IosShareOutlinedIcon from '@mui/icons-material/IosShareOutlined' ;
16
20
import TextsmsIcon from '@mui/icons-material/Textsms' ;
17
21
import TextsmsOutlinedIcon from '@mui/icons-material/TextsmsOutlined' ;
18
22
import WorkspacesIcon from '@mui/icons-material/Workspaces' ;
19
23
import WorkspacesOutlinedIcon from '@mui/icons-material/WorkspacesOutlined' ;
20
- // Automatic apps
21
- import ImageOutlinedIcon from '@mui/icons-material/ImageOutlined' ;
22
- import IosShareIcon from '@mui/icons-material/IosShare' ;
23
24
// Link icons
24
25
import GitHubIcon from '@mui/icons-material/GitHub' ;
25
26
import { DiscordIcon } from '~/common/components/icons/DiscordIcon' ;
@@ -29,11 +30,14 @@ import SettingsIcon from '@mui/icons-material/Settings';
29
30
30
31
31
32
import { Brand } from '~/common/app.config' ;
33
+ import { hasNoChatLinkItems } from '~/modules/trade/chatlink/store-chatlink' ;
32
34
33
35
34
36
// enable to show all items, for layout development
35
37
const SHOW_ALL_APPS = false ;
36
38
39
+ const SPECIAL_DIVIDER = '__DIVIDER__' ;
40
+
37
41
38
42
// Nav items
39
43
@@ -47,12 +51,14 @@ interface ItemBase {
47
51
export interface NavItemApp extends ItemBase {
48
52
type : 'app' ,
49
53
route : string ,
54
+ landingRoute ?: string , // specify a different route than the nextjs page router route, to land to
50
55
barTitle ?: string , // set to override the name as the bar title (unless custom bar content is used)
56
+ hideIcon ?: boolean
57
+ | ( ( ) => boolean ) , // set to true to hide the icon, unless this is the active app
51
58
hideBar ?: boolean , // set to true to hide the page bar
52
59
hideDrawer ?: boolean , // set to true to hide the drawer
53
- hideNav ?: boolean , // set to hide the Nav bar (note: must have a way to navigate back)
54
- hideOnMobile ?: boolean , // set to true to hide on mobile
55
- automatic ?: boolean , // only accessible by the machine
60
+ hideNav ?: boolean
61
+ | ( ( ) => boolean ) , // set to hide the Nav bar (note: must have a way to navigate back)
56
62
fullWidth ?: boolean , // set to true to override the user preference
57
63
_delete ?: boolean , // delete from the UI
58
64
}
@@ -131,6 +137,13 @@ export const navItems: {
131
137
route : '/workspace' ,
132
138
_delete : true ,
133
139
} ,
140
+ // <-- divider here -->
141
+ {
142
+ name : SPECIAL_DIVIDER ,
143
+ type : 'app' ,
144
+ route : SPECIAL_DIVIDER ,
145
+ icon : ( ) => null ,
146
+ } ,
134
147
{
135
148
name : 'Personas' ,
136
149
icon : Diversity2OutlinedIcon ,
@@ -139,33 +152,32 @@ export const navItems: {
139
152
route : '/personas' ,
140
153
hideBar : true ,
141
154
} ,
142
- {
143
- name : 'News' ,
144
- icon : EventNoteOutlinedIcon ,
145
- iconActive : EventNoteIcon ,
146
- type : 'app' ,
147
- route : '/news' ,
148
- hideBar : true ,
149
- hideDrawer : true ,
150
- } ,
151
-
152
- // non-user-selectable ('automatic') Apps
153
155
{
154
156
name : 'Media Library' ,
155
157
icon : ImageOutlinedIcon ,
158
+ iconActive : ImageIcon ,
156
159
type : 'app' ,
157
160
route : '/media' ,
158
- automatic : true ,
159
- hideNav : true ,
160
161
_delete : true ,
161
162
} ,
162
163
{
163
164
name : 'Shared Chat' ,
164
- icon : IosShareIcon ,
165
+ icon : IosShareOutlinedIcon ,
166
+ iconActive : IosShareIcon ,
165
167
type : 'app' ,
166
168
route : '/link/chat/[chatLinkId]' ,
167
- automatic : true ,
168
- hideNav : true ,
169
+ landingRoute : '/link/chat/list' ,
170
+ hideIcon : hasNoChatLinkItems ,
171
+ hideNav : hasNoChatLinkItems ,
172
+ } ,
173
+ {
174
+ name : 'News' ,
175
+ icon : EventNoteOutlinedIcon ,
176
+ iconActive : EventNoteIcon ,
177
+ type : 'app' ,
178
+ route : '/news' ,
179
+ hideBar : true ,
180
+ hideDrawer : true ,
169
181
} ,
170
182
] ,
171
183
@@ -210,4 +222,16 @@ export const navItems: {
210
222
} ;
211
223
212
224
// apply UI filtering right away - do it here, once, and for all
213
- navItems . apps = navItems . apps . filter ( app => ! app . _delete || SHOW_ALL_APPS ) ;
225
+ navItems . apps = navItems . apps . filter ( app => ! app . _delete || SHOW_ALL_APPS ) ;
226
+
227
+ export function checkDivider ( app ?: NavItemApp ) {
228
+ return app ?. name === SPECIAL_DIVIDER ;
229
+ }
230
+
231
+ export function checkVisibileIcon ( app : NavItemApp , currentApp ?: NavItemApp ) {
232
+ return app === currentApp ? true : typeof app . hideIcon === 'function' ? ! app . hideIcon ( ) : ! app . hideIcon ;
233
+ }
234
+
235
+ export function checkVisibleNav ( app ?: NavItemApp ) {
236
+ return ! app ? false : typeof app . hideNav === 'function' ? ! app . hideNav ( ) : ! app . hideNav ;
237
+ }
0 commit comments