From 50f0669f2a0f27da27474b88bb96b7989a3760e7 Mon Sep 17 00:00:00 2001 From: gravel Date: Wed, 17 May 2023 17:03:24 +0000 Subject: [PATCH] Only show 'showcased' tags in table --- output/styles2.css | 3 +++ php/utils/tags.php | 14 ++++++++++++++ sites/+components/tbl_communities.php | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/output/styles2.css b/output/styles2.css index 9a271d67..09249407 100644 --- a/output/styles2.css +++ b/output/styles2.css @@ -452,6 +452,9 @@ label[for=toggle-show-room-ids]::after { } } +.td_name .room-label:not(.room-label-showcased) { + display: none; +} @media (max-width: 1050px) { /* Only current width breakpoint; */ diff --git a/php/utils/tags.php b/php/utils/tags.php index e446f3cd..68af00e0 100644 --- a/php/utils/tags.php +++ b/php/utils/tags.php @@ -121,6 +121,15 @@ return array_unique($tags); } + public function get_tag_classname(): string { + $tag_type = $this->get_tag_type(); + $classname = "room-label-$tag_type"; + if (CommunityTag::is_showcased_tag($this->text)) { + $classname .= " room-label-showcased"; + } + return $classname; + } + public function get_tag_type(): string { return match($this->type) { TagType::USER_TAG => 'user', @@ -133,6 +142,8 @@ * Array of derived tags unavailable for manual tagging. */ private const RESERVED_TAGS = ["official", "nsfw", "modded", "not modded"]; + + private const SHOWCASED_TAGS = ["official"]; private const REDUNDANT_TAGS = ["session"]; @@ -149,5 +160,8 @@ return in_array(strtolower($tag), CommunityTag::RESERVED_TAGS); } + public static function is_showcased_tag(string $tag): bool { + return in_array(strtolower($tag), CommunityTag::SHOWCASED_TAGS); + } } ?> \ No newline at end of file diff --git a/sites/+components/tbl_communities.php b/sites/+components/tbl_communities.php index 7dda6305..cfbacb45 100644 --- a/sites/+components/tbl_communities.php +++ b/sites/+components/tbl_communities.php @@ -87,7 +87,7 @@ get_room_tags() as $tag): ?> text, 16)