-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate react-router-dom for improved routing and refactor Ap…
…p component structure
- Loading branch information
1 parent
65366fa
commit 56c26b1
Showing
5 changed files
with
61 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
import React from 'react'; | ||
import { GlobalStoreProvider } from '@state/global-store'; | ||
import React, { createContext, useContext, useReducer } from 'react'; | ||
|
||
export const StoreProvider: React.FC = ({ children }) => ( | ||
<GlobalStoreProvider>{children}</GlobalStoreProvider> | ||
); | ||
const initialState = { | ||
// Defina o estado inicial aqui | ||
}; | ||
|
||
const StoreContext = createContext(initialState); | ||
|
||
const storeReducer = (state, action) => { | ||
switch (action.type) { | ||
// Defina os casos do reducer aqui | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export const StoreProvider = ({ children }) => { | ||
const [state, dispatch] = useReducer(storeReducer, initialState); | ||
|
||
return ( | ||
<StoreContext.Provider value={{ state, dispatch }}> | ||
{children} | ||
</StoreContext.Provider> | ||
); | ||
}; | ||
|
||
export const useStore = () => useContext(StoreContext); |
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { defineConfig } from 'vite'; | ||
import path from 'path'; | ||
|
||
// https://vitejs.dev/config | ||
export default defineConfig({}); | ||
export default defineConfig({ | ||
resolve: { | ||
alias: { | ||
'@state': path.resolve(__dirname, 'src/state'), | ||
'@events': path.resolve(__dirname, 'src/events'), | ||
}, | ||
}, | ||
}); |
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 |
---|---|---|
|
@@ -1455,6 +1455,11 @@ | |
dependencies: | ||
playwright "1.47.2" | ||
|
||
"@remix-run/[email protected]": | ||
version "1.19.2" | ||
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.19.2.tgz#0c896535473291cb41f152c180bedd5680a3b273" | ||
integrity sha512-baiMx18+IMuD1yyvOGaHM9QrVUPGGG0jC+z+IPHnRJWUAUvaKuWKyE8gjDj2rzv3sz9zOGoRSPgeBVHRhZnBlA== | ||
|
||
"@rollup/pluginutils@^5.0.2": | ||
version "5.1.2" | ||
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.2.tgz#d3bc9f0fea4fd4086aaac6aa102f3fa587ce8bd9" | ||
|
@@ -7363,6 +7368,21 @@ react-is@^18.0.0: | |
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" | ||
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== | ||
|
||
react-router-dom@^6.26.2: | ||
version "6.26.2" | ||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.26.2.tgz#a6e3b0cbd6bfd508e42b9342099d015a0ac59680" | ||
integrity sha512-z7YkaEW0Dy35T3/QKPYB1LjMK2R1fxnHO8kWpUMTBdfVzZrWOiY9a7CtN8HqdWtDUWd5FY6Dl8HFsqVwH4uOtQ== | ||
dependencies: | ||
"@remix-run/router" "1.19.2" | ||
react-router "6.26.2" | ||
|
||
[email protected]: | ||
version "6.26.2" | ||
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.26.2.tgz#2f0a68999168954431cdc29dd36cec3b6fa44a7e" | ||
integrity sha512-tvN1iuT03kHgOFnLPfLJ8V95eijteveqdOSk+srqfePtQvqCExB8eHOYnlilbOcyJyKnYkr1vJvf7YqotAJu1A== | ||
dependencies: | ||
"@remix-run/router" "1.19.2" | ||
|
||
"react@^16.8.0 || ^17.0.0 || ^18.0.0": | ||
version "18.3.1" | ||
resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891" | ||
|