Extract inline CSS/JS, add EJS templates with shared layout

- Extract CSS into public/css/{shared,players,courses}.css
- Extract JS into public/js/{chart,tooltips,progress,players,courses}.js
- Consolidate 5 duplicated tooltip blocks into setupTooltip() helper
- Add EJS view engine with layout partial and nav partial
- Convert HTML pages to EJS templates (index.ejs, courses.ejs)
- Add /courses route with redirect from /courses.html
- Remove old monolithic HTML files (1478 + 612 lines)
This commit is contained in:
Samuel Enocsson
2026-02-18 22:32:03 +01:00
parent 33a962e6b8
commit 20bbdbbfcf
18 changed files with 2010 additions and 2094 deletions
+348
View File
@@ -0,0 +1,348 @@
/* Player ratings page styles */
.progress-container {
width: 100%;
background-color: #f0f0f0;
border-radius: 10px;
padding: 3px;
margin: 20px 0;
}
.progress-bar {
width: 0%;
height: 30px;
background-color: #007bff;
border-radius: 8px;
text-align: center;
line-height: 30px;
color: white;
font-weight: bold;
transition: width 0.3s ease;
}
.progress-text {
text-align: center;
margin: 10px 0;
font-size: 16px;
color: #666;
}
.mobile-only {
display: none;
}
@media (max-width: 768px) {
.mobile-only {
display: block;
}
.player-name {
font-weight: bold;
}
.chart-container {
height: 250px;
margin: 5px 0;
}
.chart-title {
font-size: 14px;
}
}
.chart-container {
width: 100%;
height: 300px;
margin: 10px 0;
border: 1px solid #ddd;
border-radius: 4px;
background: white;
}
.chart-title {
text-align: center;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.loading-chart {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
color: #666;
}
.chart-tooltip {
position: fixed;
background-color: rgba(0, 0, 0, 0.9);
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 12px;
pointer-events: none;
z-index: 10000;
display: none;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.2);
}
.rating {
font-weight: bold;
color: #007bff;
}
.std-dev-tooltip {
position: absolute;
background-color: rgba(0, 0, 0, 0.9);
color: white;
padding: 8px 12px;
border-radius: 4px;
font-size: 12px;
pointer-events: none;
z-index: 10000;
display: none;
white-space: nowrap;
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
border: 1px solid rgba(255,255,255,0.2);
font-weight: normal;
}
.predicted-value {
position: relative;
display: inline-block;
}
.pdga-number {
color: #6c757d;
font-size: 14px;
}
.difference {
font-weight: bold;
}
.positive {
color: #28a745;
}
.negative {
color: #dc3545;
}
.neutral {
color: #6c757d;
}
.rating-change {
font-weight: bold;
font-size: 14px;
}
.refresh-section {
display: inline-flex;
align-items: center;
}
.debug-icon:hover {
opacity: 1 !important;
color: #007bff !important;
transform: scale(1.1);
}
.debug-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10001;
display: none;
justify-content: center;
align-items: center;
}
.debug-content {
background: white;
border-radius: 8px;
padding: 20px;
max-width: 600px;
max-height: 80vh;
overflow-y: auto;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.debug-header {
font-weight: bold;
font-size: 18px;
margin-bottom: 15px;
color: #333;
border-bottom: 2px solid #007bff;
padding-bottom: 10px;
}
.debug-log {
font-family: 'Courier New', monospace;
background-color: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 4px;
padding: 15px;
font-size: 12px;
line-height: 1.4;
white-space: pre-line;
color: #495057;
}
.debug-close {
position: absolute;
top: 10px;
right: 15px;
font-size: 24px;
color: #999;
cursor: pointer;
background: none;
border: none;
}
.debug-close:hover {
color: #333;
}
.add-player-section {
background-color: #f8f9fa;
border: 2px solid #007bff;
border-radius: 8px;
padding: 20px;
margin-bottom: 30px;
text-align: center;
}
.add-player-section h3 {
margin-top: 0;
margin-bottom: 15px;
color: #333;
font-size: 18px;
}
.add-player-form {
display: flex;
justify-content: center;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.pdga-input {
padding: 10px 15px;
font-size: 16px;
border: 2px solid #ddd;
border-radius: 4px;
outline: none;
width: 250px;
transition: border-color 0.2s;
}
.pdga-input:focus {
border-color: #007bff;
}
.btn-add {
background-color: #28a745;
}
.btn-add:hover {
background-color: #218838;
}
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10001;
display: none;
justify-content: center;
align-items: center;
}
.modal-content {
background: white;
border-radius: 8px;
padding: 0;
max-width: 500px;
width: 90%;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
position: relative;
}
.modal-header {
font-weight: bold;
font-size: 20px;
padding: 20px;
color: #333;
border-bottom: 2px solid #007bff;
}
.modal-body {
padding: 20px;
font-size: 16px;
color: #495057;
line-height: 1.6;
}
.modal-footer {
padding: 15px 20px;
border-top: 1px solid #e9ecef;
display: flex;
justify-content: flex-end;
gap: 10px;
}
.modal-close {
position: absolute;
top: 10px;
right: 15px;
font-size: 28px;
color: #999;
cursor: pointer;
background: none;
border: none;
line-height: 1;
}
.modal-close:hover {
color: #333;
}
.btn-cancel {
background-color: #6c757d;
}
.btn-cancel:hover {
background-color: #5a6268;
}
.btn-confirm {
background-color: #28a745;
}
.btn-confirm:hover {
background-color: #218838;
}
@media (max-width: 768px) {
.add-player-section {
padding: 15px;
}
.add-player-form {
flex-direction: column;
}
.pdga-input {
width: 100%;
}
}