Skip to content

Commit

Permalink
Create user Support
Browse files Browse the repository at this point in the history
  • Loading branch information
avi-friedman-IL committed Jun 27, 2024
1 parent df320d0 commit 9f85b9c
Show file tree
Hide file tree
Showing 23 changed files with 605 additions and 132 deletions.
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"cSpell.words": [
"cmps"
"btns",
"cmps",
"Creds",
"cryptr",
"Fridman",
"fullName",
"Loggedin",
"puki",
"Signup"
],
"files.autoSave": "onWindowChange"
}
89 changes: 38 additions & 51 deletions data/bug.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,60 @@
[
{
"_id": "2DAMr",
"title": "bug bug bug",
"title": "remove bug",
"description": "",
"severity": 2,
"createdAt": 1719175921925,
"labels": [
"critical",
"need-CR"
]
},
{
"_id": "j1k2l3",
"title": "Update documentation",
"description": "Updating the project documentation for new release.",
"severity": 3,
"createdAt": 1625400000000,
"labels": [
"need-CR"
]
},
{
"_id": "m4n5o6",
"title": "Refactor codebase",
"description": "Refactoring the codebase for better readability and maintenance.",
"severity": 4,
"createdAt": 1625486400000,
"severity": 1,
"createdAt": 1719475554079,
"labels": [
"dev-branch"
]
],
"owner": {
"_id": "hVgTr",
"fullName": "Avi Fridman"
},
"_id": "0wxix"
},
{
"_id": "p7q8r9",
"title": "Fix security issue",
"description": "Addressing the security vulnerability identified in the audit.",
"severity": 5,
"createdAt": 1625572800000,
"title": "update book",
"description": "",
"severity": 4,
"createdAt": 1719475593863,
"labels": [
"critical",
"need-CR"
]
],
"owner": {
"_id": "hVgTr",
"fullName": "Avi Fridman"
},
"_id": "LRBIW"
},
{
"title": "critical",
"title": "add book",
"description": "",
"severity": 7,
"createdAt": 1719145297585,
"severity": 1,
"createdAt": 1719475629762,
"labels": [
"critical"
"need-CR"
],
"_id": "nTLX4"
"owner": {
"_id": "hVgTr",
"fullName": "Avi Fridman"
},
"_id": "FLxP6"
},
{
"_id": "dsLh6",
"title": "bagin",
"title": "get books",
"description": "",
"severity": 3,
"createdAt": 1719245951212,
"createdAt": 1719475764771,
"labels": [
"critical",
"need-CR"
]
},
{
"title": "",
"description": "",
"severity": 0,
"createdAt": 1719328488572,
"labels": [],
"_id": "la15X"
"need-CR",
"critical"
],
"owner": {
"_id": "tcgSM",
"fullName": "puki"
},
"_id": "RitB3"
}
]
15 changes: 15 additions & 0 deletions data/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"username": "Avi Fridman",
"password": "1234",
"fullName": "Avi Fridman",
"_id": "hVgTr",
"isAdmin": true
},
{
"username": "puki",
"password": "1234",
"fullName": "puki",
"_id": "tcgSM"
}
]
53 changes: 53 additions & 0 deletions logs/backend.log
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,56 @@
25.6.2024, 17:46:35 - INFO - Server listening on port http://127.0.0.1:3030/
25.6.2024, 17:49:06 - INFO - Server listening on port http://127.0.0.1:3030/
25.6.2024, 17:56:26 - INFO - Server listening on port http://127.0.0.1:3030/
25.6.2024, 21:39:06 - INFO - Server listening on port http://127.0.0.1:3030/
25.6.2024, 21:39:51 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 0:17:38 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 0:18:41 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 0:18:57 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 2:00:52 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 13:04:30 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 17:53:15 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 17:56:48 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 17:58:06 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 17:59:21 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 18:05:27 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:05:57 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:06:53 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:13:02 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:22:52 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:26:10 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:27:51 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:28:01 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:38:34 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:42:16 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:56:11 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 19:56:18 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:11:12 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:12:28 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:14:42 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:17:40 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:19:10 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:29:06 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:29:32 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:30:13 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 21:32:09 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 23:17:10 - INFO - Server listening on port http://127.0.0.1:3030/
26.6.2024, 23:49:39 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 10:54:03 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:10:15 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:12:05 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:19:46 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:21:23 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:23:50 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:26:54 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:28:00 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:28:30 - ERROR - Cannot remove bug | Not your bug!
27.6.2024, 11:29:30 - ERROR - Cannot save bug | Not your bug!
27.6.2024, 11:30:10 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:32:25 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:32:37 - ERROR - Cannot remove bug | Not your bug!
27.6.2024, 11:35:21 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:35:46 - ERROR - Cannot remove bug | Not your bug!
27.6.2024, 11:38:24 - ERROR - Cannot save bug | Not your bug!
27.6.2024, 11:42:41 - INFO - Server listening on port http://127.0.0.1:3030/
27.6.2024, 11:44:58 - ERROR - Cannot remove bug | Not your bug!
27.6.2024, 11:45:00 - ERROR - Cannot remove bug | Not your bug!
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"description": "",
"dependencies": {
"cookie-parser": "^1.4.6",
"cryptr": "^6.3.0",
"express": "^4.19.2",
"follow-redirects": "^1.15.6",
"nodemon": "^3.1.3",
Expand Down
4 changes: 2 additions & 2 deletions public/RootCmp.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Router = ReactRouterDOM.BrowserRouter
// const Router = ReactRouterDOM.HashRouter
// const Router = ReactRouterDOM.BrowserRouter
const Router = ReactRouterDOM.HashRouter
const { Route, Routes } = ReactRouterDOM

import { AppHeader } from './cmps/AppHeader.jsx'
Expand Down
5 changes: 5 additions & 0 deletions public/assets/style/cmps/AppHeader.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
header {
margin-block-end: 1em;
}

.header-container {
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-flow: column;
justify-content: space-between;
align-items: center;

color: var(--clr1);
}

.header-container h1 {
grid-column: 1;
}
Expand Down
9 changes: 8 additions & 1 deletion public/assets/style/cmps/BugFilter.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.bug-filter {
display: grid;
grid-auto-flow: column;
justify-items: center;
align-items: center;
gap: 10px;

padding: 1em;
border-radius: 3em;
background-image: var(--clr2bgi);
Expand All @@ -20,3 +21,9 @@
outline: none;
}

@media(width <= 1050px) {
.labels-filter {
grid-row: 2;
}
}

18 changes: 18 additions & 0 deletions public/assets/style/cmps/BugList.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,21 @@
background-image: var(--clr2bgi);
color: var(--clr2);
}

