Only show 'showcased' tags in table

dev
gravel 1 year ago
parent 307d9fa5eb
commit 50f0669f2a
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -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; */

@ -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);
}
}
?>

@ -87,7 +87,7 @@
<span class="room-labels-container">
<?php foreach ($room->get_room_tags() as $tag): ?>
<span
class="room-label room-label-<?=$tag->get_tag_type()?> badge"
class="room-label <?=$tag->get_tag_classname()?> badge"
title="<?=$tag->description?>"
><?=
truncate($tag->text, 16)

Loading…
Cancel
Save