Skip to content

Btest #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open

Btest #446

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
6963647
add redux and fix it
Sep 26, 2024
571acbb
chore: update project name and version in package.json
Apr 4, 2025
6673174
feat: implement authentication flow with Redux and improve login UI
Apr 4, 2025
811350f
chore: update index.html metadata and title for TakeIt project
Apr 25, 2025
efc07f5
feat: add react-toastify for error notifications on login failure
Apr 25, 2025
ba5f706
feat: enhance ToastContainer with closeOnClick option for better user…
Apr 25, 2025
4b0f002
chore: comment out AppSidebar and AppHeader in DefaultLayout for clea…
Apr 25, 2025
f11a901
feat: refactor authentication check and replace HashRouter with Brows…
Apr 25, 2025
7c87f9d
fix: update state selector in AppHeader and AppSidebar to use 'data' …
Apr 25, 2025
1ab36e2
feat: add sidebar styles and RTL support
Apr 25, 2025
b8ae8a6
fix: update react-router-dom to version 7.5.2 for improved routing ca…
Apr 25, 2025
03a4aa5
feat: enhance login page UI with CoreUI components and improved layout
Apr 25, 2025
1d4e7bc
feat: implement logout functionality with async actions and update au…
Apr 25, 2025
9c3e4d1
fix: handle login errors and ensure authentication check is awaited
Apr 28, 2025
1f6ac36
feat: implement role-based layout and header components for employees…
Apr 28, 2025
02d1916
feat: add Tickets page and update routing to include it
Apr 28, 2025
c70f83e
feat: improve authentication flow with enhanced error handling and re…
Apr 29, 2025
0de6531
feat: add authentication check to AppHeaderDropdown component
Apr 29, 2025
05ed3a0
feat: implement create ticket modal with open/close functionality
Apr 30, 2025
e35a642
feat: refactor authentication and layout components; add Jira configu…
May 1, 2025
0d90ea2
feat: remove debug log from authentication check function
May 3, 2025
3304b3c
feat: format ToastContainer props for improved readability
May 3, 2025
7bed9f8
feat: set initial sidebarShow state to false
May 3, 2025
8d4882b
feat: add Jira API connection and configuration management features
May 3, 2025
baf7732
feat: update ESLint configuration and dependencies for improved linti…
May 7, 2025
587170b
feat: implement CRUD operations for Jira configuration management and…
May 7, 2025
dca03ff
feat: update ESLint rules to disable console usage and warn on unused…
May 7, 2025
d270dc9
feat: enhance Jira configuration management by adding enable/disable …
May 7, 2025
db8b368
feat: update login actions and reducer to handle user roles on login …
May 7, 2025
0750d3d
feat: add Projet page and update routing to include project list
May 8, 2025
92bdd90
feat: implement ticket management with CRUD operations and modal func…
May 8, 2025
5722ca9
feat: enhance Tickets component to fetch and display ticket data in a…
May 8, 2025
842bc65
feat: add Material-UI core and icons, and jsPDF libraries to dependen…
May 11, 2025
0bfaa61
refactor: optimize AppContent component structure for better readability
May 11, 2025
1233dd8
feat: add MaterialTableIcons component for table icon customization
May 11, 2025
d081d33
feat: implement DetailPanelTableTicket component and integrate with M…
May 11, 2025
f4f238e
refactor: simplify DetailPanelTableTicket layout and improve code rea…
May 11, 2025
c157227
refactor: enhance authentication check logic in App component
May 21, 2025
6a96386
feat: enhance DetailPanelTableTicket component with conditional rende…
May 21, 2025
41eef2b
feat: implement user management actions, reducer, and service for fet…
May 21, 2025
8c93b05
refactor: replace CSpinner with CircularProgress for consistent loadi…
May 21, 2025
8c3796b
feat: add Emotion and MUI dependencies for enhanced styling capabilities
May 21, 2025
3585d4e
feat: create BugIssueForm component and integrate it into ModalCreate…
May 21, 2025
7f7fc8e
feat: add new dependencies for date handling and rich text editing
May 21, 2025
f66465c
feat: wrap ToastContainer with StyledEngineProvider for improved styl…
May 21, 2025
7a070a4
feat: enhance BugIssueForm with rich text editor, priority selection,…
May 21, 2025
07b522f
feat: remove unused Page404, Page500, and Register components
May 22, 2025
c792d9e
feat: remove AppSidebar component and related references for a cleane…
May 22, 2025
20b8706
feat: remove unused Register, Page404, and Page500 components for a c…
May 22, 2025
ccb13cf
feat: integrate Toolpad for enhanced login functionality and add auth…
May 22, 2025
d9d6c8d
feat: add SVG icons for issue types (bug, epic, story, task) and prio…
May 31, 2025
a0df46a
feat: refactor issue forms and add emptyIssue utility for ticket crea…
May 31, 2025
238b578
feat: implement add new ticket functionality with API integration and…
Jun 1, 2025
99e2964
feat: implement project management features including CRUD operations…
Jun 14, 2025
81374ea
feat: add edit project functionality with modal integration and API h…
Jun 15, 2025
2a1be2c
fix: update editProject API endpoint to use correct URL for project u…
Jun 15, 2025
d520593
feat: close edit project modal after successful project update
Jun 15, 2025
4857307
feat: close add new project modal after successfully updating project…
Jun 15, 2025
4274f12
fix: update tickets link to point to the correct tickets list route
Jun 15, 2025
1ab76d5
feat: add exact route for tickets and new route for tickets list
Jun 15, 2025
04975f1
refactor: improve breadcrumb logic and simplify route matching
Jun 15, 2025
a117cca
fix: update footer links and copyright year in AppFooter component
Jun 23, 2025
df83b66
fix: replace CircularProgress with CSpinner for consistent loading in…
Jun 23, 2025
f0599e8
feat: add loading spinner to Projet component for better user experience
Jun 23, 2025
573ec7a
feat: enhance TicketsHome component with loading state and improved l…
Jun 23, 2025
cb15606
feat: integrate toggleCreateTicketModalOpen action in Tickets component
Jul 2, 2025
896a12c
Refactor ticket creation modal and forms to use CoreUI components
Jul 2, 2025
42ad864
feat: add @tinymce/miniature dependency to enhance text editing capab…
Jul 2, 2025
abff6c4
refactor: remove unused Material-UI dependencies and components
Jul 2, 2025
03b0708
feat: enhance ticket creation and viewing experience with improved fo…
Jul 2, 2025
dbba53d
fix: update project description in package.json
Jul 3, 2025
0732734
Merge pull request #2 from aminederouich/tst
aminederouich Jul 3, 2025
5906702
commit test
Jul 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
module.exports = {
env: {
browser: true, // Enables browser global variables
es2021: true, // Enables ES2021 global variables
node: true, // Enables Node.js global variables
jest: true, // Enables Jest global variables
},
extends: [
'eslint:recommended', // Uses the recommended rules from ESLint
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'plugin:react-hooks/recommended', // Enforces the Rules of Hooks
],
// parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
Expand All @@ -7,17 +19,15 @@ module.exports = {
jsx: true, // Allows for the parsing of JSX
},
},
plugins: ['react', 'react-hooks'],
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
plugins: ['react', 'react-hooks'],
rules: {
console: 'off', // Disables the no-console rule
'no-unused-vars': 'warn', // Warns about unused variables
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
},
Expand Down
11 changes: 2 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
<!DOCTYPE html>
<!--
* CoreUI Free React.js Admin Template
* @version v5.2.0
* @link https://coreui.io/product/free-react-admin-template/
* Copyright (c) 2024 creativeLabs Łukasz Holeczek
* Licensed under MIT (https://github.com/coreui/coreui-free-react-admin-template/blob/main/LICENSE)
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="CoreUI for React - Open Source Bootstrap Admin Template">
<meta name="description" content="TakeIt">
<meta name="author" content="Łukasz Holeczek">
<meta name="keyword" content="Bootstrap,Admin,Template,Open,Source,CSS,SCSS,HTML,RWD,Dashboard,React">
<title>CoreUI Free React.js Admin Template</title>
<title>TakeIt</title>
<link rel="manifest" href="/manifest.json">
<link rel="shortcut icon" href="/favicon.ico">
</head>
Expand Down
38 changes: 29 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@coreui/coreui-free-react-admin-template",
"version": "5.2.0",
"description": "CoreUI Free React Admin Template",
"name": "taketit",
"version": "0.0.0",
"description": "Projet PFE 2025",
"homepage": ".",
"bugs": {
"url": "https://github.com/coreui/coreui-free-react-admin-template/issues"
Expand All @@ -14,7 +14,8 @@
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
"scripts": {
"build": "vite build",
"lint": "eslint \"src/**/*.js\"",
"lint": "eslint src/**/*.{js,jsx}",
"lint:fix": "eslint src/**/*.{js,jsx} --fix",
"serve": "vite preview",
"start": "vite"
},
Expand All @@ -26,29 +27,48 @@
"@coreui/react": "^5.4.0",
"@coreui/react-chartjs": "^3.0.0",
"@coreui/utils": "^2.0.2",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^7.1.0",
"@mui/material": "^7.1.0",
"@mui/styled-engine-sc": "^7.1.0",
"@mui/x-date-pickers": "^8.3.1",
"@popperjs/core": "^2.11.8",
"@tinymce/miniature": "^6.0.0",
"@tinymce/tinymce-react": "^6.1.0",
"@toolpad/core": "^0.15.0",
"axios": "^1.7.7",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"chart.js": "^4.4.4",
"classnames": "^2.5.1",
"core-js": "^3.38.1",
"date-fns": "^4.1.0",
"jspdf": "^3.0.1",
"jspdf-autotable": "^5.0.2",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.26.2",
"react-router-dom": "^7.5.2",
"react-toastify": "^11.0.5",
"redux": "5.0.1",
"simplebar-react": "^3.2.6"
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^3.1.0",
"simplebar-react": "^3.2.6",
"styled-components": "^6.1.18"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.2",
"postcss": "^8.4.47",
"prettier": "3.3.3",
"sass": "^1.79.3",
"vite": "^5.4.8"
"vite": "^6.2.0"
}
}
65 changes: 38 additions & 27 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,66 @@
import React, { Suspense, useEffect } from 'react'
import { HashRouter, Route, Routes } from 'react-router-dom'
import { useSelector } from 'react-redux'

