Add new tag & modal info

parallel-fetching
gravel 2 years ago
parent 64e200478d
commit f7066d63e0
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -657,7 +657,7 @@ footer nav a {
display: inline;
}
#details-modal-language, #details-modal-users {
#details-modal-language, #details-modal-users, #details-modal-created, #details-modal-server {
display: inline-block;
text-align: center;
}
@ -666,8 +666,8 @@ footer nav a {
margin-block: 0.5em;
}
#details-modal-language::after {
content: "•";
:is(#details-modal-language, #details-modal-users, #details-modal-created)::after {
content: "•"; /* bullet */
margin-inline: 1em;
}
}

@ -9,6 +9,7 @@ export const dom = {
() => Array.from(dom.tbl_communities()?.rows)?.filter(row => !row.querySelector('th')),
community_row: (communityID) => document.getElementById(communityID),
row_info: (row) => {
const dateCreated = new Date(row.getAttribute(ATTRIBUTES.ROW.DATE_CREATED) * 1000);
/** @type {string[]} */
return {
language_flag: row.querySelector('.td_language').textContent.trim(),
@ -24,7 +25,9 @@ export const dom = {
tags: row.getAttribute(ATTRIBUTES.ROW.TAGS),
icon: row.getAttribute(ATTRIBUTES.ROW.ROOM_ICON),
has_icon: row.getAttribute(ATTRIBUTES.ROW.ROOM_ICON).trim() != "",
icon_safety: row.getAttribute(ATTRIBUTES.ROW.ROOM_ICON_SAFETY)
icon_safety: row.getAttribute(ATTRIBUTES.ROW.ROOM_ICON_SAFETY),
date_created: dateCreated,
creation_datestring: dateCreated.toLocaleDateString(undefined, {dateStyle: "medium"})
};
},
meta_timestamp: () => document.querySelector('meta[name=timestamp]'),
@ -72,7 +75,8 @@ export const ATTRIBUTES = {
HOSTNAME: 'data-hostname',
STAFF_DATA: 'data-staff',
ROOM_ICON: 'data-icon',
ROOM_ICON_SAFETY: 'data-icon-safe'
ROOM_ICON_SAFETY: 'data-icon-safe',
DATE_CREATED: 'data-created'
},
SORTING: {
ACTIVE: 'data-sort',

@ -358,6 +358,33 @@
}
*/
if (!$this->write) {
$derived_tags[] =
new CommunityTag(
"read-only",
TagType::RESERVED_TAG,
"This Community is read-only."
);
}
if ($this->write && !$this->upload) {
$derived_tags[] =
new CommunityTag(
"uploads off",
TagType::RESERVED_TAG,
"This Community does not support uploading files or link previews."
);
}
if ($this->created && $this->created > strtotime("-4 week")) {
$derived_tags[] =
new CommunityTag(
"new",
TagType::RESERVED_TAG,
"This Community was created recently."
);
}
return [...$derived_tags, ...$user_tags];
}
}

@ -143,9 +143,17 @@
* @var string[] RESERVED_TAGS
* Array of derived tags unavailable for manual tagging.
*/
private const RESERVED_TAGS = ["official", "nsfw", "modded", "not modded"];
private const SHOWCASED_TAGS = ["official"];
private const RESERVED_TAGS = [
"official",
"nsfw",
"new",
"modded",
"not modded",
"read-only",
"uploads off"
];
private const SHOWCASED_TAGS = ["official", "new"];
private const REDUNDANT_TAGS = ["session"];

@ -42,6 +42,9 @@
<p id="details-modal-users">
Users: <span data-hydrate-with="users"></span>
</p>
<p id="details-modal-created">
Created: <span data-hydrate-with="creation_datestring"></span>
</p>
<p id="details-modal-host">
Server:
<a

@ -79,6 +79,7 @@
data-tags='<?=$tags_json?>'
data-icon='<?=room_icon($room, '64x64')?>'
data-icon-safe='<?=room_icon_safety($room)?>'
data-created='<?=html_sanitize($room->created)?>'
>
<td class="td_language" title="Language flag for '<?=$name?>'"><?=$language?></td>
<td class="td_name"

Loading…
Cancel
Save