From 73a5c7fae9ffbe9ada721148c8c454a643aceebe Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 20 Feb 2022 16:11:50 +0100 Subject: chore!: restructure repo I separated public files from the config/dev files. It improves repo readability. I also moved dotenv helper to public/inc directory and extract the Matomo tracker in the same directory. --- .../react-small-apps/apps/todos/.env.example | 11 ++ .../react-small-apps/apps/todos/.gitignore | 24 +++ .../projects/react-small-apps/apps/todos/README.md | 56 +++++++ .../apps/todos/assets/preview-single-todo.jpg | Bin 0 -> 25081 bytes .../apps/todos/assets/preview-todo-account.jpg | Bin 0 -> 23922 bytes .../apps/todos/assets/preview-todo-login.jpg | Bin 0 -> 25720 bytes .../apps/todos/assets/preview-todos-list.jpg | Bin 0 -> 45601 bytes .../react-small-apps/apps/todos/package.json | 48 ++++++ .../react-small-apps/apps/todos/public/favicon.ico | Bin 0 -> 3585 bytes .../react-small-apps/apps/todos/public/index.html | 43 ++++++ .../react-small-apps/apps/todos/public/logo192.png | Bin 0 -> 4153 bytes .../react-small-apps/apps/todos/public/logo512.png | Bin 0 -> 12066 bytes .../apps/todos/public/manifest.json | 25 ++++ .../react-small-apps/apps/todos/public/robots.txt | 2 + .../react-small-apps/apps/todos/src/App.js | 47 ++++++ .../react-small-apps/apps/todos/src/App.scss | 42 ++++++ .../todos/src/components/forms/Button/Button.js | 17 +++ .../src/components/forms/Fieldset/Fieldset.js | 10 ++ .../apps/todos/src/components/forms/Form.scss | 163 +++++++++++++++++++++ .../apps/todos/src/components/forms/Input/Input.js | 39 +++++ .../src/components/forms/TextArea/TextArea.js | 24 +++ .../apps/todos/src/components/forms/index.js | 7 + .../todos/src/components/layout/Footer/Footer.js | 15 ++ .../todos/src/components/layout/Footer/Footer.scss | 8 + .../todos/src/components/layout/Header/Header.js | 39 +++++ .../todos/src/components/layout/Header/Header.scss | 18 +++ .../layout/Header/UserOptions/UserOptions.js | 38 +++++ .../layout/Header/UserOptions/UserOptions.scss | 50 +++++++ .../apps/todos/src/components/layout/Main/Main.js | 7 + .../todos/src/components/layout/Main/Main.scss | 3 + .../apps/todos/src/components/layout/index.js | 5 + .../react-small-apps/apps/todos/src/index.js | 17 +++ .../apps/todos/src/sass/abstracts/_mixins.scss | 24 +++ .../todos/src/sass/abstracts/_placeholders.scss | 5 + .../apps/todos/src/sass/abstracts/_variables.scss | 12 ++ .../todos/src/services/LocalStorage.service.js | 26 ++++ .../apps/todos/src/store/auth/auth.slice.js | 23 +++ .../react-small-apps/apps/todos/src/store/index.js | 56 +++++++ .../apps/todos/src/store/todos/todos.slice.js | 54 +++++++ .../apps/todos/src/store/users/users.slice.js | 39 +++++ .../apps/todos/src/utilities/helpers.js | 20 +++ .../apps/todos/src/utilities/hooks.js | 10 ++ .../apps/todos/src/views/Account/Account.js | 26 ++++ .../apps/todos/src/views/Account/Account.scss | 15 ++ .../apps/todos/src/views/LoginForm/LoginForm.js | 84 +++++++++++ .../apps/todos/src/views/Logout/Logout.js | 18 +++ .../apps/todos/src/views/Todo/Todo.js | 86 +++++++++++ .../apps/todos/src/views/Todo/Todo.scss | 31 ++++ .../apps/todos/src/views/TodoForm/TodoForm.js | 42 ++++++ .../apps/todos/src/views/TodoList/TodoList.js | 84 +++++++++++ .../apps/todos/src/views/TodoList/TodoList.scss | 63 ++++++++ .../todos/src/views/TodoList/TodoListFilters.js | 47 ++++++ .../apps/todos/src/views/TodoList/TodoListItem.js | 55 +++++++ 53 files changed, 1578 insertions(+) create mode 100644 public/projects/react-small-apps/apps/todos/.env.example create mode 100644 public/projects/react-small-apps/apps/todos/.gitignore create mode 100644 public/projects/react-small-apps/apps/todos/README.md create mode 100644 public/projects/react-small-apps/apps/todos/assets/preview-single-todo.jpg create mode 100644 public/projects/react-small-apps/apps/todos/assets/preview-todo-account.jpg create mode 100644 public/projects/react-small-apps/apps/todos/assets/preview-todo-login.jpg create mode 100644 public/projects/react-small-apps/apps/todos/assets/preview-todos-list.jpg create mode 100644 public/projects/react-small-apps/apps/todos/package.json create mode 100644 public/projects/react-small-apps/apps/todos/public/favicon.ico create mode 100644 public/projects/react-small-apps/apps/todos/public/index.html create mode 100644 public/projects/react-small-apps/apps/todos/public/logo192.png create mode 100644 public/projects/react-small-apps/apps/todos/public/logo512.png create mode 100644 public/projects/react-small-apps/apps/todos/public/manifest.json create mode 100644 public/projects/react-small-apps/apps/todos/public/robots.txt create mode 100644 public/projects/react-small-apps/apps/todos/src/App.js create mode 100644 public/projects/react-small-apps/apps/todos/src/App.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/Button/Button.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/Fieldset/Fieldset.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/Form.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/Input/Input.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/TextArea/TextArea.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/forms/index.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Footer/Footer.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Footer/Footer.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Header/Header.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Header/Header.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Header/UserOptions/UserOptions.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Header/UserOptions/UserOptions.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Main/Main.js create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/Main/Main.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/components/layout/index.js create mode 100644 public/projects/react-small-apps/apps/todos/src/index.js create mode 100644 public/projects/react-small-apps/apps/todos/src/sass/abstracts/_mixins.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/sass/abstracts/_placeholders.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/sass/abstracts/_variables.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/services/LocalStorage.service.js create mode 100644 public/projects/react-small-apps/apps/todos/src/store/auth/auth.slice.js create mode 100644 public/projects/react-small-apps/apps/todos/src/store/index.js create mode 100644 public/projects/react-small-apps/apps/todos/src/store/todos/todos.slice.js create mode 100644 public/projects/react-small-apps/apps/todos/src/store/users/users.slice.js create mode 100644 public/projects/react-small-apps/apps/todos/src/utilities/helpers.js create mode 100644 public/projects/react-small-apps/apps/todos/src/utilities/hooks.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/Account/Account.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/Account/Account.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/views/LoginForm/LoginForm.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/Logout/Logout.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/Todo/Todo.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/Todo/Todo.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/views/TodoForm/TodoForm.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/TodoList/TodoList.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/TodoList/TodoList.scss create mode 100644 public/projects/react-small-apps/apps/todos/src/views/TodoList/TodoListFilters.js create mode 100644 public/projects/react-small-apps/apps/todos/src/views/TodoList/TodoListItem.js (limited to 'public/projects/react-small-apps/apps/todos') diff --git a/public/projects/react-small-apps/apps/todos/.env.example b/public/projects/react-small-apps/apps/todos/.env.example new file mode 100644 index 0000000..1b48ea9 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/.env.example @@ -0,0 +1,11 @@ +# Create React App config. +# See: https://create-react-app.dev/docs/advanced-configuration/ + +# Development +BROWSER='firefox-developer-edition' +BUILD_PATH='build' +PORT=3000 +HTTPS=false + +# Production +PUBLIC_URL='./' diff --git a/public/projects/react-small-apps/apps/todos/.gitignore b/public/projects/react-small-apps/apps/todos/.gitignore new file mode 100644 index 0000000..0732bb1 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/.gitignore @@ -0,0 +1,24 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local +.vscode + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/public/projects/react-small-apps/apps/todos/README.md b/public/projects/react-small-apps/apps/todos/README.md new file mode 100644 index 0000000..1288e36 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/README.md @@ -0,0 +1,56 @@ +# React Redux ToDos + +A ToDo app implementation with React and Redux. + +## Description + +This a simple ToDo application used to learn Redux. + +The app has different views: + +- login (and a logout link) +- a todos list where user can add new todos and mark them as done +- a single todo view where user can see todo details and edit data +- an account view + +## Requirements + +- Yarn + +## How to + +### Start the development version + +`yarn run start` + +### Start the build version: + +1. `yarn run build` +2. (`yarn global add serve`) +3. `serve -s build` + +## Login + +User: `demo@email.com` + +Password: `demo` + +## Preview + +You can see a live preview here: https://demo.armandphilippot.com/#todos + +| Todos list | Single todo | +| --- | --- | +| ![List preview](./assets/preview-todos-list.jpg) | ![Todo preview](./assets/preview-single-todo.jpg) | + +| Login Page | Account Page | +| --- | --- | +| ![Login preview](./assets/preview-todo-login.jpg) | ![Account preview](./assets/preview-todo-account.jpg) | + +## Disclaimer + +This app is not intended to be used. There is no registration form and password encryption is not implemented. The only user available is a demo user. + +## License + +This project is open-source and available under [MIT license](../LICENSE). diff --git a/public/projects/react-small-apps/apps/todos/assets/preview-single-todo.jpg b/public/projects/react-small-apps/apps/todos/assets/preview-single-todo.jpg new file mode 100644 index 0000000..b8332ac Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/assets/preview-single-todo.jpg differ diff --git a/public/projects/react-small-apps/apps/todos/assets/preview-todo-account.jpg b/public/projects/react-small-apps/apps/todos/assets/preview-todo-account.jpg new file mode 100644 index 0000000..6babb24 Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/assets/preview-todo-account.jpg differ diff --git a/public/projects/react-small-apps/apps/todos/assets/preview-todo-login.jpg b/public/projects/react-small-apps/apps/todos/assets/preview-todo-login.jpg new file mode 100644 index 0000000..41116d9 Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/assets/preview-todo-login.jpg differ diff --git a/public/projects/react-small-apps/apps/todos/assets/preview-todos-list.jpg b/public/projects/react-small-apps/apps/todos/assets/preview-todos-list.jpg new file mode 100644 index 0000000..95b327f Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/assets/preview-todos-list.jpg differ diff --git a/public/projects/react-small-apps/apps/todos/package.json b/public/projects/react-small-apps/apps/todos/package.json new file mode 100644 index 0000000..924c0dc --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/package.json @@ -0,0 +1,48 @@ +{ + "name": "react-redux-todos", + "description": "A ToDos app implementation with React and Redux.", + "version": "1.0.0", + "license": "MIT", + "author": { + "name": "Armand Philippot", + "url": "https://www.armandphilippot.com", + "email": "contact@armandphilippot.com" + }, + "private": true, + "dependencies": { + "@reduxjs/toolkit": "^1.5.1", + "@testing-library/jest-dom": "^5.16.2", + "@testing-library/react": "^12.1.3", + "@testing-library/user-event": "^13.5.0", + "modern-normalize": "^1.1.0", + "react": "^17.0.2", + "react-dom": "^17.0.2", + "react-redux": "^7.2.3", + "react-router-dom": "^6.2.1", + "react-scripts": "5.0.0" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "devDependencies": { + "sass": "^1.42.1" + } +} diff --git a/public/projects/react-small-apps/apps/todos/public/favicon.ico b/public/projects/react-small-apps/apps/todos/public/favicon.ico new file mode 100644 index 0000000..354202a Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/public/favicon.ico differ diff --git a/public/projects/react-small-apps/apps/todos/public/index.html b/public/projects/react-small-apps/apps/todos/public/index.html new file mode 100644 index 0000000..8a93f4d --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + ToDo App + + + +
+ + + diff --git a/public/projects/react-small-apps/apps/todos/public/logo192.png b/public/projects/react-small-apps/apps/todos/public/logo192.png new file mode 100644 index 0000000..3362410 Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/public/logo192.png differ diff --git a/public/projects/react-small-apps/apps/todos/public/logo512.png b/public/projects/react-small-apps/apps/todos/public/logo512.png new file mode 100644 index 0000000..b351622 Binary files /dev/null and b/public/projects/react-small-apps/apps/todos/public/logo512.png differ diff --git a/public/projects/react-small-apps/apps/todos/public/manifest.json b/public/projects/react-small-apps/apps/todos/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/public/projects/react-small-apps/apps/todos/public/robots.txt b/public/projects/react-small-apps/apps/todos/public/robots.txt new file mode 100644 index 0000000..01b0f9a --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/public/robots.txt @@ -0,0 +1,2 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * diff --git a/public/projects/react-small-apps/apps/todos/src/App.js b/public/projects/react-small-apps/apps/todos/src/App.js new file mode 100644 index 0000000..66e7896 --- /dev/null +++ b/public/projects/react-small-apps/apps/todos/src/App.js @@ -0,0 +1,47 @@ +import "modern-normalize"; +import { useSelector } from "react-redux"; +import { Navigate, Route, Routes } from "react-router-dom"; +import { Footer, Header, Main } from "./components/layout"; +import Account from "./views/Account/Account"; +import LoginForm from "./views/LoginForm/LoginForm"; +import Logout from "./views/Logout/Logout"; +import Todo from "./views/Todo/Todo"; +import TodoList from "./views/TodoList/TodoList"; +import "./App.scss"; + +function App() { + const isLoggedIn = useSelector((state) => state.auth.isAuthenticated); + + return ( + <> +
+
+ + : + } + /> + } /> + } /> + : } + /> + : + } + /> + +
+