refactor: rewrite UI with clean layout, fetch API, and proper card structure
All checks were successful
CI / Lint (push) Successful in 4s
CI / Test (push) Successful in 5s
CI / Build & Push (push) Successful in 14s

This commit is contained in:
2026-03-29 09:41:34 -04:00
parent 73af434851
commit 10d7cb9b02
3 changed files with 334 additions and 556 deletions

View File

@@ -1,381 +1,239 @@
body {
background-color: #121212;
font-family: Arial, sans-serif;
color: #fff;
:root {
--bg: #111;
--card: #1c1c1c;
--card-border: #2a2a2a;
--badge-bg: #2a2a2a;
--text: #f0f0f0;
--text-muted: #777;
--green-bg: #14532d;
--green-text: #86efac;
--red: #ef4444;
--gap: 0.875rem;
--radius: 10px;
--card-w: 250px;
}
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
margin-top: 0.8%;
margin-bottom: 1.5%;
color: #f2f2f2;
font-size: 2.2em;
body {
background: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
min-height: 100vh;
}
.scoreboard {
/* ── Header ─────────────────────────────────────── */
header {
padding: 1rem 1.25rem 0.5rem;
}
.header-title {
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.15em;
color: var(--text-muted);
}
/* ── Layout ─────────────────────────────────────── */
main {
padding: 0.75rem 1.25rem 2rem;
}
.section {
margin-bottom: 2rem;
}
.section.hidden {
display: none;
}
.section-heading {
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--text-muted);
margin-bottom: 0.75rem;
}
.games-grid {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin-top: 20px;
gap: var(--gap);
}
/* ── Game Card ──────────────────────────────────── */
.game-box {
background-color: #333;
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 1%;
width: 16%;
max-width: 350px;
position: relative;
margin-left: 1%;
margin-right: 1%;
margin-bottom: 1.15%;
background: var(--card);
border: 1px solid var(--card-border);
border-radius: var(--radius);
padding: 0.875rem;
width: var(--card-w);
flex-shrink: 0;
}
.team-info {
/* ── Card Header (badges + live dot) ───────────── */
.card-header {
display: flex;
align-items: center;
margin-bottom: 2%;
margin-top: 9%;
justify-content: space-between;
margin-bottom: 0.5rem;
min-height: 1.25rem;
}
.team-info-column {
.badges {
display: flex;
flex-direction: column;
gap: 0.3rem;
align-items: center;
flex-wrap: wrap;
}
.team-logo {
width: 18%;
height: auto;
margin-right: 2.25%;
.badge {
font-size: 0.65rem;
font-weight: 700;
padding: 0.2rem 0.45rem;
border-radius: 4px;
text-transform: uppercase;
letter-spacing: 0.05em;
background: var(--badge-bg);
color: var(--text);
white-space: nowrap;
}
.team-name {
font-size: 1rem;
font-weight: bold;
.badge-live {
background: var(--green-bg);
color: var(--green-text);
}
/* Add a media query for screens between 769px and 900px */
@media only screen and (max-width: 950px) and (min-width: 769px) {
.team-name {
font-size: 0.55rem; /* Adjusted font size for screens between 769px and 900px */
}
}
.team-score {
font-size: 1.35rem;
font-weight: bold;
margin-left: auto;
}
.team-record {
font-size: 0.8rem;
font-weight: bold;
margin-left: auto;
}
/* Add a media query for screens between 769px and 900px */
@media only screen and (max-width: 950px) and (min-width: 769px) {
.team-record {
font-size: 0.45rem; /* Adjusted font size for screens between 769px and 900px */
}
}
.team-sog {
font-size: 0.75rem;
color: #ddd;
}
.team-power-play {
font-size: 12px;
color: red;
margin-left: 10px;
}
.game-info {
margin-top: 12px;
color: #aaa;
text-align: center;
font-size: 80%;
}
.hype-meter-label {
margin-top: 3%;
color: #aaa;
text-align: center;
font-size: 80%;
margin-bottom: 3%;
.badge-muted {
color: var(--text-muted);
}
.live-dot {
position: absolute;
top: 5px;
right: 5px;
width: 10px;
height: 10px;
background-color: red;
width: 7px;
height: 7px;
background: var(--red);
border-radius: 50%;
flex-shrink: 0;
animation: pulse 1.8s ease-in-out infinite;
}
.pre-state {
position: absolute;
top: 5%;
left: 3%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 0.75rem;
color: #fff;
font-weight: bolder;
z-index: 1;
width: auto;
height: 7%;
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
/* ── Team Rows ──────────────────────────────────── */
.team-row {
display: flex;
justify-content: space-evenly;
align-items: center;
gap: 0.5rem;
padding: 0.45rem 0;
}
/* Add a media query for screens between 769px and 900px */
@media only screen and (max-width: 950px) and (min-width: 769px) {
.pre-state {
font-size: 0.55rem; /* Adjusted font size for screens between 769px and 900px */
}
.team-row + .team-row {
border-top: 1px solid var(--card-border);
}
.final-state {
position: absolute;
top: 5%;
left: 3%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 0.7rem;
color: #ddd;
z-index: 1;
font-weight: bold;
width: auto;
height: 7%;
display: flex;
justify-content: space-evenly;
align-items: center;
.team-logo {
width: 30px;
height: 30px;
object-fit: contain;
flex-shrink: 0;
}
.live-state {
position: absolute;
top: 4%;
left: 4%;
background-color: #0b6e31;
padding: 1.5%;
border-radius: 5px;
.team-meta {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 0.1rem;
}
.team-name {
font-size: 0.825rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.team-sog {
font-size: 0.68rem;
color: var(--text-muted);
}
.team-pp {
font-size: 0.68rem;
color: var(--red);
font-weight: 600;
}
.team-score {
font-size: 1.2rem;
font-weight: 700;
margin-left: auto;
flex-shrink: 0;
min-width: 1.5rem;
text-align: right;
}
.team-record {
font-size: 0.72rem;
color: #fff;
font-weight: bolder;
z-index: 1;
width: 7%;
height: 7%;
display: flex;
justify-content: space-evenly;
align-items: center;
color: var(--text-muted);
margin-left: auto;
flex-shrink: 0;
white-space: nowrap;
}
.live-time {
position: absolute;
top: 4%;
left: 15%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 0.75rem;
color: #ddd;
z-index: 1;
display: flex;
justify-content: space-evenly;
align-items: center;
width: 10%;
height: 7%;
/* ── Hype Meter ─────────────────────────────────── */
.hype-meter {
margin-top: 0.75rem;
}
.live-state-intermission {
position: absolute;
top: 4%;
left: 4%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
color: #fff;
font-weight: bolder;
z-index: 1;
width: 11%;
height: 8.5%;
display: flex;
justify-content: space-evenly;
align-items: center;
.hype-label {
display: block;
font-size: 0.6rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--text-muted);
margin-bottom: 0.3rem;
}
.live-time-intermission {
position: absolute;
top: 4%;
left: 19%;
background-color: #444;
padding: 1.5%;
border-radius: 5px;
font-size: 0.75rem;
color: #ddd;
z-index: 1;
width: 10%;
height: 8.5%;
display: flex;
justify-content: space-evenly;
align-items: center;
}
#live-games-section {
display: flex;
align-items: start;
flex-wrap: wrap;
justify-content: flex-start;
}
#pre-games-section {
display: flex;
align-items: start;
flex-wrap: wrap;
justify-content: flex-start;
}
#final-games-section {
display: flex;
align-items: start;
flex-wrap: wrap;
justify-content: flex-start;
}
/* Add styles for the game score gauge */
.game-score-gauge {
height: 1%;
background-color: #ccc;
border-radius: 5px;
overflow: hidden;
.gauge-track {
height: 4px;
background: var(--badge-bg);
border-radius: 99px;
overflow: hidden;
}
.gauge {
height: 10px; /* Adjust height as needed */
/*#8A2BE2*/
/*#6699CC*/
height: 100%;
border-radius: 99px;
width: 0;
transition: width 0.5s ease;
}
/* Add media query for smaller screens */
@media only screen and (max-width: 768px) {
.scoreboard {
flex-direction: column; /* Change direction to column for smaller screens */
align-items: center; /* Center align items */
/* ── Mobile ─────────────────────────────────────── */
@media (max-width: 640px) {
:root {
--card-w: 100%;
}
.game-box {
width: 90%;
padding: 4%;
margin-bottom: 4%;
margin-left: 2%;
margin-right: 2%;
max-width: 1000px;
.games-grid {
flex-direction: column;
}
.team-info {
align-items: center;
margin-top: 10%;
margin-bottom: 2%;
}
.team-logo {
width: 12%;
height: auto;
}
.team-name {
font-size: 100%;
font-weight: bold;
}
.team-score {
font-size: 140%;
font-weight: bold;
}
.team-sog {
font-size: 70%;
}
.game-info {
font-size: 90%;
}
.live-state {
top: 5%;
left: 3.5%;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
width: 5.5%;
height: 7.2%;
}
.live-time {
top: 5%;
left: 13%;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
display: flex;
justify-content: space-evenly;
align-items: center;
width: 7%;
height: 7.2%;
}
.live-state-intermission {
top: 5%;
left: 3.5%;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
width: 11%;
height: 7.5%;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.live-time-intermission {
top: 5%;
left: 18.5%;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
width: 8%;
height: 7.5%;
display: flex;
justify-content: space-evenly;
align-items: center;
}
.final-state {
top: 5%;
left: 3.5%;
padding: 1.5%;
border-radius: 5px;
font-size: 72%;
width: auto;
height: 7.5%;
}
.pre-state {
top: 5%;
left: 3.5%;
padding: 1.5%;
border-radius: 5px;
font-size: 80%;
}
}
}