From 65e6b3d5bb18b7dfafe1dd20b31ae3d46c1b3711 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 26 Nov 2024 21:29:25 -0800 Subject: [PATCH 01/16] Clean up some old columns no longer referenced in code Just a couple series and 11 events all time affected and this distinction is long-since meaningless ("pauper krew only"). --- gatherling/Data/sql/migrations/81.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 gatherling/Data/sql/migrations/81.sql diff --git a/gatherling/Data/sql/migrations/81.sql b/gatherling/Data/sql/migrations/81.sql new file mode 100644 index 000000000..3da1d044b --- /dev/null +++ b/gatherling/Data/sql/migrations/81.sql @@ -0,0 +1,2 @@ +ALTER TABLE events DROP COLUMN pkonly; +ALTER TABLE series DROP COLUMN pkonly_default; From 1072fc11fe64fad938f5d8084db31873107976a5 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 26 Nov 2024 21:58:35 -0800 Subject: [PATCH 02/16] Type fixes --- gatherling/Models/Player.php | 1 - gatherling/Views/Components/UnverifiedPlayerCell.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/gatherling/Models/Player.php b/gatherling/Models/Player.php index 5b44d8b9d..c4bf98613 100644 --- a/gatherling/Models/Player.php +++ b/gatherling/Models/Player.php @@ -4,7 +4,6 @@ namespace Gatherling\Models; -use Gatherling\Exceptions\DatabaseException; use Gatherling\Exceptions\NotFoundException; use Gatherling\Exceptions\ValidationException; use Gatherling\Models\PlayerDto; diff --git a/gatherling/Views/Components/UnverifiedPlayerCell.php b/gatherling/Views/Components/UnverifiedPlayerCell.php index cc99af921..bf5ccecbd 100644 --- a/gatherling/Views/Components/UnverifiedPlayerCell.php +++ b/gatherling/Views/Components/UnverifiedPlayerCell.php @@ -10,7 +10,7 @@ class UnverifiedPlayerCell { - public ?string $playerName; + public string $playerName; public int|null|false $wins; public int|null|false $losses; public GameName $displayName; From 2de7e971966edf24204f80a098c91e7d0dc3591f Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 10:49:05 -0800 Subject: [PATCH 03/16] Remove an unused column --- gatherling/Data/sql/migrations/82.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 gatherling/Data/sql/migrations/82.sql diff --git a/gatherling/Data/sql/migrations/82.sql b/gatherling/Data/sql/migrations/82.sql new file mode 100644 index 000000000..ae00a5ab1 --- /dev/null +++ b/gatherling/Data/sql/migrations/82.sql @@ -0,0 +1,2 @@ +-- Remove unused column - every entry is null +ALTER TABLE entries DROP COLUMN notes; From 09a90e9f1a0661b649c503b9640ff59b45e7e93c Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 11:03:11 -0800 Subject: [PATCH 04/16] Make sure deckErrorTable is intialized even if there are no errors --- gatherling/Views/Components/DeckProfile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gatherling/Views/Components/DeckProfile.php b/gatherling/Views/Components/DeckProfile.php index d94654dd7..242e83bf8 100644 --- a/gatherling/Views/Components/DeckProfile.php +++ b/gatherling/Views/Components/DeckProfile.php @@ -12,7 +12,7 @@ class DeckProfile extends Component { public int $deckId; public bool $canEdit; - public DeckErrorTable $deckErrorTable; + public ?DeckErrorTable $deckErrorTable = null; public DeckInfoCell $deckInfoCell; public MaindeckTable $maindeckTable; public SideboardTable $sideboardTable; From 5ba09b2a9b46b3e2ff2f003707b6d642db3e0803 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 11:20:57 -0800 Subject: [PATCH 05/16] Remove eventless decks, they are vestiges and not useful, they cause errors --- gatherling/Data/sql/migrations/83.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gatherling/Data/sql/migrations/83.sql diff --git a/gatherling/Data/sql/migrations/83.sql b/gatherling/Data/sql/migrations/83.sql new file mode 100644 index 000000000..9fefdd006 --- /dev/null +++ b/gatherling/Data/sql/migrations/83.sql @@ -0,0 +1,4 @@ +-- It doesn't really make sense for a deck to exist without an event, yet there are 2500 such decks +-- The details are here should we decide we need them: https://gist.githubusercontent.com/bakert/b1eb9cecd606cbf541732310d48d11d9/raw/914917e5c0e0cd9e4d22598a301bf5965356c173/gistfile1.txt +DELETE FROM deckcontents WHERE deck IN (SELECT id FROM decks WHERE id NOT IN (SELECT deck FROM entries WHERE deck IS NOT NULL)); +DELETE FROM decks WHERE id NOT IN (SELECT deck FROM entries WHERE deck IS NOT NULL); From 26a70aff26c4ff529e38eddd15ec69354a855c15 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 13:08:12 -0800 Subject: [PATCH 06/16] Remove The Player With No Name --- gatherling/Data/sql/migrations/84.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 gatherling/Data/sql/migrations/84.sql diff --git a/gatherling/Data/sql/migrations/84.sql b/gatherling/Data/sql/migrations/84.sql new file mode 100644 index 000000000..9ae12daad --- /dev/null +++ b/gatherling/Data/sql/migrations/84.sql @@ -0,0 +1,4 @@ +-- Get rid of The Player With No Name and all his manifestations +UPDATE events SET host = 'bakert99' WHERE host = ''; +UPDATE events SET cohost = NULL WHERE cohost = ''; +DELETE FROM players WHERE name= ''; From 0bc6ae7579bd9188697496e150aae5ee9d28a12e Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 13:13:48 -0800 Subject: [PATCH 07/16] Make Event->host not-nullable, as it is in the db --- gatherling/Models/Event.php | 9 +++------ gatherling/Views/Components/RecentEventsTable.php | 4 ++-- psalm-baseline.xml | 14 -------------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/gatherling/Models/Event.php b/gatherling/Models/Event.php index c0d31140a..56e1a4ecb 100644 --- a/gatherling/Models/Event.php +++ b/gatherling/Models/Event.php @@ -37,7 +37,7 @@ class Event // Class associations public ?string $series = null; // belongs to Series - public ?string $host; // has one Player - host + public string $host; // has one Player - host public ?string $cohost; // has one Player - cohost // Subevents @@ -74,7 +74,7 @@ public function __construct(int|string $name = '') $this->mainstruct = ''; $this->finalrounds = 0; $this->finalstruct = ''; - $this->host = null; + $this->host = ''; $this->cohost = null; $this->threadurl = ''; $this->reporturl = ''; @@ -296,9 +296,6 @@ public function save(): void if ($this->cohost == '') { $this->cohost = null; } - if ($this->host == '') { - $this->host = null; - } if ($this->finalized) { $this->active = 0; } @@ -489,7 +486,7 @@ public function setFinalists(string $win, ?string $sec, array $t4, array $t8): v public function isHost(string $name): bool { - $ishost = !is_null($this->host) && strcasecmp($name, $this->host) == 0; + $ishost = strcasecmp($name, $this->host) == 0; $iscohost = !is_null($this->cohost) && strcasecmp($name, $this->cohost) == 0; return $ishost || $iscohost; } diff --git a/gatherling/Views/Components/RecentEventsTable.php b/gatherling/Views/Components/RecentEventsTable.php index 0f7799a72..13ae21b17 100644 --- a/gatherling/Views/Components/RecentEventsTable.php +++ b/gatherling/Views/Components/RecentEventsTable.php @@ -11,7 +11,7 @@ class RecentEventsTable extends Component { /** @var array */ - public array $events; + public array $events = []; public function __construct(public Series $series) { @@ -25,7 +25,7 @@ public function __construct(public Series $series) 'eventName' => $event->name, 'startTime' => $startTime, 'playerCount' => $event->getPlayerCount(), - 'host' => $event->host ?? '', + 'host' => $event->host, 'cohost' => $event->cohost ?? '', ]; diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 5d1a2eedd..7133b2b6e 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1649,11 +1649,6 @@ name)]]> - - - - - medal]]> @@ -1690,9 +1685,6 @@ - - host]]> - @@ -1817,15 +1809,9 @@ - - - - - events]]> - From d465d106c76214f73cc9c04880625108fa14a800 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 14:10:41 -0800 Subject: [PATCH 08/16] Remove php-icons in favor of font awesome I actually tried to go the other way, and remove font awesome in favor of php-icons and it was a giant pain and nothing looked right. Replacing the three icons with font awesome options was the work of a few seconds. So I guess that tells me which way is better. This also has no "remember to scan for the icons on prod" step, too. --- gatherling/Views/Components/AllMatchForm.php | 2 +- gatherling/Views/Components/HostEvents.php | 8 -------- gatherling/Views/Pages/EventForm.php | 1 + gatherling/templates/partials/eventCard.mustache | 6 +++--- gatherling/templates/partials/icon.mustache | 1 - 5 files changed, 5 insertions(+), 13 deletions(-) delete mode 100644 gatherling/templates/partials/icon.mustache diff --git a/gatherling/Views/Components/AllMatchForm.php b/gatherling/Views/Components/AllMatchForm.php index a3852ab4a..aca56b170 100644 --- a/gatherling/Views/Components/AllMatchForm.php +++ b/gatherling/Views/Components/AllMatchForm.php @@ -19,7 +19,7 @@ public function __construct(Player $player, string $selectedFormat, string $sele $this->seriesDropMenuP = selector(opts($player->getSeriesPlayed()), 'series', '-- Series --', $selectedSeries ? $selectedSeries : '%'); $this->seasonDropMenuP = selector(opts($player->getSeasonsPlayed()), 'season', '-- Season --', $selectedSeason ? $selectedSeason : '%'); $opts = array_map(fn (array $item) => ['value' => $item['opp'], 'text' => $item['opp'] . ' [' . $item['cnt'] . ']'], $player->getOpponents()); - $this->oppDropMenuP= selector($opts, 'opp', '-- Opponent --', $selectedOpponent ? $selectedOpponent : '%'); + $this->oppDropMenuP = selector($opts, 'opp', '-- Opponent --', $selectedOpponent ? $selectedOpponent : '%'); } } diff --git a/gatherling/Views/Components/HostEvents.php b/gatherling/Views/Components/HostEvents.php index 758696c89..f9fd73682 100644 --- a/gatherling/Views/Components/HostEvents.php +++ b/gatherling/Views/Components/HostEvents.php @@ -16,20 +16,12 @@ class HostEvents extends Component public bool $hasPendingEvents; public bool $hasActiveEvents; - public Icon $playersIcon; - public Icon $structureIcon; - public Icon $standingsIcon; - /** * @param list $pendingEvents * @param list $activeEvents */ public function __construct(array $pendingEvents, array $activeEvents) { - $this->playersIcon = new Icon('lucide:users'); - $this->structureIcon = new Icon('lucide:trophy'); - $this->standingsIcon = new Icon('lucide:chevron-right'); - $this->hasPendingEvents = count($pendingEvents) > 0; $this->hasActiveEvents = count($activeEvents) > 0; diff --git a/gatherling/Views/Pages/EventForm.php b/gatherling/Views/Pages/EventForm.php index ca6aeb234..9fa51e71a 100644 --- a/gatherling/Views/Pages/EventForm.php +++ b/gatherling/Views/Pages/EventForm.php @@ -20,6 +20,7 @@ use Gatherling\Views\Components\StructDropMenu; use Gatherling\Views\Components\TimeDropMenu; use Gatherling\Views\Components\TrophyField; + use function Gatherling\Helpers\getObjectVarsCamelCase; use function Safe\preg_match; diff --git a/gatherling/templates/partials/eventCard.mustache b/gatherling/templates/partials/eventCard.mustache index b2057ee12..cdc4910ec 100644 --- a/gatherling/templates/partials/eventCard.mustache +++ b/gatherling/templates/partials/eventCard.mustache @@ -11,7 +11,7 @@ @@ -22,7 +22,7 @@ Round {{currentRound}} View Standings - {{#standingsIcon}}{{> icon}}{{/standingsIcon}} + {{/active}} {{^active}} @@ -31,7 +31,7 @@ Start Event - {{#standingsIcon}}{{> icon}}{{/standingsIcon}} + {{/active}} diff --git a/gatherling/templates/partials/icon.mustache b/gatherling/templates/partials/icon.mustache deleted file mode 100644 index 73017eb76..000000000 --- a/gatherling/templates/partials/icon.mustache +++ /dev/null @@ -1 +0,0 @@ -{{{iconSafe}}} From 6aa2faa6fd506516e870a9ceb4424baa7c53046e Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 15:00:37 -0800 Subject: [PATCH 09/16] Simplify spacing vars and introduce --line for 1px borders and similar --line isn't very useful exactly as we'd never change it, but it does make hunting for rogue px values a lot easier. --- gatherling/styles/css/stylesheet.css | 177 +++++++++++++-------------- 1 file changed, 85 insertions(+), 92 deletions(-) diff --git a/gatherling/styles/css/stylesheet.css b/gatherling/styles/css/stylesheet.css index e67b7c165..d19da309f 100644 --- a/gatherling/styles/css/stylesheet.css +++ b/gatherling/styles/css/stylesheet.css @@ -55,30 +55,23 @@ /* Spacing */ - --spacing-1-static: 1px; - --spacing-5-static: 5px; - --spacing-10-static: 10px; - --spacing-20-static: 20px; - --spacing-40-static: 40px; - --spacing-80-static: 80px; - --spacing-160-static: 160px; - --spacing-320-static: 320px; - --spacing-1-dynamic: calc(1rem / 16); - --spacing-5-dynamic: calc(5rem / 16); - --spacing-10-dynamic: calc(10rem / 16); - --spacing-20-dynamic: calc(20rem / 16); - --spacing-40-dynamic: calc(40rem / 16); - --spacing-80-dynamic: calc(80rem / 16); - --spacing-160-dynamic: calc(160rem / 16); - --spacing-320-dynamic: calc(320rem / 16); + --spacing-1: calc(1rem / 16); + --spacing-5: calc(5rem / 16); + --spacing-10: calc(10rem / 16); + --spacing-20: calc(20rem / 16); + --spacing-40: calc(40rem / 16); + --spacing-80: calc(80rem / 16); + --spacing-160: calc(160rem / 16); + --spacing-320: calc(320rem / 16); /* Semantic Spacing */ - --card-grid-gap: var(--spacing-20-static); - --card-internal-gap: var(--spacing-10-static); - --control-border-radius: var(--spacing-5-static); - --grid-border-radius: var(--spacing-5-static); - --card-border-radius: var(--spacing-10-static); + --card-grid-gap: var(--spacing-20); + --card-internal-gap: var(--spacing-10); + --control-border-radius: var(--spacing-5); + --grid-border-radius: var(--spacing-5); + --card-border-radius: var(--spacing-10); + --line: var(--spacing-1); /* Typography */ @@ -144,7 +137,7 @@ body { border: 0; outline: 0; background: var(--base-background-color); - padding: 20px 0 0; + padding: var(--spacing-20) 0 0; color: var(--main-text-color); margin-left: auto; margin-right: auto; @@ -153,13 +146,13 @@ body { } h1 { - font-size: 14px; + font-size: var(--font-size-14); } h2, .box h2 { font-size: var(--font-size-24); - margin-bottom: var(--spacing-20-static); + margin-bottom: var(--spacing-20); } h3 { @@ -187,7 +180,7 @@ ul { } li { - margin-left: 30px; + margin-left: var(--spacing-40); } td { @@ -195,15 +188,15 @@ td { } a { - border-bottom: 1px dotted var(--link-text-color); + border-bottom: var(--line) dotted var(--link-text-color); text-decoration: none; font-weight: bold; - padding: 1px; + padding: var(--line); } hr { border: 0 var(--main-text-color) solid; - border-top-width: 1px; + border-top-width: var(--line); clear: both; height: 0; } @@ -222,10 +215,10 @@ See also body. */ display: inline; float: left; position: relative; - margin-left: var(--spacing-10-static); - margin-right: var(--spacing-10-static); + margin-left: var(--spacing-10); + margin-right: var(--spacing-10); width: calc( - 100% - var(--spacing-10-static) - var(--spacing-10-static) + 100% - var(--spacing-10) - var(--spacing-10) ); /* 100% width minus left and right margins */ } @@ -351,7 +344,7 @@ span.notallowed { } table.scoreboard span { - border-bottom: 1px dotted var(--notice-text-color); + border-bottom: var(--line) dotted var(--notice-text-color); } table.scoreboard tr.odd { @@ -381,7 +374,7 @@ table.scoreboard .playername { width: 100%; margin-left: auto; margin-right: auto; - border-bottom: 1px solid var(--divider-border-color); + border-bottom: var(--line) solid var(--divider-border-color); min-height: 200px; margin-bottom: 20px; padding-bottom: 20px; @@ -449,7 +442,7 @@ a.create_deck_link { /* Forms */ .inputbox { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--highlight-background-color); padding: 3px; @@ -461,12 +454,12 @@ a.create_deck_link { } .inputbox:focus { - border: 1px solid rgb(234 234 234); + border: var(--line) solid rgb(234 234 234); border-color: var(--link-border-color); } .inputbox:disabled { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-color: var(--disabled-control-background-color); color: var(--disabled-control-color); padding: 3px; @@ -476,13 +469,13 @@ a.create_deck_link { /* Buttons */ .inputbutton { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--control-background-color); margin: 5px; box-shadow: 0 2px 5px var(--control-border-color); display: inline-block; - padding: var(--spacing-10-static) var(--spacing-20-static); + padding: var(--spacing-10) var(--spacing-20); border-radius: var(--control-border-radius); font-size: var(--font-size-14); cursor: pointer; @@ -497,14 +490,14 @@ a.create_deck_link { } .inputbutton:focus { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-color: var(--focused-control-background-color); color: var(--focused-control-color); box-shadow: 0 0 0 var(--control-border-color); } .inputbutton:disabled { - border: 1px solid var(--disabled-control-border-color); + border: var(--line) solid var(--disabled-control-border-color); background-color: var(--disabled-control-background-color); color: var(--disabled-control-color); box-shadow: 0 0 0 var(--disabled-control-border-color); @@ -513,7 +506,7 @@ a.create_deck_link { .btn-primary { background: transparent; color: var(--link-noticeable-text-color); - border: 1px solid var(--link-noticeable-border-color); + border: var(--line) solid var(--link-noticeable-border-color); } .btn-primary:hover { @@ -534,7 +527,7 @@ a.create_deck_link { #table-decksearch td, #table-decksearch th { border-top-color: var(--divider-border-color); - border-bottom: 1px solid var(--divider-border-color); + border-bottom: var(--line) solid var(--divider-border-color); color: var(--main-text-color); } @@ -548,7 +541,7 @@ a.create_deck_link { .ds_inputbox { margin: auto; max-width: 750px; - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--highlight-background-color); padding: 3px; @@ -585,7 +578,7 @@ a.create_deck_link { } .ds_input { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--highlight-background-color); border-radius: var(--control-border-radius); @@ -599,12 +592,12 @@ a.create_deck_link { } .ds_input:focus { - border: 1px solid rgb(234 234 234); + border: var(--line) solid rgb(234 234 234); border-color: var(--link-border-color); } .ds_input:disabled { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-color: var(--disabled-control-background-color); color: var(--disabled-control-color); padding: 3px; @@ -621,7 +614,7 @@ a.create_deck_link { text-align: center; display: block; padding: 6px 28px; - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); border-radius: var(--control-border-radius); box-shadow: 0 2px 5px var(--control-border-color); } @@ -634,14 +627,14 @@ a.create_deck_link { } .ds_submit:focus { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-color: var(--focused-control-background-color); color: var(--focused-control-color); box-shadow: 0 0 0 var(--control-border-color); } .ds_submit:disabled { - border: 1px solid var(--disabled-control-border-color); + border: var(--line) solid var(--disabled-control-border-color); background-color: var(--disabled-control-background-color); color: var(--disabled-control-color); box-shadow: 0 0 0 var(--disabled-control-border-color); @@ -665,9 +658,9 @@ a.create_deck_link { } .ds_checkbox { - padding: var(--spacing-5-static); + padding: var(--spacing-5); margin: 5px; - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); border-radius: var(--control-border-radius); background-color: var(--control-background-color); display: inline-flex; @@ -691,7 +684,7 @@ a.create_deck_link { max-width: 140px; height: 27px; outline: solid transparent; - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--highlight-background-color); padding: 3px; @@ -737,12 +730,12 @@ a.create_deck_link { .tablink { border-radius: var(--control-border-radius); box-shadow: 0 2px 10px var(--control-border-color); - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-color: var(--control-background-color); color: var(--link-text-color); float: left; padding: 8px; - margin: 1px 0; + margin: var(--line) 0; width: 25%; } @@ -751,7 +744,7 @@ a.create_deck_link { /* text color of selected and active item */ background: var(--highlight-background-color); - border: 1px solid var(--link-border-color); + border: var(--line) solid var(--link-border-color); } .tabcontent { @@ -789,7 +782,7 @@ table.events td:last-child { } .winners tr.player-deck td { - border-bottom: 1px solid var(--divider-border-color); + border-bottom: var(--line) solid var(--divider-border-color); padding-bottom: 24px; } @@ -810,7 +803,7 @@ a.emailPop { } .borderless:hover { - border: 1px solid var(--main-background-color); + border: var(--line) solid var(--main-background-color); /* colors border on img anchors so border matches background and is unseen */ } @@ -829,7 +822,7 @@ a:active { a:hover { color: var(--link-emphasis-text-color); - border: 1px solid var(--link-border-color); + border: var(--line) solid var(--link-border-color); padding: 0; border-radius: var(--control-border-radius); } @@ -852,7 +845,7 @@ a:has(h6):visited { a.emailPop:hover { color: var(--verified-text-color); - border: 1px solid var(--verified-text-color); + border: var(--line) solid var(--verified-text-color); padding: 0; border-radius: var(--control-border-radius); } @@ -880,34 +873,34 @@ a.emailPop:hover { a.deckverified { color: var(--verified-text-color); - border-bottom: 1px dotted var(--verified-text-color); + border-bottom: var(--line) dotted var(--verified-text-color); } a.deckverified:hover { color: var(--verified-text-color); - border: 1px solid var(--verified-text-color); + border: var(--line) solid var(--verified-text-color); padding: 0; } a.createlink { color: var(--pending-text-color); - border-bottom: 1px dotted var(--pending-text-color); + border-bottom: var(--line) dotted var(--pending-text-color); } a.createlink:hover { color: var(--pending-text-color); - border: 1px solid var(--pending-text-color); + border: var(--line) solid var(--pending-text-color); padding: 0; } a.deckunverified { color: var(--error-text-color); - border-bottom: 1px dotted var(--error-text-color); + border-bottom: var(--line) dotted var(--error-text-color); } a.deckunverified:hover { color: var(--error-text-color); - border: 1px solid var(--error-text-color); + border: var(--line) solid var(--error-text-color); padding: 0; } @@ -921,13 +914,13 @@ del { #header_bar { width: calc( - 100% - var(--spacing-10-static) - var(--spacing-10-static) + 100% - var(--spacing-10) - var(--spacing-10) ); /* 100% width minus left and right margins */ max-width: 940px; height: 135px; - margin-left: var(--spacing-10-static); - margin-right: var(--spacing-10-static); + margin-left: var(--spacing-10); + margin-right: var(--spacing-10); margin-bottom: 5px; background-image: url("../images/header_background.jpg"); background-size: cover; @@ -951,7 +944,7 @@ del { box-shadow: 0 2px 5px var(--control-border-color); margin-top: 15px; background: var(--main-background-color); - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); padding-bottom: 10px; } @@ -984,10 +977,10 @@ h2.uppertitle { .menubar { border-radius: var(--grid-border-radius); box-shadow: 0 2px 10px var(--control-border-color); - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background: var(--main-background-color); - padding: var(--spacing-10-static); - gap: var(--spacing-10-static); + padding: var(--spacing-10); + gap: var(--spacing-10); } .menubar:hover { @@ -996,13 +989,13 @@ h2.uppertitle { .menubar ul { display: grid; - gap: var(--spacing-10-static); + gap: var(--spacing-10); grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); } .menubar li { display: block; - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); border-radius: var(--control-border-radius); box-shadow: 0 2px 5px var(--control-border-color); margin: 0; @@ -1016,7 +1009,7 @@ h2.uppertitle { .menubar li a:hover { color: var(--link-emphasis-text-color); - border: 1px solid var(--link-border-color); + border: var(--line) solid var(--link-border-color); } .deck { @@ -1114,7 +1107,7 @@ table.center { } #gatherling_main .eventname { - border-bottom: 1px dotted black; + border-bottom: var(--line) dotted black; } #gatherling_main table th.top { @@ -1131,9 +1124,9 @@ table.center { .event-grid { display: grid; gap: var(--card-grid-gap); - margin-bottom: var(--spacing-20-dynamic); - margin-left: var(--spacing-10-static); - margin-right: var(--spacing-10-static); + margin-bottom: var(--spacing-20); + margin-left: var(--spacing-10); + margin-right: var(--spacing-10); } @media (width >= 40rem) { @@ -1145,8 +1138,8 @@ table.center { .event-card { background-color: var(--card-background-color); border-radius: var(--card-border-radius); - padding: var(--spacing-20-static); - box-shadow: 0 var(--spacing-5-static) var(--spacing-5-static) -1px var(--control-border-color); + padding: var(--spacing-20); + box-shadow: 0 var(--spacing-5) var(--spacing-5) calc(-1 * var(--line)) var(--control-border-color); } .event-card a, @@ -1171,15 +1164,15 @@ table.center { .card-header { display: flex; flex-direction: column; - gap: var(--spacing-5-static); - padding-bottom: var(--spacing-20-dynamic); - border-bottom: 1px solid var(--divider-border-color); + gap: var(--spacing-5); + padding-bottom: var(--spacing-20); + border-bottom: var(--line) solid var(--divider-border-color); } @media (width >= 40rem) { .card-header { flex-direction: row; - gap: var(--spacing-10-static); + gap: var(--spacing-10); justify-content: space-between; align-items: center; } @@ -1191,7 +1184,7 @@ table.center { .event-action { display: flex; align-items: center; - gap: var(--spacing-5-static); + gap: var(--spacing-5); } a.player-count, @@ -1204,9 +1197,9 @@ a.event-type { justify-content: space-between; align-items: center; background-color: var(--top-background-color); - padding: var(--spacing-10-static); + padding: var(--spacing-10); border-radius: var(--control-border-radius); - margin: var(--spacing-20-static) 0; + margin: var(--spacing-20) 0; } /* Pagination @@ -1263,11 +1256,11 @@ Enjoy. color: #337ab7; text-decoration: none; background-color: #fff; - border: 1px solid #ddd; + border: var(--line) solid #ddd; display: block; float: left; position: relative; - margin-left: -1px; + margin-left: calc(-1 * var(--line)); } .Zebra_Pagination li.active a { @@ -1324,7 +1317,7 @@ Enjoy. /* COMMON ATTRIBUTES FOR ALL THE LINKS---------------------------------------------------------------------------------------------------------------------- */ .Zebra_Pagination a { padding: 4px; - border: 1px solid black; + border: var(--line) solid black; color: var(--main-text-color); background-color: var(--main-background-color); text-decoration: none; @@ -1344,7 +1337,7 @@ Enjoy. /* "NEXT PAGE" AND "PREVIOUS PAGE" LINKS---------------------------------------------------------------------------------------------------------------------- */ .Zebra_Pagination a.navigation { - border: 1px solid var(--control-border-color); + border: var(--line) solid var(--control-border-color); background-repeat: no-repeat; } From b767809fb71a0db279e9443f6ee0b656eb36f58a Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 15:04:49 -0800 Subject: [PATCH 10/16] Fix switch to font awesome from SVG A little snafu. --- gatherling/templates/partials/eventCard.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gatherling/templates/partials/eventCard.mustache b/gatherling/templates/partials/eventCard.mustache index cdc4910ec..d01ec4ae1 100644 --- a/gatherling/templates/partials/eventCard.mustache +++ b/gatherling/templates/partials/eventCard.mustache @@ -4,7 +4,7 @@

{{name}}

@@ -22,7 +22,7 @@ Round {{currentRound}} View Standings - + {{/active}} {{^active}} From 9646c0e8181afe5d22ce6eb868a489edbf356cc6 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 15:19:43 -0800 Subject: [PATCH 11/16] More progress on making all CSS use padding/border/margin from a fixed list Still plenty of rogue px values to work through. --- gatherling/styles/css/stylesheet.css | 42 ++++++++++--------- .../partials/createDeckLink.mustache | 3 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/gatherling/styles/css/stylesheet.css b/gatherling/styles/css/stylesheet.css index d19da309f..95d9ca5fe 100644 --- a/gatherling/styles/css/stylesheet.css +++ b/gatherling/styles/css/stylesheet.css @@ -1,5 +1,3 @@ -@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"); - :root { /* Colors In Use */ @@ -72,6 +70,8 @@ --grid-border-radius: var(--spacing-5); --card-border-radius: var(--spacing-10); --line: var(--spacing-1); + --box-padding: var(--spacing-5) var(--spacing-10); + --form-element-padding: var(--spacing-5); /* Typography */ @@ -260,7 +260,6 @@ See also body. */ .grid_10 { max-width: 940px; - margin-bottom: 15px; } .prefix_1 { @@ -309,7 +308,7 @@ table { #gatherling_main td.box.round-header { background-color: var(--highlight-background-color); color: var(--main-text-color); - padding-left: 8px; + padding: var(--box-padding); } /* @@ -356,13 +355,13 @@ table.scoreboard tr.even { } table.scoreboard tr.cutoff { - border-bottom: 3px double var(--notice-text-color); + border-bottom: var(--spacing-5) double var(--notice-text-color); } table.scoreboard td, table.scoreboard th { text-align: center; - padding-right: 5px; + padding-right: var(--spacing-5); } table.scoreboard .playername { @@ -376,8 +375,8 @@ table.scoreboard .playername { margin-right: auto; border-bottom: var(--line) solid var(--divider-border-color); min-height: 200px; - margin-bottom: 20px; - padding-bottom: 20px; + margin-bottom: var(--spacing-20); + padding-bottom: var(--spacing-20); } .series .series-content { @@ -386,14 +385,14 @@ table.scoreboard .playername { .series .series-name { width: 400px; - font-size: 22px; + font-size: var(--font-size-24); font-weight: bold; right: 0; } .series .series-logo { width: 360px; - margin-right: 40px; + margin-right: var(--spacing-40); } .series-logo-img { @@ -410,16 +409,18 @@ table.scoreboard .playername { .series .series-info table th { text-align: right; vertical-align: baseline; - padding-right: 5px; + padding-right: var(--spacing-5); } #gatherling_main .series .series-info table td { vertical-align: baseline; } -a.create_deck_link { - font-size: 13px; - color: var(--link-emphasis-text-color); +a.create-deck-link, +a.create-deck-link:hover, +a.create-deck-link:visited { + font-size: var(--font-size-14); + color: var(--error-text-color); } .cardHoverImageWrapper .linkCardHoverImage { @@ -430,13 +431,14 @@ a.create_deck_link { .crop { float: left; overflow: hidden; - border-radius: 10px; - box-shadow: 0 2px 30px var(--link-border-color); + border-radius: var(--spacing-10); + box-shadow: 0 var(--spacing-5) var(--spacing-40) var(--link-border-color); } /* input values to crop the image: top, right, bottom, left */ .crop img { - margin: -2px -6px -6px; + margin: calc(-1 * var(--spacing-1)) calc(-1 * var(--spacing-5)) + calc(-1 * var(--spacing-5)); } /* Forms */ @@ -445,7 +447,7 @@ a.create_deck_link { border: var(--line) solid var(--control-border-color); color: var(--main-text-color); background-color: var(--highlight-background-color); - padding: 3px; + padding: var(--form-element-padding); border-radius: var(--control-border-radius); } @@ -462,7 +464,7 @@ a.create_deck_link { border: var(--line) solid var(--control-border-color); background-color: var(--disabled-control-background-color); color: var(--disabled-control-color); - padding: 3px; + padding: var(--form-element-padding); border-radius: var(--control-border-radius); } @@ -960,7 +962,7 @@ del { .box h5, .box h6, .box .series-logo img { - padding: 5px 10px; + padding: var(--box-padding); } .uppertitle, diff --git a/gatherling/templates/partials/createDeckLink.mustache b/gatherling/templates/partials/createDeckLink.mustache index 8e1bdd796..7ee32e384 100644 --- a/gatherling/templates/partials/createDeckLink.mustache +++ b/gatherling/templates/partials/createDeckLink.mustache @@ -3,8 +3,7 @@ {{/canCreateDeck}} {{#canCreateDeck}} [Create Deck]{{#invalidRegistration}}*{{/invalidRegistration}} {{/canCreateDeck}} From 3c5bf7216db237e7a9d81a898dd45ac45a4eba85 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 15:31:15 -0800 Subject: [PATCH 12/16] Update font awesome in order to get the new(ish) Discord logo This probably also loads a heck of a lot less stuff than the old way making initial page load faster. This is hidden behind a login but it's just the generic free font awesome so hopefully that isn't a problem and we don't need to configure anything. Or just swap it out if you do. --- gatherling/styles/css/stylesheet.css | 3 ++- gatherling/templates/login.mustache | 4 +++- gatherling/templates/partials/header.mustache | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gatherling/styles/css/stylesheet.css b/gatherling/styles/css/stylesheet.css index 95d9ca5fe..0c41453a1 100644 --- a/gatherling/styles/css/stylesheet.css +++ b/gatherling/styles/css/stylesheet.css @@ -1141,7 +1141,8 @@ table.center { background-color: var(--card-background-color); border-radius: var(--card-border-radius); padding: var(--spacing-20); - box-shadow: 0 var(--spacing-5) var(--spacing-5) calc(-1 * var(--line)) var(--control-border-color); + box-shadow: 0 var(--spacing-5) var(--spacing-5) calc(-1 * var(--line)) + var(--control-border-color); } .event-card a, diff --git a/gatherling/templates/login.mustache b/gatherling/templates/login.mustache index 1f152430e..f6144479d 100644 --- a/gatherling/templates/login.mustache +++ b/gatherling/templates/login.mustache @@ -27,7 +27,9 @@ {{/target}} {{#discordId}} - + {{/discordId}}
Please Click Here if you need to register.
diff --git a/gatherling/templates/partials/header.mustache b/gatherling/templates/partials/header.mustache index 5eb2665b5..33a0c8b9d 100644 --- a/gatherling/templates/partials/header.mustache +++ b/gatherling/templates/partials/header.mustache @@ -5,6 +5,7 @@ Gatherling | {{ title }} + From bdfda765f2642586f857731abfb7944615bf58a2 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 16:17:14 -0800 Subject: [PATCH 13/16] We do not need this check as Event->id is no longer nullable --- gatherling/Views/Components/Preregistration.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/gatherling/Views/Components/Preregistration.php b/gatherling/Views/Components/Preregistration.php index fae7e877e..2d7c82dd7 100644 --- a/gatherling/Views/Components/Preregistration.php +++ b/gatherling/Views/Components/Preregistration.php @@ -68,9 +68,6 @@ public function __construct(Player $player) } $startingSoon = time() >= $eventStart; $startTime = new Time($eventStart, $now); - if (!$event->id) { - throw new InvalidArgumentException("Event ID not found for event {$event->name}"); - } $entry = new Entry($event->id, $player->name); $createDeckLink = $deckLink = null; From e79b98d6d34c887b842d31657da19716bb208137 Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Thu, 28 Nov 2024 16:19:47 -0800 Subject: [PATCH 14/16] Player name is no longer nullable so skip checking for name --- gatherling/Views/Components/Preregistration.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/gatherling/Views/Components/Preregistration.php b/gatherling/Views/Components/Preregistration.php index 2d7c82dd7..c73a2eae1 100644 --- a/gatherling/Views/Components/Preregistration.php +++ b/gatherling/Views/Components/Preregistration.php @@ -24,10 +24,6 @@ class Preregistration extends Component public function __construct(Player $player) { - if (!$player->name) { - throw new NotFoundException("Tried to display preregistration for a player with no name", 0, null, 'Player', []); - } - $upcomingEvents = Event::getUpcomingEvents($player->name); $events = Event::getNextPreRegister(); From e66dbfa447d6ceed10325f43c9ba80c1da7a97fb Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 3 Dec 2024 00:39:34 -0800 Subject: [PATCH 15/16] Remove unnecessary data loading and passing in host control panel We used to display this stuff but I change the display. --- gatherling/Views/Components/HostEvents.php | 8 ++++---- gatherling/Views/Pages/EventList.php | 22 ++++------------------ gatherling/templates/eventList.mustache | 1 - 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/gatherling/Views/Components/HostEvents.php b/gatherling/Views/Components/HostEvents.php index f9fd73682..8510326ac 100644 --- a/gatherling/Views/Components/HostEvents.php +++ b/gatherling/Views/Components/HostEvents.php @@ -8,17 +8,17 @@ class HostEvents extends Component { - /** @var list */ + /** @var list */ public array $pendingEvents = []; - /** @var list */ + /** @var list */ public array $activeEvents = []; public bool $hasPendingEvents; public bool $hasActiveEvents; /** - * @param list $pendingEvents - * @param list $activeEvents + * @param list $pendingEvents + * @param list $activeEvents */ public function __construct(array $pendingEvents, array $activeEvents) { diff --git a/gatherling/Views/Pages/EventList.php b/gatherling/Views/Pages/EventList.php index d35774d24..ceabb3627 100644 --- a/gatherling/Views/Pages/EventList.php +++ b/gatherling/Views/Pages/EventList.php @@ -11,7 +11,6 @@ use Gatherling\Views\Components\HostEvents; use Gatherling\Views\Components\SeasonDropMenu; use Gatherling\Views\Components\SeriesDropMenu; -use Gatherling\Views\Components\Time; use function Gatherling\Helpers\db; use function Gatherling\Helpers\get; @@ -24,9 +23,9 @@ class EventList extends Page public SeriesDropMenu $seriesDropMenu; public SeasonDropMenu $seasonDropMenu; public bool $hasPlayerSeries; - /** @var list */ + /** @var list */ public array $upcomingEvents; - /** @var list */ + /** @var list */ public array $pastEvents; public bool $hasMore; @@ -39,31 +38,18 @@ public function __construct(string $seriesName, string $format, ?int $season) $events = queryEvents($player, $playerSeries, $seriesName, $format, $season); $hasMore = count($events) == 100; - $kvalueMap = [ - 0 => 'none', - 8 => 'Casual', - 16 => 'Regular', - 24 => 'Large', - 32 => 'Championship', - ]; - $pendingEvents = $activeEvents = $upcomingEvents = $pastEvents = $seriesShown = []; foreach ($events as $event) { $seriesShown[] = $event->series; $baseLink = 'event.php?name=' . rawurlencode($event->name) . '&view='; $eventInfo = [ 'name' => $event->name, - 'format' => $event->format, 'players' => $event->players, - 'host' => $event->host, 'start' => $event->start, 'active' => $event->active, 'finalized' => $event->finalized, - 'cohost' => $event->cohost ?? '', 'series' => $event->series, - 'kvalueDisplay' => $kvalueMap[$event->kvalue] ?? '', 'link' => 'event.php?name=' . rawurlencode($event->name), - 'isOngoing' => $event->finalized == 0 && $event->active == 1, 'currentRound' => $event->current_round, 'settingsLink' => "{$baseLink}settings", 'registrationLink' => "{$baseLink}reg", @@ -106,8 +92,8 @@ public function __construct(string $seriesName, string $format, ?int $season) function queryEvents(Player $player, array $playerSeries, string $seriesName, string $format, ?int $season): array { $sql = ' - SELECT e.name, e.format, COUNT(DISTINCT n.player) AS players, e.host, e.start, - e.active, e.finalized, e.cohost, e.series, e.kvalue, e.current_round + SELECT e.name, COUNT(DISTINCT n.player) AS players, e.start, e.active, + e.finalized, e.series, e.current_round FROM events e LEFT JOIN entries AS n ON n.event_id = e.id WHERE (e.host = :player_name OR e.cohost = :player_name OR e.series IN (:series_names))'; diff --git a/gatherling/templates/eventList.mustache b/gatherling/templates/eventList.mustache index 0c969628f..011256414 100644 --- a/gatherling/templates/eventList.mustache +++ b/gatherling/templates/eventList.mustache @@ -70,7 +70,6 @@ {{#pastEvents}} - {{name}} {{players}} From 46a9fa873f4fc7374cbeec54b58b4722c91ad80f Mon Sep 17 00:00:00 2001 From: Thomas David Baker Date: Tue, 3 Dec 2024 00:46:25 -0800 Subject: [PATCH 16/16] Remove checking for falsy Event->id now that it is not nullable --- gatherling/Views/Components/MatchTable.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/gatherling/Views/Components/MatchTable.php b/gatherling/Views/Components/MatchTable.php index 1ab60d6a0..b0e24de46 100644 --- a/gatherling/Views/Components/MatchTable.php +++ b/gatherling/Views/Components/MatchTable.php @@ -42,9 +42,6 @@ public function __construct(Player $player, string $selectedFormat, string $sele $opponent = new Player($opp); $event = $match->getEvent(); - if (!$event->id) { - throw new NotFoundException("Event not found for match {$match->id}", 0, null, 'Event', [$match->id]); - } $oppRating = $opponent->getRating('Composite', $event->start); $oppDeck = $opponent->getDeckEvent($event->id);