Aggiunge i tornei con hub, pagina pubblica e tabellone per semifinali e finali.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -430,6 +430,28 @@ body.nav-menu-open { overflow: hidden; }
|
||||
}
|
||||
.btn-secondary { background: #252530; color: #fff; }
|
||||
.btn-secondary:hover { background: #333; text-decoration: none; color: #fff; }
|
||||
.btn-gated {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding-right: 28px;
|
||||
}
|
||||
.btn-gated__ribbon {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: -20px;
|
||||
width: 62px;
|
||||
padding: 2px 0;
|
||||
transform: rotate(45deg);
|
||||
background: #ffd54f;
|
||||
color: #1a1408;
|
||||
font-size: 0.55rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.06em;
|
||||
line-height: 1.15;
|
||||
text-align: center;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
|
||||
pointer-events: none;
|
||||
}
|
||||
.form-section-title { font-size: 1.05rem; margin: 0 0 12px; color: #e8e8ee; }
|
||||
.branding-fields { border: 1px solid #252530; border-radius: 10px; padding: 16px 18px; margin: 16px 0; }
|
||||
.branding-fields legend { padding: 0 8px; color: #ccc; font-size: 0.9rem; }
|
||||
@@ -1008,6 +1030,746 @@ body.nav-menu-open { overflow: hidden; }
|
||||
.team-dashboard-photo { margin: 12px 0 16px; }
|
||||
.team-dashboard-photo img { max-height: 200px; }
|
||||
|
||||
.tournament-new__lead {
|
||||
color: #888;
|
||||
max-width: 52rem;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
.tournament-form {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px 24px;
|
||||
align-items: start;
|
||||
}
|
||||
.tournament-form__field { min-width: 0; }
|
||||
.tournament-form__field input,
|
||||
.tournament-form__field select,
|
||||
.tournament-form__field textarea {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.tournament-form textarea {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #3d3d4a;
|
||||
background: #1c1c26;
|
||||
color: #fff;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
line-height: 1.45;
|
||||
resize: vertical;
|
||||
min-height: 88px;
|
||||
}
|
||||
.tournament-form textarea:focus {
|
||||
outline: none;
|
||||
border-color: #e53935;
|
||||
box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.25);
|
||||
}
|
||||
.tournament-form__full,
|
||||
.tournament-form__actions {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.tournament-form__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.tournament-form__actions .btn {
|
||||
width: auto;
|
||||
}
|
||||
@media (max-width: 699px) {
|
||||
.tournament-form { grid-template-columns: 1fr; }
|
||||
}
|
||||
.tournament-invite-matches {
|
||||
max-height: 220px;
|
||||
overflow: auto;
|
||||
padding: 8px 0;
|
||||
}
|
||||
.tournament-invite-matches__row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 6px;
|
||||
color: #ddd;
|
||||
}
|
||||
.tournament-invite-matches__row input {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
.invite-editor {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.invite-editor__toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
padding: 8px;
|
||||
background: #16161e;
|
||||
border: 1px solid #3d3d4a;
|
||||
border-bottom: 0;
|
||||
border-radius: 8px 8px 0 0;
|
||||
}
|
||||
.invite-editor__btn {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 1px solid #3d3d4a;
|
||||
border-radius: 6px;
|
||||
background: #1c1c26;
|
||||
color: #eee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.invite-editor__btn:hover {
|
||||
border-color: #e53935;
|
||||
color: #fff;
|
||||
}
|
||||
.invite-editor__frame {
|
||||
position: relative;
|
||||
}
|
||||
.invite-editor__surface {
|
||||
min-height: 280px;
|
||||
padding: 16px 18px;
|
||||
background: #fff;
|
||||
color: #1a1a1a;
|
||||
border: 1px solid #3d3d4a;
|
||||
border-radius: 0 0 8px 8px;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
overflow: auto;
|
||||
}
|
||||
.invite-editor__surface:focus {
|
||||
outline: none;
|
||||
border-color: #e53935;
|
||||
box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.25);
|
||||
}
|
||||
.invite-editor__surface--drop {
|
||||
outline: 2px dashed #e53935;
|
||||
}
|
||||
.invite-editor__surface p { margin: 0 0 12px; }
|
||||
.invite-editor__surface img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
cursor: nwse-resize;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.invite-editor__img--selected {
|
||||
outline: 2px solid #e53935;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.invite-editor__handle {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin: 0;
|
||||
background: #e53935;
|
||||
border: 2px solid #fff;
|
||||
border-radius: 2px;
|
||||
cursor: nwse-resize;
|
||||
box-shadow: 0 0 0 1px #e53935;
|
||||
z-index: 2;
|
||||
}
|
||||
.invite-editor__status {
|
||||
margin: 8px 0 0;
|
||||
font-size: 0.85rem;
|
||||
color: #aaa;
|
||||
}
|
||||
.invite-editor__status--error { color: #ef9a9a; }
|
||||
body.invite-editor--resizing {
|
||||
cursor: nwse-resize;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.tournament-hub-hint { color: #888; margin: 0 0 12px; }
|
||||
.tournament-table-wrap { overflow-x: auto; margin-top: 8px; }
|
||||
.tournament-index-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.tournament-index-actions form { margin: 0; }
|
||||
.tournament-team-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
.tournament-team-chip img {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
object-fit: contain;
|
||||
background: #12121a;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-match-table .tournament-match-form__datetime {
|
||||
min-width: 190px;
|
||||
margin-bottom: 0;
|
||||
padding: 8px 10px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.tournament-match-table .tournament-match-form__court {
|
||||
min-width: 120px;
|
||||
margin-bottom: 0;
|
||||
padding: 8px 10px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.tournament-match-table .tournament-match-form__team {
|
||||
min-width: 160px;
|
||||
max-width: 220px;
|
||||
margin-bottom: 0;
|
||||
padding: 8px 10px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.tournament-knockout-help {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid #2a2a36;
|
||||
}
|
||||
.tournament-knockout-help__steps {
|
||||
margin: 8px 0 16px 1.2rem;
|
||||
color: #c4c4d0;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.tournament-knockout-source {
|
||||
margin-top: 4px;
|
||||
color: #888;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tournament-match-form__score {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.tournament-match-form__score input {
|
||||
width: 56px;
|
||||
margin-bottom: 0;
|
||||
padding: 8px 6px;
|
||||
}
|
||||
.tournament-match-form__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.tournament-match-form__save {
|
||||
width: auto;
|
||||
padding: 4px 10px;
|
||||
font-size: 0.8rem;
|
||||
margin: 0;
|
||||
}
|
||||
.tournament-match-swap-col {
|
||||
width: 44px;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.tournament-match-swap__form { margin: 0; display: inline; }
|
||||
.tournament-match-swap__btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
background: #252530;
|
||||
color: #e8e8ee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tournament-match-swap__btn:hover {
|
||||
background: #333;
|
||||
color: #fff;
|
||||
}
|
||||
.tournament-match-swap__btn:disabled {
|
||||
opacity: 0.55;
|
||||
cursor: wait;
|
||||
}
|
||||
.tournament-match-table [data-swap-side].is-swapped .tournament-team-chip {
|
||||
animation: tournament-chip-swap 180ms ease;
|
||||
}
|
||||
@keyframes tournament-chip-swap {
|
||||
from { opacity: 0.35; transform: translateX(8px); }
|
||||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
.tournament-streaming-cell {
|
||||
min-width: 200px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.tournament-streaming-chip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.3;
|
||||
background: #1c1c24;
|
||||
}
|
||||
.tournament-streaming-chip--assigned { color: #a5d6a7; }
|
||||
.tournament-streaming-chip--pending { color: #ffcc80; }
|
||||
.tournament-streaming-chip__name {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tournament-streaming-chip__status {
|
||||
color: inherit;
|
||||
opacity: 0.8;
|
||||
font-size: 0.72rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-streaming-chip__form { margin: 0; display: inline; }
|
||||
.tournament-streaming-chip__action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
margin-left: auto;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-streaming-chip__action:hover {
|
||||
background: #333;
|
||||
color: #fff;
|
||||
}
|
||||
.tournament-streaming-empty {
|
||||
color: #888;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tournament-streaming-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
}
|
||||
.tournament-streaming-form__email {
|
||||
width: 150px;
|
||||
margin-bottom: 0;
|
||||
padding: 6px 8px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tournament-stream-plan__title {
|
||||
margin: 0 0 8px;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
.tournament-stream-plan__header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.tournament-stream-plan__jump {
|
||||
width: auto;
|
||||
padding: 8px 14px;
|
||||
font-size: 0.85rem;
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-stream-plan__stats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin: 16px 0;
|
||||
}
|
||||
.tournament-stream-plan__stat {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8rem;
|
||||
background: #1c1c24;
|
||||
}
|
||||
.tournament-stream-plan__stat--assigned { color: #a5d6a7; }
|
||||
.tournament-stream-plan__stat--pending { color: #ffcc80; }
|
||||
.tournament-stream-plan__stat--open { color: #ef9a9a; }
|
||||
.tournament-stream-plan__stat--live { color: #ff8a80; }
|
||||
.tournament-stream-plan__stat--waiting_time { color: #80cbc4; }
|
||||
.tournament-stream-plan__stat--waiting_operator { color: #ffcc80; }
|
||||
.tournament-stream-plan__stat--ended { color: #bdbdbd; }
|
||||
.tournament-stream-plan__stat--uncovered { color: #ef9a9a; }
|
||||
.tournament-stream-plan__select {
|
||||
width: auto;
|
||||
padding: 4px 10px;
|
||||
font-size: 0.8rem;
|
||||
margin: 0;
|
||||
}
|
||||
.tournament-stream-plan__invite-card {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.tournament-stream-plan__invite {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.tournament-stream-plan__mail {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.tournament-stream-plan__mail-title {
|
||||
margin: 0 0 6px;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.tournament-stream-plan__extra {
|
||||
margin-top: 12px;
|
||||
color: #ddd;
|
||||
}
|
||||
.tournament-stream-plan__extra summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.tournament-stream-plan__day {
|
||||
margin: 28px 0 10px;
|
||||
font-size: 1rem;
|
||||
color: #e8e8ee;
|
||||
}
|
||||
.tournament-stream-plan__check-col {
|
||||
width: 36px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.tournament-stream-plan__check-col input {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
.tournament-stream-plan__check {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0;
|
||||
}
|
||||
.tournament-stream-plan__matchup {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.tournament-stream-plan__vs {
|
||||
color: #888;
|
||||
}
|
||||
.tournament-stream-plan__row--uncovered td {
|
||||
background: rgba(239, 154, 154, 0.04);
|
||||
}
|
||||
.tournament-stream-plan__row--live td {
|
||||
background: rgba(229, 57, 53, 0.08);
|
||||
}
|
||||
.tournament-stream-plan__table .tournament-streaming-cell {
|
||||
min-width: 180px;
|
||||
}
|
||||
.tournament-live-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.tournament-live-status__dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-live-status--live { color: #ff8a80; }
|
||||
.tournament-live-status--live .tournament-live-status__dot {
|
||||
animation: tournament-live-pulse 1.2s ease-in-out infinite;
|
||||
}
|
||||
.tournament-live-status--waiting_time { color: #80cbc4; }
|
||||
.tournament-live-status--waiting_operator { color: #ffcc80; }
|
||||
.tournament-live-status--ended { color: #bdbdbd; }
|
||||
.tournament-live-status--uncovered { color: #ef9a9a; }
|
||||
.tournament-live-status--replay { color: #ce93d8; }
|
||||
.tournament-live-status--scheduled { color: #80cbc4; }
|
||||
.tournament-live-status--waiting { color: #ffcc80; }
|
||||
.tournament-board { width: 100%; }
|
||||
.tournament-board__day {
|
||||
margin: 20px 0 8px;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
.tournament-board__phase {
|
||||
margin: 4px 0 0;
|
||||
font-size: 0.78rem;
|
||||
color: #888;
|
||||
}
|
||||
.tournament-board__actions {
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
}
|
||||
.tournament-board__cta {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
border-radius: 8px;
|
||||
background: #2a2a36;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tournament-board__cta:hover { background: #3a3a48; }
|
||||
.tournament-board__cta--live {
|
||||
background: #e53935;
|
||||
}
|
||||
.tournament-board__cta--live:hover { background: #c62828; }
|
||||
.tournament-board__row--live { background: rgba(229, 57, 53, 0.08); }
|
||||
.tournament-directory-follow {
|
||||
font-size: 0.78rem;
|
||||
color: #e53935;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tournament-public-tabs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
.tournament-public-tabs .btn {
|
||||
padding: 8px 16px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.tournament-public-hero.roster-hero {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 12px 16px;
|
||||
margin-bottom: 16px;
|
||||
overflow: visible;
|
||||
}
|
||||
.tournament-public-hero .roster-hero__intro {
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.tournament-public-hero .roster-hero__club {
|
||||
margin: 0 0 2px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.tournament-public-hero .roster-hero__title {
|
||||
margin: 0 0 2px;
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.tournament-public-hero .team-public-meta {
|
||||
margin: 0;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.tournament-public-hero__manage {
|
||||
margin-left: auto;
|
||||
flex-shrink: 0;
|
||||
padding: 6px 12px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.tournament-public-hero__logo {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 10px;
|
||||
object-fit: contain;
|
||||
background: #111;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid #2a2a36;
|
||||
}
|
||||
.tournament-public-hero__logo--fallback {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
font-size: 1.2rem;
|
||||
color: var(--club-primary, #e53935);
|
||||
background: #1f1f28;
|
||||
}
|
||||
.tournament-directory-card {
|
||||
padding: 12px 14px;
|
||||
align-items: center;
|
||||
}
|
||||
.tournament-directory-card .team-directory-card__photo {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
.tournament-directory-card .team-directory-card__club {
|
||||
margin: 0 0 2px;
|
||||
}
|
||||
.tournament-directory-card .team-directory-card__name {
|
||||
margin: 0 0 2px;
|
||||
font-size: 1rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.tournament-directory-card .team-directory-card__meta {
|
||||
margin: 0 0 6px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tournament-hub-header {
|
||||
margin: 16px 0 20px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px 16px;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.tournament-hub-header__identity {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
.tournament-hub-header__text h1 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 1.4rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.tournament-hub-header__text p { color: #888; margin: 0; }
|
||||
.tournament-hub-header__actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.tournament-hub-logo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-hub-logo__preview {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 10px;
|
||||
border: 1px dashed #3d3d4a;
|
||||
background: #12121a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tournament-hub-logo__preview img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.tournament-hub-logo__empty {
|
||||
color: #e53935;
|
||||
font-weight: 700;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
.tournament-hub-logo__form { margin: 0; }
|
||||
.tournament-hub-logo__btn {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 6px 10px;
|
||||
font-size: 0.78rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tournament-hub-logo__btn input[type="file"] {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 0;
|
||||
}
|
||||
@keyframes tournament-live-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.3; }
|
||||
}
|
||||
.tournament-schedule-extra {
|
||||
margin-top: 24px;
|
||||
color: #ddd;
|
||||
}
|
||||
.tournament-schedule-extra summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tournament-logo-upload { margin: 0; }
|
||||
.tournament-logo-upload__label {
|
||||
display: block;
|
||||
font-size: 0.8rem;
|
||||
margin-bottom: 4px;
|
||||
color: #aaa;
|
||||
}
|
||||
.tournament-logo-upload__input {
|
||||
margin-bottom: 0;
|
||||
padding: 6px 8px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.tournament-public-matchup {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.tournament-squad-table { margin-top: 16px; }
|
||||
.tournament-squad-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
.tournament-squad-logo__preview {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 8px;
|
||||
border: 1px dashed #3d3d4a;
|
||||
background: #12121a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tournament-squad-logo__preview img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.tournament-squad-logo__empty {
|
||||
color: #888;
|
||||
font-size: 1.4rem;
|
||||
line-height: 1;
|
||||
}
|
||||
.tournament-squad-logo__btn {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 6px 12px;
|
||||
font-size: 0.8rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.tournament-squad-logo__btn input[type="file"] {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 0;
|
||||
}
|
||||
.tournament-squad-name,
|
||||
.tournament-squad-group {
|
||||
margin-bottom: 0;
|
||||
min-width: 160px;
|
||||
padding: 8px 10px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.roster-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 320px;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
(function () {
|
||||
document.addEventListener(
|
||||
"submit",
|
||||
function (event) {
|
||||
var form = event.target;
|
||||
if (!(form instanceof HTMLFormElement)) return;
|
||||
if (!form.classList.contains("tournament-match-swap__form")) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
if (form.dataset.swapBusy === "1") return;
|
||||
|
||||
var row = form.closest("tr");
|
||||
if (!row) return;
|
||||
|
||||
form.dataset.swapBusy = "1";
|
||||
var btn = form.querySelector("button");
|
||||
if (btn) btn.disabled = true;
|
||||
|
||||
swapRowSides(row);
|
||||
|
||||
var token = document.querySelector('meta[name="csrf-token"]');
|
||||
fetch(form.action, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"X-CSRF-Token": token ? token.content : ""
|
||||
},
|
||||
body: new FormData(form),
|
||||
credentials: "same-origin"
|
||||
})
|
||||
.then(function (res) {
|
||||
return res
|
||||
.json()
|
||||
.then(function (data) {
|
||||
return { ok: res.ok && data && data.ok !== false, data: data || {} };
|
||||
})
|
||||
.catch(function () {
|
||||
return { ok: false, data: {} };
|
||||
});
|
||||
})
|
||||
.then(function (result) {
|
||||
if (!result.ok) {
|
||||
swapRowSides(row);
|
||||
showSwapError(form, result.data.error);
|
||||
return;
|
||||
}
|
||||
if (result.data.matchup_label) {
|
||||
var del = row.querySelector(".tournament-match-delete-form");
|
||||
if (del) {
|
||||
del.setAttribute("data-turbo-confirm", result.data.matchup_label);
|
||||
del.setAttribute("data-confirm", result.data.matchup_label);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
swapRowSides(row);
|
||||
showSwapError(form, null);
|
||||
})
|
||||
.finally(function () {
|
||||
delete form.dataset.swapBusy;
|
||||
if (btn) btn.disabled = false;
|
||||
});
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
function swapRowSides(row) {
|
||||
var home = row.querySelector("[data-swap-side='home']");
|
||||
var away = row.querySelector("[data-swap-side='away']");
|
||||
if (home && away) {
|
||||
var tmp = home.innerHTML;
|
||||
home.innerHTML = away.innerHTML;
|
||||
away.innerHTML = tmp;
|
||||
pulse(home);
|
||||
pulse(away);
|
||||
}
|
||||
|
||||
var homeScore = row.querySelector("[data-swap-score='home']");
|
||||
var awayScore = row.querySelector("[data-swap-score='away']");
|
||||
if (homeScore && awayScore) {
|
||||
var hv = homeScore.value;
|
||||
homeScore.value = awayScore.value;
|
||||
awayScore.value = hv;
|
||||
}
|
||||
|
||||
var played = row.querySelector("[data-swap-played-score]");
|
||||
if (played) {
|
||||
var parts = played.textContent.trim().split(/\s*[–-]\s*/);
|
||||
if (parts.length === 2) {
|
||||
played.textContent = parts[1] + "–" + parts[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pulse(el) {
|
||||
el.classList.remove("is-swapped");
|
||||
void el.offsetWidth;
|
||||
el.classList.add("is-swapped");
|
||||
}
|
||||
|
||||
function showSwapError(form, message) {
|
||||
var table = form.closest(".tournament-match-table");
|
||||
var text =
|
||||
message ||
|
||||
(table && table.getAttribute("data-swap-error")) ||
|
||||
"Impossibile invertire casa e ospite.";
|
||||
var host = document.querySelector(".tournament-hub") || document.querySelector("main");
|
||||
if (!host) return;
|
||||
|
||||
var prev = host.querySelector(".flash.alert[data-swap-flash]");
|
||||
if (prev) prev.remove();
|
||||
|
||||
var el = document.createElement("div");
|
||||
el.className = "flash alert";
|
||||
el.setAttribute("data-swap-flash", "1");
|
||||
el.textContent = text;
|
||||
host.insertBefore(el, host.firstChild);
|
||||
window.setTimeout(function () {
|
||||
if (el.parentNode) el.remove();
|
||||
}, 5000);
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,263 @@
|
||||
(function () {
|
||||
var MIN_WIDTH = 80;
|
||||
var MAX_WIDTH = 560;
|
||||
|
||||
function csrfToken() {
|
||||
var meta = document.querySelector("meta[name='csrf-token']");
|
||||
return meta ? meta.getAttribute("content") : "";
|
||||
}
|
||||
|
||||
function initEditor(root) {
|
||||
if (root.dataset.ready === "1") return;
|
||||
root.dataset.ready = "1";
|
||||
|
||||
var surface = root.querySelector(".invite-editor__surface");
|
||||
var handle = root.querySelector(".invite-editor__handle");
|
||||
var fileInput = root.querySelector("[data-invite-file]");
|
||||
var htmlField = root.closest("form").querySelector("[data-invite-html]");
|
||||
var noteInput = root.closest("form").querySelector("[data-invite-note]");
|
||||
var status = root.querySelector("[data-invite-status]");
|
||||
var selectedImg = null;
|
||||
var drag = null;
|
||||
|
||||
function showStatus(message, isError) {
|
||||
if (!status) return;
|
||||
if (!message) {
|
||||
status.hidden = true;
|
||||
status.textContent = "";
|
||||
return;
|
||||
}
|
||||
status.hidden = false;
|
||||
status.textContent = message;
|
||||
status.classList.toggle("invite-editor__status--error", !!isError);
|
||||
}
|
||||
|
||||
function syncHtml() {
|
||||
if (htmlField) htmlField.value = surface.innerHTML;
|
||||
}
|
||||
|
||||
function syncNote() {
|
||||
var note = (noteInput && noteInput.value || "").trim();
|
||||
var el = surface.querySelector("[data-invite-note]");
|
||||
if (!note) {
|
||||
if (el) el.remove();
|
||||
syncHtml();
|
||||
return;
|
||||
}
|
||||
if (!el) {
|
||||
el = document.createElement("p");
|
||||
el.setAttribute("data-invite-note", "");
|
||||
var first = surface.querySelector("p");
|
||||
if (first && first.nextSibling) surface.insertBefore(el, first.nextSibling);
|
||||
else if (first) first.after(el);
|
||||
else surface.appendChild(el);
|
||||
}
|
||||
el.textContent = note;
|
||||
syncHtml();
|
||||
}
|
||||
|
||||
function prepareImage(img) {
|
||||
img.draggable = false;
|
||||
img.style.maxWidth = "100%";
|
||||
img.style.height = "auto";
|
||||
if (!img.getAttribute("width") && img.naturalWidth) {
|
||||
img.setAttribute("width", Math.min(img.naturalWidth, MAX_WIDTH));
|
||||
}
|
||||
}
|
||||
|
||||
function updateHandle() {
|
||||
if (!selectedImg || !handle) return;
|
||||
var frame = handle.parentElement.getBoundingClientRect();
|
||||
var rect = selectedImg.getBoundingClientRect();
|
||||
handle.hidden = false;
|
||||
handle.style.left = rect.right - frame.left - 8 + "px";
|
||||
handle.style.top = rect.bottom - frame.top - 8 + "px";
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedImg = null;
|
||||
if (handle) handle.hidden = true;
|
||||
surface.querySelectorAll("img.invite-editor__img--selected").forEach(function (img) {
|
||||
img.classList.remove("invite-editor__img--selected");
|
||||
});
|
||||
}
|
||||
|
||||
function selectImage(img) {
|
||||
clearSelection();
|
||||
selectedImg = img;
|
||||
img.classList.add("invite-editor__img--selected");
|
||||
updateHandle();
|
||||
}
|
||||
|
||||
function insertImage(url) {
|
||||
surface.focus();
|
||||
document.execCommand("insertHTML", false, '<img src="' + url.replace(/"/g, """) + '" alt="">');
|
||||
var images = surface.querySelectorAll("img");
|
||||
var img = images[images.length - 1];
|
||||
if (img) {
|
||||
prepareImage(img);
|
||||
selectImage(img);
|
||||
}
|
||||
syncHtml();
|
||||
}
|
||||
|
||||
function uploadFile(file) {
|
||||
if (!file || !file.type.match(/^image\/(png|jpeg|webp|gif)$/)) {
|
||||
showStatus(root.getAttribute("data-msg-type"), true);
|
||||
return;
|
||||
}
|
||||
if (file.size > 2 * 1024 * 1024) {
|
||||
showStatus(root.getAttribute("data-msg-size"), true);
|
||||
return;
|
||||
}
|
||||
var data = new FormData();
|
||||
data.append("file", file);
|
||||
showStatus(root.getAttribute("data-msg-uploading"), false);
|
||||
fetch(root.getAttribute("data-upload-url"), {
|
||||
method: "POST",
|
||||
headers: { "X-CSRF-Token": csrfToken(), Accept: "application/json" },
|
||||
body: data,
|
||||
credentials: "same-origin"
|
||||
}).then(function (res) {
|
||||
return res.json().then(function (json) {
|
||||
if (!res.ok) throw new Error(json.error || root.getAttribute("data-msg-failed"));
|
||||
return json;
|
||||
});
|
||||
}).then(function (json) {
|
||||
showStatus("", false);
|
||||
insertImage(json.url);
|
||||
}).catch(function (err) {
|
||||
showStatus(err.message || root.getAttribute("data-msg-failed"), true);
|
||||
});
|
||||
}
|
||||
|
||||
root.querySelectorAll("[data-invite-cmd]").forEach(function (btn) {
|
||||
btn.addEventListener("mousedown", function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
btn.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
var cmd = btn.getAttribute("data-invite-cmd");
|
||||
surface.focus();
|
||||
if (cmd === "createLink") {
|
||||
var url = window.prompt(root.getAttribute("data-msg-link") || "URL", "https://");
|
||||
if (url) document.execCommand("createLink", false, url);
|
||||
} else if (cmd === "image") {
|
||||
fileInput.click();
|
||||
} else {
|
||||
document.execCommand(cmd, false, null);
|
||||
}
|
||||
syncHtml();
|
||||
});
|
||||
});
|
||||
|
||||
fileInput.addEventListener("change", function () {
|
||||
var file = fileInput.files && fileInput.files[0];
|
||||
fileInput.value = "";
|
||||
if (file) uploadFile(file);
|
||||
});
|
||||
|
||||
surface.addEventListener("click", function (e) {
|
||||
if (e.target.tagName === "IMG") {
|
||||
e.preventDefault();
|
||||
selectImage(e.target);
|
||||
} else {
|
||||
clearSelection();
|
||||
}
|
||||
});
|
||||
|
||||
surface.addEventListener("input", syncHtml);
|
||||
surface.addEventListener("blur", syncHtml);
|
||||
if (noteInput) noteInput.addEventListener("input", syncNote);
|
||||
|
||||
surface.addEventListener("paste", function (e) {
|
||||
var items = e.clipboardData && e.clipboardData.files;
|
||||
if (items && items.length && items[0].type.indexOf("image/") === 0) {
|
||||
e.preventDefault();
|
||||
uploadFile(items[0]);
|
||||
}
|
||||
});
|
||||
|
||||
["dragenter", "dragover"].forEach(function (type) {
|
||||
surface.addEventListener(type, function (e) {
|
||||
e.preventDefault();
|
||||
surface.classList.add("invite-editor__surface--drop");
|
||||
});
|
||||
});
|
||||
["dragleave", "drop"].forEach(function (type) {
|
||||
surface.addEventListener(type, function () {
|
||||
surface.classList.remove("invite-editor__surface--drop");
|
||||
});
|
||||
});
|
||||
surface.addEventListener("drop", function (e) {
|
||||
e.preventDefault();
|
||||
var file = e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files[0];
|
||||
if (file) uploadFile(file);
|
||||
});
|
||||
|
||||
handle.addEventListener("mousedown", function (e) {
|
||||
if (!selectedImg) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
drag = {
|
||||
startX: e.clientX,
|
||||
startWidth: selectedImg.getBoundingClientRect().width
|
||||
};
|
||||
document.body.classList.add("invite-editor--resizing");
|
||||
});
|
||||
|
||||
document.addEventListener("mousemove", function (e) {
|
||||
if (!drag || !selectedImg) return;
|
||||
var width = Math.round(Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, drag.startWidth + (e.clientX - drag.startX))));
|
||||
selectedImg.style.width = width + "px";
|
||||
selectedImg.style.height = "auto";
|
||||
selectedImg.setAttribute("width", String(width));
|
||||
selectedImg.removeAttribute("height");
|
||||
updateHandle();
|
||||
});
|
||||
|
||||
document.addEventListener("mouseup", function () {
|
||||
if (!drag) return;
|
||||
drag = null;
|
||||
document.body.classList.remove("invite-editor--resizing");
|
||||
syncHtml();
|
||||
});
|
||||
|
||||
window.addEventListener("resize", updateHandle);
|
||||
surface.querySelectorAll("img").forEach(prepareImage);
|
||||
|
||||
var form = root.closest("form");
|
||||
form.addEventListener("submit", function () {
|
||||
syncNote();
|
||||
syncHtml();
|
||||
});
|
||||
form.addEventListener("turbo:submit-start", function () {
|
||||
syncNote();
|
||||
syncHtml();
|
||||
});
|
||||
syncNote();
|
||||
syncHtml();
|
||||
}
|
||||
|
||||
function bindSelectUncovered() {
|
||||
document.querySelectorAll("[data-select-uncovered]").forEach(function (btn) {
|
||||
if (btn.dataset.boundSelect === "1") return;
|
||||
btn.dataset.boundSelect = "1";
|
||||
btn.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
var formId = btn.getAttribute("data-select-uncovered");
|
||||
document.querySelectorAll('input[data-uncovered-match][form="' + formId + '"]').forEach(function (cb) {
|
||||
cb.checked = true;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function boot() {
|
||||
document.querySelectorAll("[data-invite-editor]").forEach(initEditor);
|
||||
bindSelectUncovered();
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", boot);
|
||||
document.addEventListener("turbo:load", boot);
|
||||
})();
|
||||
Reference in New Issue
Block a user