@@ -21,20 +21,106 @@ interface Collection {
21
21
items : Item [ ] ;
22
22
}
23
23
24
+ // export function AdminSidebar({ collections }: { collections: Collection[] }) {
25
+ // const combinedSettings = useContext(SettingsContext);
26
+ // const pathname = usePathname() ?? "";
27
+ // if (!combinedSettings) {
28
+ // return null;
29
+ // }
30
+ // const enterpriseSettings = combinedSettings.enterpriseSettings;
31
+ // const { configs, fetchConfigs }: any = useBrandingStore();
32
+
33
+ // useEffect(() => {
34
+ // fetchConfigs(configs?.company_name, configs?.id);
35
+ // }, []);
36
+ // useApplyBrandingTheme();
37
+ // if (!configs?.company_name) return <Loader />;
38
+ // return (
39
+ // <div className="text-text-settings-sidebar pl-0">
40
+ // <nav className="space-y-2">
41
+ // <div className="w-full ml-4 mt-1 h-8 justify-start mb-4 flex">
42
+ // <LogoComponent
43
+ // show={true}
44
+ // enterpriseSettings={enterpriseSettings!}
45
+ // backgroundToggled={false}
46
+ // isAdmin={true}
47
+ // />
48
+ // </div>
49
+ // <div className="flex w-full justify-center">
50
+ // <Link href="/chat">
51
+ // <button className="text-sm text-text-700 hover:bg-background-settings-hover dark:hover:bg-neutral-800 flex items-center block w-52 py-2.5 flex px-2 text-left hover:bg-opacity-80 cursor-pointer rounded">
52
+ // <CgArrowsExpandUpLeft className="my-auto" size={18} />
53
+ // <p className="ml-1 break-words line-clamp-2 ellipsis leading-none">
54
+ // Exit Admin
55
+ // </p>
56
+ // </button>
57
+ // </Link>
58
+ // </div>
59
+ // {collections.map((collection, collectionInd) => (
60
+ // <div
61
+ // className="flex flex-col items-center justify-center w-full"
62
+ // key={collectionInd}
63
+ // >
64
+ // <h2 className="text-xs text-text-800 w-52 font-bold pb-2">
65
+ // <div>{collection.name}</div>
66
+ // </h2>
67
+ // {collection.items.map((item) => (
68
+ // <Link key={item.link} href={item.link}>
69
+ // <button
70
+ // className={`text-sm text-text-700 block flex gap-x-2 items-center w-52 py-2.5 px-2 text-left hover:bg-background-settings-hover dark:hover:bg-neutral-800 rounded
71
+ // ${
72
+ // pathname.startsWith(item.link)
73
+ // ? "bg-background-settings-hover dark:bg-neutral-700"
74
+ // : ""
75
+ // }` }
76
+ // >
77
+ // {item.name}
78
+ // </button>
79
+ // </Link>
80
+ // ))}
81
+ // </div>
82
+ // ))}
83
+ // </nav>
84
+ // {combinedSettings.webVersion && (
85
+ // <div
86
+ // className="flex flex-col mt-12 items-center justify-center w-full"
87
+ // key={"onyxVersion"}
88
+ // >
89
+ // <h2 className="text-xs text-text/40 w-52 font-medium">
90
+ // {`${
91
+ // configs?.company_name && configs?.white_label_enabled === true
92
+ // ? configs?.company_name
93
+ // : "Cortex AI "
94
+ // }${combinedSettings?.webVersion}` }
95
+ // </h2>
96
+ // </div>
97
+ // )}
98
+ // </div>
99
+ // );
100
+ // }
101
+
102
+
24
103
export function AdminSidebar ( { collections } : { collections : Collection [ ] } ) {
104
+ const { configs, fetchConfigs } : any = useBrandingStore ( ) ; // ⬅️ moved up
25
105
const combinedSettings = useContext ( SettingsContext ) ;
26
106
const pathname = usePathname ( ) ?? "" ;
107
+
108
+ useApplyBrandingTheme ( ) ;
109
+
110
+ useEffect ( ( ) => {
111
+ if ( configs ?. company_name && configs ?. id ) {
112
+ fetchConfigs ( configs . company_name , configs . id ) ;
113
+ }
114
+ } , [ configs ?. company_name , configs ?. id , fetchConfigs ] ) ;
115
+
27
116
if ( ! combinedSettings ) {
28
117
return null ;
29
118
}
119
+
30
120
const enterpriseSettings = combinedSettings . enterpriseSettings ;
31
- const { configs, fetchConfigs } : any = useBrandingStore ( ) ;
32
121
33
- useEffect ( ( ) => {
34
- fetchConfigs ( configs ?. company_name , configs ?. id ) ;
35
- } , [ ] ) ;
36
- useApplyBrandingTheme ( ) ;
37
122
if ( ! configs ?. company_name ) return < Loader /> ;
123
+
38
124
return (
39
125
< div className = "text-text-settings-sidebar pl-0" >
40
126
< nav className = "space-y-2" >
0 commit comments