refactor(risk, navigation): update risk management redirects and enhance loading states
Changed default redirects in risk management pages to point to the new risk pools section. Removed unused risk lock log components and streamlined the admin reports page with a loading state for better user experience. Added a new DocFigure component for improved documentation visuals and updated localization files to include new figure descriptions.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect } from "react";
|
||||
import i18n from "@/i18n";
|
||||
import i18n, { ensureAdminI18nReady, normalizeAdminLanguage } from "@/i18n";
|
||||
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
@@ -13,29 +13,19 @@ type ProvidersProps = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
function applyStoredAdminLanguage() {
|
||||
const locale = hydrateAdminUiLocale();
|
||||
if (!locale) {
|
||||
return;
|
||||
}
|
||||
const current = i18n.resolvedLanguage ?? i18n.language;
|
||||
if (locale !== current) {
|
||||
void i18n.changeLanguage(locale);
|
||||
}
|
||||
}
|
||||
|
||||
function AdminSessionHydrator() {
|
||||
useEffect(() => {
|
||||
if (i18n.isInitialized) {
|
||||
applyStoredAdminLanguage();
|
||||
} else {
|
||||
i18n.on("initialized", applyStoredAdminLanguage);
|
||||
}
|
||||
useAdminSessionStore.getState().rehydrate();
|
||||
void (async () => {
|
||||
await ensureAdminI18nReady();
|
||||
|
||||
return () => {
|
||||
i18n.off("initialized", applyStoredAdminLanguage);
|
||||
};
|
||||
const locale = hydrateAdminUiLocale();
|
||||
const current = normalizeAdminLanguage(i18n.resolvedLanguage ?? i18n.language);
|
||||
if (locale && locale !== current) {
|
||||
await i18n.changeLanguage(locale);
|
||||
}
|
||||
|
||||
useAdminSessionStore.getState().rehydrate();
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user