, to: '/' },
- { name: 'local', text:
{instance.domain}
, to: '/timeline/local' },
+ { name: 'home', text:
, to: '/', notification: notifications.home },
+ { name: 'local', text:
{instance.domain}
, to: '/timeline/local', notification: notifications.instance },
]}
activeItem={pathname === '/timeline/local' ? 'local' : 'home'}
/>
diff --git a/src/reducers/index.ts b/src/reducers/index.ts
index 21fae33b3..e57877462 100644
--- a/src/reducers/index.ts
+++ b/src/reducers/index.ts
@@ -32,6 +32,7 @@ import meta from './meta.ts';
import modals from './modals.ts';
import mutes from './mutes.ts';
import notifications from './notifications.ts';
+import notificationsTab from './notificationsSlice.ts';
import onboarding from './onboarding.ts';
import patron from './patron.ts';
import pending_statuses from './pending-statuses.ts';
@@ -87,6 +88,7 @@ export default combineReducers({
modals,
mutes,
notifications,
+ notificationsTab,
onboarding,
patron,
pending_statuses,
diff --git a/src/reducers/notificationsSlice.ts b/src/reducers/notificationsSlice.ts
new file mode 100644
index 000000000..f62eb5d78
--- /dev/null
+++ b/src/reducers/notificationsSlice.ts
@@ -0,0 +1,36 @@
+import { createSlice, PayloadAction } from '@reduxjs/toolkit';
+
+interface NotificationState {
+ home: boolean;
+ public: boolean;
+ instance: boolean;
+}
+
+const initialState: NotificationState = {
+ home: false,
+ public: false,
+ instance: false,
+};
+
+const notificationsTab = createSlice({
+ name: 'notificationsSlice',
+ initialState,
+ reducers: {
+ setNotification: (
+ state,
+ action: PayloadAction<{ timelineId: string; value: boolean }>,
+ ) => {
+ if (action.payload.timelineId in state) {
+ state[action.payload.timelineId as keyof NotificationState] = action.payload.value;
+ }
+ },
+ resetNotifications: (state) => {
+ state.home = false;
+ state.public = false;
+ state.instance = false;
+ },
+ },
+});
+
+export const { setNotification, resetNotifications } = notificationsTab.actions;
+export default notificationsTab.reducer;
\ No newline at end of file