@media (width <= 600px) {
.bug-list {
padding: 0;
height: 35vh;
overflow-y: scroll;
}
.bug-list li {
display: grid;
grid-auto-flow: row;
grid-template-columns: 1fr;
justify-items: center;
align-items: center;
gap: 10px;

padding: 0.75em;
}
}
13 changes: 13 additions & 0 deletions public/assets/style/cmps/LoginSignup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.login-signup {

}

.login-signup input {
padding: .5em;
border: 0;
border-radius: 3em;
}

.login-signup input:focus {
outline: none;
}
1 change: 1 addition & 0 deletions public/assets/style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
@import "cmps/BugEdit.css";
@import "cmps/GetPageBugs.css";
@import "cmps/AddBug.css";
@import "cmps/LoginSignup.css";
44 changes: 37 additions & 7 deletions public/cmps/AppHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,53 @@
const { NavLink } = ReactRouterDOM
const { useEffect } = React
const {Link, NavLink } = ReactRouterDOM
const { useNavigate } = ReactRouter
const { useState } = React

import { showErrorMsg } from '../services/event-bus.service.js'
import { userService } from '../services/user.service.js'
import { LoginSignup } from './LoginSignup.jsx'
import { UserMsg } from './UserMsg.jsx'

export function AppHeader() {
useEffect(() => {
// component did mount when dependancy array is empty
}, [])
const [user, setUser] = useState(userService.getLoggedinUser())

const navigate = useNavigate()

function onLogout() {
userService
.logout()
.then(() => {
onSetUser(null)
})
.catch(err => {
showErrorMsg('OOPs try again')
})
}

function onSetUser(user) {
setUser(user)
// navigate('/')
}
console.log('user:', user)
return (
<header className="main-layout">
<div className="header-container">
<section className="header-container">
<UserMsg />
<h1>Bugs are Forever</h1>
<nav>
<NavLink to="/">Home</NavLink> |<NavLink to="/bug">Bugs</NavLink> |
<NavLink to="/about">About</NavLink>
</nav>
</div>
</section>
{user ? (
<section>
<button onClick={onLogout}>Logout</button>
<Link to={`/user/${user._id}`}>{`Hello ${user.fullName}`}</Link>
</section>
) : (
<section>
<LoginSignup onSetUser={onSetUser} />
</section>
)}
</header>
)
}
Loading

0 comments on commit 9f85b9c

Please sign in to comment.