projet par cursor
This commit is contained in:
1 parent
236f75ecdd
commit
b785db1b84
47 files changed
+3902
No files matched your search
@@ -0,0 +1,791 @@
|
||||
:root
|
||||
{
|
||||
--bg-deep: #07101c;
|
||||
--bg-panel: rgba(12, 24, 40, 0.88);
|
||||
--bg-elevated: #122338;
|
||||
--line: rgba(0, 229, 255, 0.18);
|
||||
--text: #e8f4ff;
|
||||
--text-muted: #8aa0b8;
|
||||
--accent: #00e5ff;
|
||||
--accent-hot: #7cff6b;
|
||||
--danger: #ff5d7a;
|
||||
--warning: #ffc857;
|
||||
--shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
|
||||
--radius: 14px;
|
||||
--font-display: "Orbitron", sans-serif;
|
||||
--font-body: "Rajdhani", sans-serif;
|
||||
}
|
||||
|
||||
*
|
||||
{
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body
|
||||
{
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body.app-body
|
||||
{
|
||||
margin: 0;
|
||||
font-family: var(--font-body);
|
||||
color: var(--text);
|
||||
background:
|
||||
radial-gradient(circle at 12% 18%, rgba(0, 229, 255, 0.12), transparent 28%),
|
||||
radial-gradient(circle at 88% 8%, rgba(124, 255, 107, 0.08), transparent 24%),
|
||||
linear-gradient(160deg, #050b14 0%, #0a1628 45%, #07101c 100%);
|
||||
background-attachment: fixed;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
body.app-body::before
|
||||
{
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 229, 255, 0.035) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 229, 255, 0.035) 1px, transparent 1px);
|
||||
background-size: 48px 48px;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.scanlines
|
||||
{
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
transparent 0,
|
||||
transparent 2px,
|
||||
rgba(0, 0, 0, 0.08) 3px
|
||||
);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.container,
|
||||
.app-nav,
|
||||
.app-footer,
|
||||
.auth-shell
|
||||
{
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
a
|
||||
{
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover
|
||||
{
|
||||
color: var(--accent-hot);
|
||||
}
|
||||
|
||||
.app-nav
|
||||
{
|
||||
background: rgba(5, 12, 22, 0.85);
|
||||
border-bottom: 1px solid var(--line);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.navbar-brand.brand-logo,
|
||||
.auth-brand h1
|
||||
{
|
||||
font-family: var(--font-display);
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--text);
|
||||
font-size: 1.15rem;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
}
|
||||
|
||||
.brand-mark
|
||||
{
|
||||
color: var(--accent);
|
||||
text-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
|
||||
animation: pulseMark 2.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes pulseMark
|
||||
{
|
||||
0%, 100% { opacity: 1; transform: scale(1); }
|
||||
50% { opacity: 0.65; transform: scale(0.92); }
|
||||
}
|
||||
|
||||
.app-nav .nav-link,
|
||||
.nav-user
|
||||
{
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.app-nav .nav-link:hover,
|
||||
.app-nav .nav-link:focus
|
||||
{
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.nav-user
|
||||
{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.navbar-toggler
|
||||
{
|
||||
border-color: var(--line);
|
||||
}
|
||||
|
||||
.navbar-toggler-icon
|
||||
{
|
||||
filter: invert(1);
|
||||
}
|
||||
|
||||
.page-header
|
||||
{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 1.75rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.eyebrow
|
||||
{
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.18em;
|
||||
font-size: 0.78rem;
|
||||
color: var(--accent);
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.page-title
|
||||
{
|
||||
font-family: var(--font-display);
|
||||
font-size: clamp(1.6rem, 3vw, 2.3rem);
|
||||
margin: 0;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.lead-text
|
||||
{
|
||||
color: var(--text-muted);
|
||||
margin: 0.4rem 0 0;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.page-actions
|
||||
{
|
||||
display: flex;
|
||||
gap: 0.65rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.btn-neon,
|
||||
.btn-outline-neon,
|
||||
.btn-outline-danger
|
||||
{
|
||||
font-family: var(--font-body);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
border-radius: 999px;
|
||||
padding: 0.45rem 1.1rem;
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
|
||||
}
|
||||
|
||||
.btn-neon
|
||||
{
|
||||
background: linear-gradient(120deg, var(--accent), #39b7ff);
|
||||
border: none;
|
||||
color: #041018;
|
||||
box-shadow: 0 0 18px rgba(0, 229, 255, 0.25);
|
||||
}
|
||||
|
||||
.btn-neon:hover
|
||||
{
|
||||
color: #041018;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 0 24px rgba(0, 229, 255, 0.4);
|
||||
}
|
||||
|
||||
.btn-outline-neon
|
||||
{
|
||||
background: transparent;
|
||||
border: 1px solid var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.btn-outline-neon:hover
|
||||
{
|
||||
background: rgba(0, 229, 255, 0.1);
|
||||
color: var(--accent);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.btn-outline-danger
|
||||
{
|
||||
background: transparent;
|
||||
border: 1px solid var(--danger);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.btn-outline-danger:hover
|
||||
{
|
||||
background: rgba(255, 93, 122, 0.12);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.stats-row
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.stat-block,
|
||||
.form-panel,
|
||||
.table-panel,
|
||||
.console-card,
|
||||
.empty-state,
|
||||
.filter-bar
|
||||
{
|
||||
background: var(--bg-panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.stat-block
|
||||
{
|
||||
padding: 1.25rem 1.4rem;
|
||||
}
|
||||
|
||||
.stat-label
|
||||
{
|
||||
display: block;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.stat-value
|
||||
{
|
||||
font-family: var(--font-display);
|
||||
font-size: 2.2rem;
|
||||
color: var(--accent-hot);
|
||||
}
|
||||
|
||||
.section-heading
|
||||
{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.section-heading h2,
|
||||
.form-panel h2,
|
||||
.detail-info h2
|
||||
{
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.1rem;
|
||||
letter-spacing: 0.06em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.link-neon
|
||||
{
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.game-grid
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
||||
gap: 1.1rem;
|
||||
}
|
||||
|
||||
.game-card
|
||||
{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
color: inherit;
|
||||
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
|
||||
}
|
||||
|
||||
.game-card:hover
|
||||
{
|
||||
transform: translateY(-4px);
|
||||
border-color: rgba(0, 229, 255, 0.45);
|
||||
box-shadow: 0 16px 32px rgba(0, 229, 255, 0.12);
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.game-card img
|
||||
{
|
||||
width: 100%;
|
||||
aspect-ratio: 3 / 4;
|
||||
object-fit: cover;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.game-card-body
|
||||
{
|
||||
padding: 0.85rem 0.9rem 1rem;
|
||||
}
|
||||
|
||||
.game-card-body h3
|
||||
{
|
||||
font-size: 1.05rem;
|
||||
margin: 0 0 0.25rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.game-card-body p
|
||||
{
|
||||
margin: 0 0 0.55rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.badge-etat
|
||||
{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.15rem 0.55rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.etat-possede
|
||||
{
|
||||
color: #041018;
|
||||
background: var(--accent-hot);
|
||||
}
|
||||
|
||||
.etat-a_acheter
|
||||
{
|
||||
color: #041018;
|
||||
background: var(--warning);
|
||||
}
|
||||
|
||||
.etat-prete
|
||||
{
|
||||
color: #041018;
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
.etat-vendu
|
||||
{
|
||||
color: #fff;
|
||||
background: #5a6a7d;
|
||||
}
|
||||
|
||||
.console-grid
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.console-card
|
||||
{
|
||||
padding: 1.1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
|
||||
.console-card-link
|
||||
{
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.console-card-link:hover
|
||||
{
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.console-icon
|
||||
{
|
||||
width: 2.6rem;
|
||||
height: 2.6rem;
|
||||
border-radius: 10px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(0, 229, 255, 0.1);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--accent);
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 0.7rem;
|
||||
}
|
||||
|
||||
.console-card h2
|
||||
{
|
||||
font-size: 1.25rem;
|
||||
margin: 0;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.console-card p
|
||||
{
|
||||
margin: 0.25rem 0 0.5rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.console-count
|
||||
{
|
||||
color: var(--accent-hot);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.console-actions
|
||||
{
|
||||
display: flex;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
|
||||
.empty-state
|
||||
{
|
||||
text-align: center;
|
||||
padding: 2.5rem 1.5rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.empty-state i
|
||||
{
|
||||
font-size: 2.8rem;
|
||||
color: var(--accent);
|
||||
display: block;
|
||||
margin-bottom: 0.7rem;
|
||||
}
|
||||
|
||||
.form-panel,
|
||||
.filter-bar,
|
||||
.table-panel
|
||||
{
|
||||
padding: 1.35rem;
|
||||
}
|
||||
|
||||
.form-label
|
||||
{
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.form-control,
|
||||
.form-select
|
||||
{
|
||||
background: rgba(4, 12, 22, 0.75);
|
||||
border: 1px solid var(--line);
|
||||
color: var(--text);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.form-control:focus,
|
||||
.form-select:focus
|
||||
{
|
||||
background: rgba(4, 12, 22, 0.9);
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 0.2rem rgba(0, 229, 255, 0.15);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.form-text,
|
||||
.text-muted
|
||||
{
|
||||
color: var(--text-muted) !important;
|
||||
}
|
||||
|
||||
.form-actions
|
||||
{
|
||||
margin-top: 1.35rem;
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.detail-hero
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 220px 1fr;
|
||||
gap: 1.5rem;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.detail-cover img,
|
||||
.cover-preview img
|
||||
{
|
||||
width: 100%;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--line);
|
||||
box-shadow: var(--shadow);
|
||||
aspect-ratio: 3 / 4;
|
||||
object-fit: cover;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.detail-meta
|
||||
{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem 1rem;
|
||||
color: var(--text-muted);
|
||||
margin-top: 0.8rem;
|
||||
}
|
||||
|
||||
.detail-grid
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 1.4fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.detail-text,
|
||||
.info-list dd
|
||||
{
|
||||
color: var(--text);
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.info-list
|
||||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.info-list > div
|
||||
{
|
||||
padding: 0.65rem 0;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.info-list dt
|
||||
{
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.info-list dd
|
||||
{
|
||||
margin: 0.2rem 0 0;
|
||||
}
|
||||
|
||||
.app-table
|
||||
{
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.app-table thead th
|
||||
{
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
font-size: 0.8rem;
|
||||
letter-spacing: 0.08em;
|
||||
border-bottom-color: var(--line);
|
||||
}
|
||||
|
||||
.app-table td
|
||||
{
|
||||
border-bottom-color: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.app-alert
|
||||
{
|
||||
border: 1px solid var(--line);
|
||||
background: rgba(12, 24, 40, 0.95);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.alert-success
|
||||
{
|
||||
border-color: rgba(124, 255, 107, 0.35);
|
||||
}
|
||||
|
||||
.alert-danger
|
||||
{
|
||||
border-color: rgba(255, 93, 122, 0.35);
|
||||
}
|
||||
|
||||
.alert-warning
|
||||
{
|
||||
border-color: rgba(255, 200, 87, 0.35);
|
||||
}
|
||||
|
||||
.app-footer
|
||||
{
|
||||
margin-top: 3rem;
|
||||
padding: 1.2rem 0 2rem;
|
||||
color: var(--text-muted);
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.footer-sep
|
||||
{
|
||||
margin: 0 0.45rem;
|
||||
}
|
||||
|
||||
/* Auth */
|
||||
.auth-body
|
||||
{
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-height: 100vh;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.auth-shell
|
||||
{
|
||||
width: min(960px, 100%);
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 0.9fr;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.auth-brand,
|
||||
.auth-panel
|
||||
{
|
||||
background: var(--bg-panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: calc(var(--radius) + 4px);
|
||||
box-shadow: var(--shadow);
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.auth-brand
|
||||
{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background:
|
||||
linear-gradient(145deg, rgba(0, 229, 255, 0.12), transparent 55%),
|
||||
var(--bg-panel);
|
||||
}
|
||||
|
||||
.auth-brand .brand-mark
|
||||
{
|
||||
font-size: 2rem;
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
|
||||
.auth-brand p
|
||||
{
|
||||
color: var(--text-muted);
|
||||
margin: 0.7rem 0 0;
|
||||
max-width: 28ch;
|
||||
}
|
||||
|
||||
.auth-title
|
||||
{
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.35rem;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.auth-subtitle,
|
||||
.auth-switch
|
||||
{
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.auth-switch
|
||||
{
|
||||
margin-top: 1.2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.api-results
|
||||
{
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.api-result
|
||||
{
|
||||
display: grid;
|
||||
grid-template-columns: 56px 1fr auto;
|
||||
gap: 0.85rem;
|
||||
align-items: center;
|
||||
padding: 0.7rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
background: rgba(4, 12, 22, 0.55);
|
||||
}
|
||||
|
||||
.api-result img
|
||||
{
|
||||
width: 56px;
|
||||
height: 74px;
|
||||
object-fit: cover;
|
||||
border-radius: 6px;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.api-result h3
|
||||
{
|
||||
margin: 0;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.api-result p
|
||||
{
|
||||
margin: 0.2rem 0 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
@media (max-width: 900px)
|
||||
{
|
||||
.auth-shell,
|
||||
.detail-hero,
|
||||
.detail-grid
|
||||
{
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.detail-cover,
|
||||
.cover-preview
|
||||
{
|
||||
max-width: 220px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px)
|
||||
{
|
||||
.stats-row
|
||||
{
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.api-result
|
||||
{
|
||||
grid-template-columns: 56px 1fr;
|
||||
}
|
||||
|
||||
.api-result .btn
|
||||
{
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="400" viewBox="0 0 300 400" role="img" aria-label="Jaquette manquante">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#122338"/>
|
||||
<stop offset="100%" stop-color="#07101c"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="300" height="400" fill="url(#bg)"/>
|
||||
<rect x="18" y="18" width="264" height="364" rx="12" fill="none" stroke="#00e5ff" stroke-opacity="0.35" stroke-width="2"/>
|
||||
<circle cx="150" cy="170" r="42" fill="none" stroke="#7cff6b" stroke-opacity="0.55" stroke-width="3"/>
|
||||
<path d="M138 170 L165 155 L165 185 Z" fill="#00e5ff"/>
|
||||
<text x="150" y="250" text-anchor="middle" fill="#8aa0b8" font-family="Arial, sans-serif" font-size="18">Pas de jaquette</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 801 B |
@@ -0,0 +1,108 @@
|
||||
document.addEventListener("DOMContentLoaded", () =>
|
||||
{
|
||||
const boutonRecherche = document.getElementById("btnRechercheApi");
|
||||
const champRecherche = document.getElementById("rechercheApi");
|
||||
const zoneResultats = document.getElementById("resultatsApi");
|
||||
const formAppliquer = document.getElementById("formAppliquerApi");
|
||||
const champRawgId = document.getElementById("rawgId");
|
||||
|
||||
if (!boutonRecherche || !champRecherche || !zoneResultats)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const lancerRecherche = async () =>
|
||||
{
|
||||
const terme = champRecherche.value.trim();
|
||||
|
||||
if (terme === "")
|
||||
{
|
||||
zoneResultats.hidden = true;
|
||||
zoneResultats.innerHTML = "";
|
||||
return;
|
||||
}
|
||||
|
||||
boutonRecherche.disabled = true;
|
||||
boutonRecherche.textContent = "Recherche…";
|
||||
|
||||
try
|
||||
{
|
||||
const reponse = await fetch("/jeux/api/rechercher?q=" + encodeURIComponent(terme));
|
||||
const donnees = await reponse.json();
|
||||
afficherResultats(donnees.resultats || []);
|
||||
}
|
||||
catch (erreur)
|
||||
{
|
||||
zoneResultats.hidden = false;
|
||||
zoneResultats.innerHTML = "<p class=\"text-muted\">Impossible de contacter l'API pour le moment.</p>";
|
||||
}
|
||||
finally
|
||||
{
|
||||
boutonRecherche.disabled = false;
|
||||
boutonRecherche.textContent = "Rechercher";
|
||||
}
|
||||
};
|
||||
|
||||
const afficherResultats = (resultats) =>
|
||||
{
|
||||
zoneResultats.hidden = false;
|
||||
|
||||
if (resultats.length === 0)
|
||||
{
|
||||
zoneResultats.innerHTML = "<p class=\"text-muted\">Aucun résultat trouvé.</p>";
|
||||
return;
|
||||
}
|
||||
|
||||
zoneResultats.innerHTML = "";
|
||||
|
||||
resultats.forEach((jeu) =>
|
||||
{
|
||||
const carte = document.createElement("article");
|
||||
carte.className = "api-result";
|
||||
|
||||
const image = document.createElement("img");
|
||||
image.src = jeu.jaquetteUrl || "/assets/img/jaquette-manquante.svg";
|
||||
image.alt = "Jaquette de " + (jeu.titre || "jeu");
|
||||
|
||||
const infos = document.createElement("div");
|
||||
const titre = document.createElement("h3");
|
||||
titre.textContent = jeu.titre || "Sans titre";
|
||||
const meta = document.createElement("p");
|
||||
const genres = (jeu.genres || []).join(", ");
|
||||
meta.textContent = [jeu.dateSortie || "Date inconnue", genres].filter(Boolean).join(" · ");
|
||||
infos.appendChild(titre);
|
||||
infos.appendChild(meta);
|
||||
|
||||
const bouton = document.createElement("button");
|
||||
bouton.type = "button";
|
||||
bouton.className = "btn btn-sm btn-neon";
|
||||
bouton.textContent = "Utiliser";
|
||||
bouton.addEventListener("click", () =>
|
||||
{
|
||||
if (!formAppliquer || !champRawgId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
champRawgId.value = String(jeu.rawgId);
|
||||
formAppliquer.submit();
|
||||
});
|
||||
|
||||
carte.appendChild(image);
|
||||
carte.appendChild(infos);
|
||||
carte.appendChild(bouton);
|
||||
zoneResultats.appendChild(carte);
|
||||
});
|
||||
};
|
||||
|
||||
boutonRecherche.addEventListener("click", lancerRecherche);
|
||||
|
||||
champRecherche.addEventListener("keydown", (event) =>
|
||||
{
|
||||
if (event.key === "Enter")
|
||||
{
|
||||
event.preventDefault();
|
||||
lancerRecherche();
|
||||
}
|
||||
});
|
||||
});
|
||||