Refactor authentication and account management with modular UI components (#242)

This commit is contained in:
2026-08-23 01:30:58 -04:00
committed by GitHub
parent c514eb9814
commit 1621313daa
109 changed files with 14743 additions and 10792 deletions

View File

@@ -0,0 +1,25 @@
import type { SectionAction, SectionState } from './types';
export const initialSectionState: SectionState = {
usernameOpen: false,
emailOpen: false,
profileOpen: false,
passwordOpen: false,
};
export const sectionReducer = (state: SectionState, action: SectionAction): SectionState => {
switch (action.type) {
case 'TOGGLE_USERNAME_VISIBILITY':
return { ...initialSectionState, usernameOpen: !state.usernameOpen };
case 'TOGGLE_EMAIL_VISIBILITY':
return { ...initialSectionState, emailOpen: !state.emailOpen };
case 'TOGGLE_PROFILE_VISIBILITY':
return { ...initialSectionState, profileOpen: !state.profileOpen };
case 'TOGGLE_PASSWORD_VISIBILITY':
return { ...initialSectionState, passwordOpen: !state.passwordOpen };
case 'CLOSE_ALL':
return initialSectionState;
default:
return state;
}
};