Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/pages/SuperAdminPanel.jsx
Browse files
frontend/src/pages/SuperAdminPanel.jsx
CHANGED
|
@@ -126,18 +126,27 @@ const SuperAdminPanel = () => {
|
|
| 126 |
const [demoBookings, setDemoBookings] = useState([]);
|
| 127 |
const [emailLogs, setEmailLogs] = useState([]);
|
| 128 |
const [activeTab, setActiveTab] = useState(() => {
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
});
|
| 134 |
|
| 135 |
useEffect(() => {
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
}
|
| 142 |
}, [activeTab]);
|
| 143 |
|
|
|
|
| 126 |
const [demoBookings, setDemoBookings] = useState([]);
|
| 127 |
const [emailLogs, setEmailLogs] = useState([]);
|
| 128 |
const [activeTab, setActiveTab] = useState(() => {
|
| 129 |
+
try {
|
| 130 |
+
const params = new URLSearchParams(window.location.search);
|
| 131 |
+
const tabFromUrl = params.get('tab');
|
| 132 |
+
const storedTab = localStorage.getItem('superAdminActiveTab');
|
| 133 |
+
return tabFromUrl || storedTab || 'overview';
|
| 134 |
+
} catch (e) {
|
| 135 |
+
return 'overview';
|
| 136 |
+
}
|
| 137 |
});
|
| 138 |
|
| 139 |
useEffect(() => {
|
| 140 |
+
try {
|
| 141 |
+
localStorage.setItem('superAdminActiveTab', activeTab);
|
| 142 |
+
const searchParams = new URLSearchParams(window.location.search);
|
| 143 |
+
if (searchParams.get('tab') !== activeTab) {
|
| 144 |
+
searchParams.set('tab', activeTab);
|
| 145 |
+
const newUrl = `${window.location.pathname}?${searchParams.toString()}`;
|
| 146 |
+
window.history.replaceState(null, '', newUrl);
|
| 147 |
+
}
|
| 148 |
+
} catch (e) {
|
| 149 |
+
// Ignore cross-origin history state errors in HF Spaces/iframes
|
| 150 |
}
|
| 151 |
}, [activeTab]);
|
| 152 |
|