diff --git a/frontend/mobile/src/app/(app)/event/[id].tsx b/frontend/mobile/src/app/(app)/event/[id].tsx index aa5898ce..34fa54b8 100644 --- a/frontend/mobile/src/app/(app)/event/[id].tsx +++ b/frontend/mobile/src/app/(app)/event/[id].tsx @@ -17,12 +17,12 @@ import { Button } from '@/src/app/(design-system)/components/Button/Button'; import { description, events, tags } from '@/src/consts/event-page'; import { AboutEvent } from './components/about'; +import { Description } from './components/description'; import { Location } from './components/location'; import { Overview } from './components/overview'; -import { UpcomingEvent } from './components/upcoming-events'; -import { Description } from './components/description'; import { RegisterBottomSheet } from './components/register'; import { ShareEventBottomSheet } from './components/share-event'; +import { UpcomingEvent } from './components/upcoming-events'; type EventType = 'in-person' | 'virtual' | 'hybrid'; diff --git a/frontend/mobile/src/app/(design-system)/components/Calendar/Day.tsx b/frontend/mobile/src/app/(design-system)/components/Calendar/Day.tsx index 621c0ce9..e84b1d04 100644 --- a/frontend/mobile/src/app/(design-system)/components/Calendar/Day.tsx +++ b/frontend/mobile/src/app/(design-system)/components/Calendar/Day.tsx @@ -2,11 +2,10 @@ import { Box } from '@/src/app/(design-system)/components/Box/Box'; import DayTimeSection, { EventSection } from '@/src/app/(design-system)/components/Calendar/DayTimeSection'; +import { Text } from '@/src/app/(design-system)/components/Text/Text'; import NoEventsIcon from '@/src/assets/svg/NoSearchResult.svg'; import { formatTime } from '@/src/utils/time'; -import { Text } from '@/src/app/(design-system)/components/Text/Text'; - type DayProps = { section: EventSection; error?: boolean; diff --git a/frontend/mobile/src/app/_layout.tsx b/frontend/mobile/src/app/_layout.tsx index 86ee50e7..e106f747 100644 --- a/frontend/mobile/src/app/_layout.tsx +++ b/frontend/mobile/src/app/_layout.tsx @@ -10,9 +10,9 @@ import { StatusBar } from 'expo-status-bar'; import FontAwesome from '@expo/vector-icons/FontAwesome'; import { ThemeProvider } from '@shopify/restyle'; -import { theme } from './(design-system)'; import StoreProvider from '../store/StoreProvider'; import { useAppSelector } from '../store/store'; +import { theme } from './(design-system)'; export { ErrorBoundary } from 'expo-router'; diff --git a/frontend/mobile/src/store/StoreProvider.tsx b/frontend/mobile/src/store/StoreProvider.tsx index c9ec8320..b875f3d3 100644 --- a/frontend/mobile/src/store/StoreProvider.tsx +++ b/frontend/mobile/src/store/StoreProvider.tsx @@ -1,20 +1,22 @@ -import { Provider } from "react-redux"; -import { PersistGate } from "redux-persist/integration/react"; -import { persistor, store } from "@/src/store/store"; +import { Provider } from 'react-redux'; + +import { PersistGate } from 'redux-persist/integration/react'; + +import { persistor, store } from '@/src/store/store'; type StoreProviderProps = { - children: React.ReactNode; -} + children: React.ReactNode; +}; /** * The Redux store provider component. This makes the store accessible globally across the repository */ export default function StoreProvider({ children }: StoreProviderProps) { - return ( - - - {children} - - - ) + return ( + + + {children} + + + ); } diff --git a/frontend/mobile/src/store/slices/userSlice.ts b/frontend/mobile/src/store/slices/userSlice.ts index 7f38c42e..30328f25 100644 --- a/frontend/mobile/src/store/slices/userSlice.ts +++ b/frontend/mobile/src/store/slices/userSlice.ts @@ -4,11 +4,11 @@ export type UserState = { userId: string; email: string; accessToken?: string; -} +}; const initialState: UserState = { - userId: "", - email: "", + userId: '', + email: '' }; export const userSlice = createSlice({ @@ -24,16 +24,12 @@ export const userSlice = createSlice({ setAccessToken: (state, action) => { state.accessToken = action.payload; }, - resetAccessToken: state => { + resetAccessToken: (state) => { state.accessToken = undefined; } } -}) +}); -export const { - setUser, - resetUser, - setAccessToken, - resetAccessToken -} = userSlice.actions; -export default userSlice.reducer; \ No newline at end of file +export const { setUser, resetUser, setAccessToken, resetAccessToken } = + userSlice.actions; +export default userSlice.reducer; diff --git a/frontend/mobile/src/store/store.ts b/frontend/mobile/src/store/store.ts index 33045e9b..c505d2ff 100644 --- a/frontend/mobile/src/store/store.ts +++ b/frontend/mobile/src/store/store.ts @@ -1,64 +1,72 @@ -import { baseApi } from "@generatesac/lib"; -import { combineReducers, configureStore } from "@reduxjs/toolkit"; -import { useDispatch, useSelector, useStore } from "react-redux"; -import userReducer from "@/src/store/slices/userSlice"; -import persistReducer from "redux-persist/es/persistReducer"; +import { useDispatch, useSelector, useStore } from 'react-redux'; + +import { baseApi } from '@generatesac/lib'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { thunk } from "redux-thunk"; +import { combineReducers, configureStore } from '@reduxjs/toolkit'; import { - FLUSH, - PAUSE, - PERSIST, - PURGE, - REGISTER, - REHYDRATE, - persistStore, -} from "redux-persist"; -import autoMergeLevel2 from "redux-persist/es/stateReconciler/autoMergeLevel2"; + FLUSH, + PAUSE, + PERSIST, + PURGE, + REGISTER, + REHYDRATE, + persistStore +} from 'redux-persist'; +import persistReducer from 'redux-persist/es/persistReducer'; +import autoMergeLevel2 from 'redux-persist/es/stateReconciler/autoMergeLevel2'; +import { thunk } from 'redux-thunk'; + +import userReducer from '@/src/store/slices/userSlice'; const rootReducer = combineReducers({ - user: userReducer, - [baseApi.reducerPath]: baseApi.reducer, + user: userReducer, + [baseApi.reducerPath]: baseApi.reducer }); type RootReducer = ReturnType; const persistanceConfig = { - key: "root", - storage: AsyncStorage, - stateReconciler: autoMergeLevel2, - blacklist: [baseApi.reducerPath], - whitelist: ["user"], + key: 'root', + storage: AsyncStorage, + stateReconciler: autoMergeLevel2, + blacklist: [baseApi.reducerPath], + whitelist: ['user'] }; const persistedReducer = persistReducer( - persistanceConfig, - rootReducer, + persistanceConfig, + rootReducer ); -export const store = - configureStore({ +export const store = configureStore({ middleware: (getDefaultMiddleware) => - getDefaultMiddleware({ - serializableCheck: { - ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], - } - }) - .concat(baseApi.middleware) - .concat(thunk), - + getDefaultMiddleware({ + serializableCheck: { + ignoredActions: [ + FLUSH, + REHYDRATE, + PAUSE, + PERSIST, + PURGE, + REGISTER + ] + } + }) + .concat(baseApi.middleware) + .concat(thunk), + reducer: persistedReducer, - devTools: process.env.NODE_ENV !== "production", - }); + devTools: process.env.NODE_ENV !== 'production' +}); export const persistor = persistStore(store); // Redux types: -export type AppStore = typeof store -export type RootState = ReturnType -export type AppDispatch = AppStore['dispatch'] +export type AppStore = typeof store; +export type RootState = ReturnType; +export type AppDispatch = AppStore['dispatch']; // Typed Redux interactive methods: -export const useAppDispatch = useDispatch.withTypes() -export const useAppSelector = useSelector.withTypes() -export const useAppStore = useStore.withTypes() +export const useAppDispatch = useDispatch.withTypes(); +export const useAppSelector = useSelector.withTypes(); +export const useAppStore = useStore.withTypes(); diff --git a/frontend/mobile/src/utils/storage.ts b/frontend/mobile/src/utils/storage.ts index 59f59afb..532b9b4a 100644 --- a/frontend/mobile/src/utils/storage.ts +++ b/frontend/mobile/src/utils/storage.ts @@ -28,4 +28,4 @@ async function deleteToken(key: string) { } } -export { getToken, saveToken, deleteToken } \ No newline at end of file +export { getToken, saveToken, deleteToken };