import { CSpinner, useColorModes } from '@coreui/react'
import React, { Suspense, useCallback, useEffect, useRef, useState } from 'react'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { useDispatch } from 'react-redux'
import './scss/style.scss'
import PrivateRoute from './PrivateRute'
import { checkAuthentication } from './actions/authActions'
import { CSpinner } from '@coreui/react'

// Containers
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))

// Pages
const Login = React.lazy(() => import('./views/pages/login/Login'))
const Register = React.lazy(() => import('./views/pages/register/Register'))
const Page404 = React.lazy(() => import('./views/pages/page404/Page404'))
const Page500 = React.lazy(() => import('./views/pages/page500/Page500'))

const App = () => {
const { isColorModeSet, setColorMode } = useColorModes('coreui-free-react-admin-template-theme')
const storedTheme = useSelector((state) => state.theme)
const dispatch = useDispatch()
const [isChecking, setIsChecking] = useState(true)

useEffect(() => {
const urlParams = new URLSearchParams(window.location.href.split('?')[1])
const theme = urlParams.get('theme') && urlParams.get('theme').match(/^[A-Za-z0-9\s]+/)[0]
if (theme) {
setColorMode(theme)
const isFirstRender = useRef(true)

const checkAuth = useCallback(async () => {
try {
await dispatch(checkAuthentication())
} catch (error) {
console.error('Authentication check failed:', error)
} finally {
setIsChecking(false)
}
}, [dispatch])

if (isColorModeSet()) {
return
useEffect(() => {
if (isFirstRender.current) {
checkAuth()
isFirstRender.current = false
}
}, [checkAuth])

setColorMode(storedTheme)
}, []) // eslint-disable-line react-hooks/exhaustive-deps
if (isChecking) {
return (
<div className="pt-3 text-center">
<CSpinner size="3rem" />
</div>
)
}

return (
<HashRouter>
<BrowserRouter>
<Suspense
fallback={
<div className="pt-3 text-center">
<CSpinner color="primary" variant="grow" />
<CSpinner size="3rem" />
</div>
}
>
<Routes>
<Route exact path="/login" name="Login Page" element={<Login />} />
<Route exact path="/register" name="Register Page" element={<Register />} />
<Route exact path="/404" name="Page 404" element={<Page404 />} />
<Route exact path="/500" name="Page 500" element={<Page500 />} />
<Route path="*" name="Home" element={<DefaultLayout />} />
<Route path="/login" name="Login Page" element={<Login />} />
<Route element={<PrivateRoute />} exact>
<Route path="/" element={<DefaultLayout />} />
<Route path="*" element={<DefaultLayout />} />
</Route>
</Routes>
</Suspense>
</HashRouter>
</BrowserRouter>
)
}

Expand Down
11 changes: 11 additions & 0 deletions src/PrivateRute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable prettier/prettier */
import React from 'react'
import { Navigate, Outlet } from 'react-router-dom'
import { useSelector } from 'react-redux'

const PrivateRoute = () => {
const isAuthenticated = useSelector((state) => state.auth.isAuthenticated)
return isAuthenticated ? <Outlet /> : <Navigate to="/login" />
}

export default PrivateRoute
37 changes: 0 additions & 37 deletions src/_nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,43 +268,6 @@ const _nav = [
text: 'NEW',
},
},
{
component: CNavTitle,
name: 'Extras',
},
{
component: CNavGroup,
name: 'Pages',
icon: <CIcon icon={cilStar} customClassName="nav-icon" />,
items: [
{
component: CNavItem,
name: 'Login',
to: '/login',
},
{
component: CNavItem,
name: 'Register',
to: '/register',
},
{
component: CNavItem,
name: 'Error 404',
to: '/404',
},
{
component: CNavItem,
name: 'Error 500',
to: '/500',
},
],
},
{
component: CNavItem,
name: 'Docs',
href: 'https://coreui.io/react/docs/templates/installation/',
icon: <CIcon icon={cilDescription} customClassName="nav-icon" />,
},
]

