fix(settings): preserve safe job import compatibility and progress
This commit is contained in:
@@ -40,9 +40,11 @@ interface Props {
|
||||
onThemeModeChange: (v: ThemeModePref) => void;
|
||||
}
|
||||
|
||||
function TabPanel({ value, index, label, children }: { value: number; index: number; label: string; children: React.ReactNode }) {
|
||||
if (value !== index) return null;
|
||||
return <Box role="tabpanel" id={`settings-panel-${index}`} aria-labelledby={`settings-tab-${index}`} aria-label={label} sx={{ mt: "var(--app-section-gap)", minWidth: 0 }}>{children}</Box>;
|
||||
function TabPanel({ value, index, label, children, keepMounted = false }: { value: number; index: number; label: string; children: React.ReactNode; keepMounted?: boolean }) {
|
||||
const [hasBeenActive, setHasBeenActive] = useState(value === index);
|
||||
useEffect(() => { if (value === index) setHasBeenActive(true); }, [value, index]);
|
||||
if (value !== index && (!keepMounted || !hasBeenActive)) return null;
|
||||
return <Box role="tabpanel" hidden={value !== index} id={`settings-panel-${index}`} aria-labelledby={`settings-tab-${index}`} aria-label={label} sx={{ mt: "var(--app-section-gap)", minWidth: 0 }}>{children}</Box>;
|
||||
}
|
||||
|
||||
type NotificationPrefs = {
|
||||
@@ -247,7 +249,7 @@ export default function SettingsView({
|
||||
|
||||
{rulesDirty ? <Typography role="status" variant="body2" sx={{ mt: 1, color: "text.secondary" }}>{t("assetsUnsavedChanges")}. {t("rulesDraftScope")}</Typography> : null}
|
||||
|
||||
<TabPanel value={tab} index={0} label={t("settingsTabGeneral")}>
|
||||
<TabPanel value={tab} index={0} label={t("settingsTabGeneral")} keepMounted>
|
||||
<Box sx={{ display: "grid", gap: "var(--app-section-gap)", minWidth: 0 }}>
|
||||
<Box sx={{ display: "grid", gridTemplateColumns: { xs: "minmax(0, 1fr)", md: "repeat(2, minmax(0, 1fr))" }, gap: "var(--app-section-gap)" }}>
|
||||
<PageSection surface title={t("settingsAppearance")}>
|
||||
|
||||
Reference in New Issue
Block a user