1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

More visually stable me page

This commit is contained in:
Zhiyuan Zheng
2021-11-15 23:43:35 +01:00
parent 7ac789c18c
commit 0c28ea6b0c
5 changed files with 89 additions and 11 deletions

View File

@ -17,6 +17,10 @@ export type ContextsState = {
hidden: boolean
}
previousTab: 'Tab-Local' | 'Tab-Public' | 'Tab-Notifications' | 'Tab-Me'
mePage: {
lists: { shown: boolean }
announcements: { shown: boolean; unread: number }
}
}
export const contextsInitialState = {
@ -32,7 +36,11 @@ export const contextsInitialState = {
current: 0,
hidden: false
},
previousTab: 'Tab-Me'
previousTab: 'Tab-Me',
mePage: {
lists: { shown: false },
announcements: { shown: false, unread: 0 }
}
}
const contextsSlice = createSlice({
@ -61,6 +69,12 @@ const contextsSlice = createSlice({
action: PayloadAction<ContextsState['previousTab']>
) => {
state.previousTab = action.payload
},
updateContextMePage: (
state,
action: PayloadAction<Partial<ContextsState['mePage']>>
) => {
state.mePage = { ...state.mePage, ...action.payload }
}
}
})
@ -68,10 +82,13 @@ const contextsSlice = createSlice({
export const getPublicRemoteNotice = (state: RootState) =>
state.contexts.publicRemoteNotice
export const getPreviousTab = (state: RootState) => state.contexts.previousTab
export const getMePage = (state: RootState) => state.contexts.mePage
export const getContexts = (state: RootState) => state.contexts
export const {
updateStoreReview,
updatePublicRemoteNotice,
updatePreviousTab
updatePreviousTab,
updateContextMePage
} = contextsSlice.actions
export default contextsSlice.reducer