export default _nav
9 changes: 9 additions & 0 deletions src/actions/appActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable prettier/prettier */
export const toggleUnfoldable = () => ({
type: 'TOGGLE_UNFOLDABLE',
})

export const switchThemeMode = (theme) => ({
type: 'CHANGE_THEME',
payload: theme
})
98 changes: 98 additions & 0 deletions src/actions/authActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import React from 'react'
import authService from '../services/authService'

export const loginRequest = () => ({
type: 'LOGIN_REQUEST',
})

export const loginSuccess = (user, role) => ({
type: 'LOGIN_SUCCESS',
payload: { user, role },
})

export const loginFailure = (error) => ({
type: 'LOGIN_FAILURE',
payload: error,
})

export const logoutRequest = () => ({
type: 'LOGOUT_REQUEST',
})

export const logoutSuccess = (user) => ({
type: 'LOGOUT_SUCCESS',
payload: user,
})

export const logoutFailure = (error) => ({
type: 'LOGOUT_FAILURE',
payload: error,
})

export const login = (username, password) => (dispatch) => {
dispatch(loginRequest())
return authService
.login(username, password)
.then((response) => {
if (response.error) {
dispatch(loginFailure(response.error))
throw new Error(response.error)
} else {
const user = response.user
if (user.IsEmployee && user.IsManager === false) {
dispatch(loginSuccess(response, 'employee'))
}
if (user.IsManager && user.IsEmployee === false) {
dispatch(loginSuccess(response, 'manager'))
}
return response
}
})
.catch((error) => {
dispatch(loginFailure(error))
throw new Error(error)
})
}

export const logout = () => async (dispatch) => {
dispatch(logoutRequest())
try {
const user = await authService.logout()
dispatch(logoutSuccess(user))
} catch (error) {
dispatch(logoutFailure(error))
console.error('Error logging out:', error)
}
}

export const checkAuthRequest = () => ({
type: 'AUTH_CHECK_REQUEST',
})

export const checkAuthSuccess = (data) => ({
type: 'AUTH_CHECK_SUCCESS',
payload: data,
})

export const checkAuthFailure = () => ({
type: 'AUTH_CHECK_FAILURE',
})

export const checkAuthentication = () => (dispatch) => {
dispatch(checkAuthRequest())
return authService
.checkAuth()
.then((response) => {
if (response.data.error) {
dispatch(checkAuthFailure())
throw new Error(response.error)
} else {
dispatch(checkAuthSuccess(response.data))
return response
}
})
.catch((error) => {
dispatch(checkAuthFailure())
throw new Error(error)
})
}
Loading