fix: correct mobileView initial state and add SpaceSettings tab reset
- UserSettings: change mobileView default from 'content' to 'tabs' - SpaceSettings: add useEffect to reset tab and mobileView on modal open
This commit is contained in:
@@ -282,6 +282,14 @@ export function SpaceSettingsModal() {
|
|||||||
const canManageRoles = hasPermissionBit(mySpacePerms, PermissionBits.MANAGE_ROLES);
|
const canManageRoles = hasPermissionBit(mySpacePerms, PermissionBits.MANAGE_ROLES);
|
||||||
const canBanMembers = hasPermissionBit(mySpacePerms, PermissionBits.BAN_MEMBERS);
|
const canBanMembers = hasPermissionBit(mySpacePerms, PermissionBits.BAN_MEMBERS);
|
||||||
|
|
||||||
|
// Reset tab and mobile view when modal opens
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen) {
|
||||||
|
setTab('overview');
|
||||||
|
setMobileView('tabs');
|
||||||
|
}
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
if (!space || !currentSpaceId) return null;
|
if (!space || !currentSpaceId) return null;
|
||||||
|
|
||||||
const tabClass = (t: typeof tab) =>
|
const tabClass = (t: typeof tab) =>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export function UserSettingsModal() {
|
|||||||
const logout = useAuthStore((s) => s.logout);
|
const logout = useAuthStore((s) => s.logout);
|
||||||
|
|
||||||
const [tab, setTab] = useState<SettingsTab>('account');
|
const [tab, setTab] = useState<SettingsTab>('account');
|
||||||
const [mobileView, setMobileView] = useState<'tabs' | 'content'>('content');
|
const [mobileView, setMobileView] = useState<'tabs' | 'content'>('tabs');
|
||||||
|
|
||||||
const isOpen = activeModal === 'userSettings';
|
const isOpen = activeModal === 'userSettings';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user