-
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.
- Loading branch information
Showing
23 changed files
with
594 additions
and
88 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,76 +1,66 @@ | ||
.content-container { | ||
display: flex; | ||
#user-management { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
justify-content: space-between; | ||
overflow: auto; | ||
} | ||
|
||
#dashboard-summary, | ||
#user-list { | ||
flex: 1; | ||
margin: 10px; | ||
} | ||
|
||
#dashboard-summary { | ||
background-color: #fff; | ||
border-radius: 8px; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
.user-view { | ||
gap: 20px; | ||
max-width: 1200px; | ||
margin: 20px; | ||
padding: 20px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
#dashboard-summary h2 { | ||
color: #333; | ||
margin-top: 0; | ||
} | ||
|
||
.stat { | ||
margin-bottom: 10px; | ||
} | ||
|
||
.stat-title { | ||
font-weight: bold; | ||
} | ||
|
||
.stat-value { | ||
float: right; | ||
} | ||
|
||
#user-list { | ||
background-color: #fff; | ||
background-color: var(--background-color); | ||
border-radius: 8px; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
padding: 20px; | ||
} | ||
|
||
#user-list h2 { | ||
color: #333; | ||
margin-top: 0; | ||
#user-management h2 { | ||
font-size: 1.5em; | ||
color: var(--primary-color); | ||
margin-bottom: 10px; | ||
} | ||
|
||
#user-list ul { | ||
#user-management ul { | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
#user-list li { | ||
border-bottom: 1px solid #eee; | ||
padding: 10px 0; | ||
} | ||
|
||
#user-list li:last-child { | ||
border-bottom: none; | ||
#user-management li { | ||
color: var(--primary-color); | ||
background-color: var(--secondary-color); | ||
border: 1px solid var(--primary-color); | ||
padding: 10px; | ||
margin: 10px; | ||
border-radius: 4px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
#user-list a { | ||
color: #007bff; | ||
text-decoration: none; | ||
.admin-button { | ||
background-color: var(--background-color); | ||
color: var(--primary-color); | ||
border: none; | ||
padding: 5px 10px; | ||
margin: 0 15px; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
font-size: large; | ||
} | ||
|
||
#user-list a:hover { | ||
text-decoration: underline; | ||
.admin-button:hover { | ||
background-color: var(--primary-color); | ||
color: var(--secondary-color); | ||
} | ||
|
||
.stat:after { | ||
content: ''; | ||
display: table; | ||
clear: both; | ||
} | ||
@media (max-width: 768px) { | ||
#user-management { | ||
display: grid; | ||
grid-template-columns: 1fr; | ||
grid-template-rows: 1fr 1fr; | ||
justify-content: space-between; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const approveButtons = document.getElementsByClassName('approve-button'); | ||
Array.from(approveButtons).forEach((approveButton) => { | ||
approveButton.addEventListener('click', async (event) => { | ||
try { | ||
await fetch( | ||
`/admin/approve-user/${event.target.dataset.userId}`, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'CSRF-Token': document | ||
.querySelector('meta[name="csrf-token"]') | ||
.getAttribute('content'), | ||
}, | ||
}, | ||
); | ||
window.location.reload(); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
} | ||
}); | ||
}); | ||
|
||
const lockButtons = document.getElementsByClassName('lock-button'); | ||
Array.from(lockButtons).forEach((lockButton) => { | ||
lockButton.addEventListener('click', async (event) => { | ||
try { | ||
await fetch(`/admin/lock-user/${event.target.dataset.userId}`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'CSRF-Token': document | ||
.querySelector('meta[name="csrf-token"]') | ||
.getAttribute('content'), | ||
}, | ||
}); | ||
window.location.reload(); | ||
} catch (error) { | ||
console.error('Error:', error); | ||
} | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import winston from 'winston'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import morgan from 'morgan'; | ||
|
||
export const logger = winston.createLogger({ | ||
exitOnError: false, | ||
format: winston.format.combine( | ||
winston.format.timestamp({ | ||
format: 'YYYY-MM-DD HH:mm:ss', | ||
}), | ||
winston.format.colorize(), | ||
winston.format.errors({ stack: true }), | ||
winston.format.printf( | ||
(info) => `${info.timestamp} ${info.level}: ${info.message}`, | ||
), | ||
), | ||
transports: [ | ||
new winston.transports.Console(), | ||
new winston.transports.File({ filename: 'logfile.log' }), | ||
], | ||
}); | ||
|
||
const accessLogStream = fs.createWriteStream( | ||
path.join(__dirname, '..', '..', 'access.log'), | ||
{ | ||
flags: 'a', | ||
}, | ||
); | ||
|
||
export const accessLogger = morgan('short', { stream: accessLogStream }); |
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
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
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
Oops, something went wrong.