Skip to content

Commit 2be509f

Browse files
committed
chore: Refactor - group similar components in a features directory.
1 parent 2f637f4 commit 2be509f

File tree

26 files changed

+155
-89
lines changed

26 files changed

+155
-89
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ The following dependecies are used for this project. Feel free to experiment usi
3232
### Manual Installation and Usage
3333

3434
1. Navigate to the **/client** directory from the commandline.
35-
2. Run: `npm run install`
36-
3. Run: `npm run dev`
35+
2. Create a `.env` file from the `/client/.env.example` file. Copy it's content when working on localhost.
36+
3. Run: `npm run install`
37+
4. Run: `npm run dev`
3738

3839
### Localhost Development Using Docker
3940

client/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_BASE_PATH=''

client/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ yarn-error.log*
3030

3131
# vercel
3232
.vercel
33+
34+
.env

client/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ The following dependecies are used for this project. Feel free to experiment usi
2525
1. Clone this repository.<br>
2626
`https://github.com/weaponsforge/react-hooks-playground.git`
2727

28+
2. Create a `.env` file from the `/client/.env.example` file. Copy it's content when working on localhost.
29+
2830
## Available Scripts
2931

3032
### `npm run dev`

client/jsconfig.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
"paths": {
44
"@/*": ["./src/*"],
55
"@/hooks/*": ["./src/lib/hooks/*"],
6-
"@/public/*": ["./public/*"],
7-
"@/services/*": ["./src/lib/services/*"],
8-
"@/store/*": ["./src/lib/store/*"],
9-
"@/utils/*": ["./src/lib/utils/*"]
6+
"@/public/*": ["public/*"],
7+
"@/store/*": ["./src/lib/store/*"]
108
}
119
}
1210
}

client/next.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
reactStrictMode: true,
4+
trailingSlash: true,
5+
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
6+
assetPrefix: `${process.env.NEXT_PUBLIC_BASE_PATH}/`,
7+
images: {
8+
unoptimized: true
9+
},
10+
eslint: {
11+
dirs: ['src']
12+
}
413
}
514

615
module.exports = nextConfig

client/src/features/redux/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Redux from './reduxcontainer'
2+
import TodoListComponent from './todolist'
3+
4+
export {
5+
Redux,
6+
TodoListComponent
7+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { useDispatch } from 'react-redux'
2+
import { todoReceived, todoDelete } from '@/lib/store/todos/todoSlice'
3+
4+
import ReduxComponent from './redux'
5+
6+
function Redux () {
7+
const dispatch = useDispatch()
8+
9+
const addTodo = () => {
10+
dispatch(todoReceived({
11+
text: 'Hello, world!'
12+
}))
13+
}
14+
15+
const deleteTodo = (id) => {
16+
dispatch(todoDelete(id))
17+
}
18+
19+
return (
20+
<ReduxComponent
21+
addTodo={addTodo}
22+
deleteTodo={deleteTodo}
23+
/>
24+
)
25+
}
26+
27+
export default Redux

client/src/components/redux/index.js renamed to client/src/features/redux/reduxcontainer/redux.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import PropTypes from 'prop-types'
22
import Page from '@/common/layout/page'
33
import Card from '@/common/ui/card'
4-
import TodoListComponent from '@/domain/redux/todolist'
4+
import TodoListComponent from '../todolist'
55

66
function ReduxComponent ({
77
addTodo,

0 commit comments

Comments
 (0)