mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Refactor authentication and account management with modular UI components (#242)
This commit is contained in:
25
web/frontend/app/features/account/state.ts
Normal file
25
web/frontend/app/features/account/state.ts
Normal 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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user