@@ -28,118 +28,121 @@ import {
2828function Sidebar ( ) {
2929 const { t } = useTranslation ( ) ;
3030
31- const Menus = [
32- {
33- id : "dashboard" ,
34- title : t ( "sidebar.dashboard" ) ,
35- icon : LayoutDashboard ,
36- path : "dashboard" ,
37- } ,
38- {
39- navLabel : true ,
40- title : t ( "sidebar.configurations" ) ,
41- icon : Cog ,
42- children : [
43- {
44- id : "settings" ,
45- title : t ( "sidebar.settings" ) ,
46- path : "settings" ,
47- } ,
48- {
49- id : "proxy" ,
50- title : t ( "sidebar.proxy" ) ,
51- path : "proxy" ,
52- } ,
53- ] ,
54- } ,
55- {
56- title : t ( "sidebar.events" ) ,
57- icon : IterationCcw ,
58- children : [
59- {
60- id : "webhook" ,
61- title : t ( "sidebar.webhook" ) ,
62- path : "webhook" ,
63- } ,
64- {
65- id : "websocket" ,
66- title : t ( "sidebar.websocket" ) ,
67- path : "websocket" ,
68- } ,
69- {
70- id : "rabbitmq" ,
71- title : t ( "sidebar.rabbitmq" ) ,
72- path : "rabbitmq" ,
73- } ,
74- {
75- id : "sqs" ,
76- title : t ( "sidebar.sqs" ) ,
77- path : "sqs" ,
78- } ,
79- ] ,
80- } ,
81- {
82- title : t ( "sidebar.integrations" ) ,
83- icon : Zap ,
84- children : [
85- {
86- id : "evolutionBot" ,
87- title : t ( "sidebar.evolutionBot" ) ,
88- path : "evolutionBot" ,
89- } ,
90- {
91- id : "chatwoot" ,
92- title : t ( "sidebar.chatwoot" ) ,
93- path : "chatwoot" ,
94- } ,
95- {
96- id : "typebot" ,
97- title : t ( "sidebar.typebot" ) ,
98- path : "typebot" ,
99- } ,
100- {
101- id : "openai" ,
102- title : t ( "sidebar.openai" ) ,
103- path : "openai" ,
104- } ,
105- {
106- id : "dify" ,
107- title : t ( "sidebar.dify" ) ,
108- path : "dify" ,
109- } ,
110- {
111- id : "flowise" ,
112- title : t ( "sidebar.flowise" ) ,
113- path : "flowise" ,
114- } ,
115- ] ,
116- } ,
117- {
118- id : "documentation" ,
119- title : t ( "sidebar.documentation" ) ,
120- icon : FileQuestion ,
121- link : "https://doc.evolution-api.com" ,
122- divider : true ,
123- } ,
124- {
125- id : "postman" ,
126- title : t ( "sidebar.postman" ) ,
127- icon : CircleHelp ,
128- link : "https://evolution-api.com/postman" ,
129- } ,
130- {
131- id : "discord" ,
132- title : t ( "sidebar.discord" ) ,
133- icon : MessageCircle ,
134- link : "https://evolution-api.com/discord" ,
135- } ,
136- {
137- id : "support-premium" ,
138- title : t ( "sidebar.supportPremium" ) ,
139- icon : LifeBuoy ,
140- link : "https://evolution-api.com/suporte-pro" ,
141- } ,
142- ] as const ;
31+ const Menus = useMemo (
32+ ( ) => [
33+ {
34+ id : "dashboard" ,
35+ title : t ( "sidebar.dashboard" ) ,
36+ icon : LayoutDashboard ,
37+ path : "dashboard" ,
38+ } ,
39+ {
40+ navLabel : true ,
41+ title : t ( "sidebar.configurations" ) ,
42+ icon : Cog ,
43+ children : [
44+ {
45+ id : "settings" ,
46+ title : t ( "sidebar.settings" ) ,
47+ path : "settings" ,
48+ } ,
49+ {
50+ id : "proxy" ,
51+ title : t ( "sidebar.proxy" ) ,
52+ path : "proxy" ,
53+ } ,
54+ ] ,
55+ } ,
56+ {
57+ title : t ( "sidebar.events" ) ,
58+ icon : IterationCcw ,
59+ children : [
60+ {
61+ id : "webhook" ,
62+ title : t ( "sidebar.webhook" ) ,
63+ path : "webhook" ,
64+ } ,
65+ {
66+ id : "websocket" ,
67+ title : t ( "sidebar.websocket" ) ,
68+ path : "websocket" ,
69+ } ,
70+ {
71+ id : "rabbitmq" ,
72+ title : t ( "sidebar.rabbitmq" ) ,
73+ path : "rabbitmq" ,
74+ } ,
75+ {
76+ id : "sqs" ,
77+ title : t ( "sidebar.sqs" ) ,
78+ path : "sqs" ,
79+ } ,
80+ ] ,
81+ } ,
82+ {
83+ title : t ( "sidebar.integrations" ) ,
84+ icon : Zap ,
85+ children : [
86+ {
87+ id : "evolutionBot" ,
88+ title : t ( "sidebar.evolutionBot" ) ,
89+ path : "evolutionBot" ,
90+ } ,
91+ {
92+ id : "chatwoot" ,
93+ title : t ( "sidebar.chatwoot" ) ,
94+ path : "chatwoot" ,
95+ } ,
96+ {
97+ id : "typebot" ,
98+ title : t ( "sidebar.typebot" ) ,
99+ path : "typebot" ,
100+ } ,
101+ {
102+ id : "openai" ,
103+ title : t ( "sidebar.openai" ) ,
104+ path : "openai" ,
105+ } ,
106+ {
107+ id : "dify" ,
108+ title : t ( "sidebar.dify" ) ,
109+ path : "dify" ,
110+ } ,
111+ {
112+ id : "flowise" ,
113+ title : t ( "sidebar.flowise" ) ,
114+ path : "flowise" ,
115+ } ,
116+ ] ,
117+ } ,
118+ {
119+ id : "documentation" ,
120+ title : t ( "sidebar.documentation" ) ,
121+ icon : FileQuestion ,
122+ link : "https://doc.evolution-api.com" ,
123+ divider : true ,
124+ } ,
125+ {
126+ id : "postman" ,
127+ title : t ( "sidebar.postman" ) ,
128+ icon : CircleHelp ,
129+ link : "https://evolution-api.com/postman" ,
130+ } ,
131+ {
132+ id : "discord" ,
133+ title : t ( "sidebar.discord" ) ,
134+ icon : MessageCircle ,
135+ link : "https://evolution-api.com/discord" ,
136+ } ,
137+ {
138+ id : "support-premium" ,
139+ title : t ( "sidebar.supportPremium" ) ,
140+ icon : LifeBuoy ,
141+ link : "https://evolution-api.com/suporte-pro" ,
142+ } ,
143+ ] ,
144+ [ t ] ,
145+ ) ;
143146
144147 const navigate = useNavigate ( ) ;
145148 const { pathname } = useLocation ( ) ;
@@ -165,15 +168,16 @@ function Sidebar() {
165168 "path" in child ? pathname . includes ( child . path ) : false ,
166169 } ) )
167170 : undefined ,
168- isActive : "path" in menu ? pathname . includes ( menu . path ) : false ,
171+ isActive :
172+ "path" in menu && menu . path ? pathname . includes ( menu . path ) : false ,
169173 } ) ) . map ( ( menu ) => ( {
170174 ...menu ,
171175 isActive :
172176 menu . isActive ||
173177 ( "children" in menu &&
174178 menu . children ?. some ( ( child ) => child . isActive ) ) ,
175179 } ) ) ,
176- [ pathname ] ,
180+ [ Menus , pathname ] ,
177181 ) ;
178182
179183 return (
0 commit comments