-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚚 (smpl): Rename Session to DeviceSession
- Loading branch information
1 parent
a83a609
commit 2f05046
Showing
9 changed files
with
67 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/sample/src/providers/DeviceSessionsProvider/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { Context, createContext, useContext, useReducer } from "react"; | ||
|
||
import { | ||
AddSessionAction, | ||
DeviceSessionsInitialState, | ||
deviceSessionsReducer, | ||
DeviceSessionsState, | ||
RemoveSessionAction, | ||
} from "@/reducers/deviceSessions"; | ||
|
||
type DeviceSessionsContextType = { | ||
state: DeviceSessionsState; | ||
dispatch: (value: AddSessionAction | RemoveSessionAction) => void; | ||
}; | ||
|
||
const DeviceSessionsContext: Context<DeviceSessionsContextType> = | ||
createContext<DeviceSessionsContextType>({ | ||
state: DeviceSessionsInitialState, | ||
dispatch: () => null, | ||
}); | ||
|
||
export const DeviceSessionsProvider: React.FC<React.PropsWithChildren> = ({ | ||
children, | ||
}) => { | ||
const [state, dispatch] = useReducer( | ||
deviceSessionsReducer, | ||
DeviceSessionsInitialState, | ||
); | ||
|
||
return ( | ||
<DeviceSessionsContext.Provider value={{ state, dispatch }}> | ||
{children} | ||
</DeviceSessionsContext.Provider> | ||
); | ||
}; | ||
|
||
export const useDeviceSessionsContext = () => | ||
useContext<DeviceSessionsContextType>(DeviceSessionsContext); |
This file was deleted.
Oops, something went wrong.
18 changes: 9 additions & 9 deletions
18
apps/sample/src/reducers/sessions.ts → apps/sample/src/reducers/deviceSessions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters