Fix identifiers in table PHP.

main
gravel 3 years ago
parent 4ba7520856
commit c627407c67
Signed by: gravel
SSH Key Fingerprint: SHA256:p4HP49CCk4YQMkJpWJ09L8peEPQWjERtdCRAFxPfbOY

@ -56,7 +56,7 @@ export function columnIsSortable(column) {
const TRANSFORMATION = { const TRANSFORMATION = {
numeric: (el) => parseInt(el.innerText), numeric: (el) => parseInt(el.innerText),
casefold: (el) => el.innerText.toLowerCase().trim(), casefold: (el) => el.innerText.toLowerCase().trim(),
tokenData: (el) => el.getAttribute("data-token") getPubkey: (el) => el.getAttribute("data-pubkey")
} }
/** /**
@ -67,7 +67,7 @@ export const COLUMN_TRANSFORMATION = {
[COLUMN.IDENTIFIER]: TRANSFORMATION.casefold, [COLUMN.IDENTIFIER]: TRANSFORMATION.casefold,
[COLUMN.NAME]: TRANSFORMATION.casefold, [COLUMN.NAME]: TRANSFORMATION.casefold,
[COLUMN.DESCRIPTION]: TRANSFORMATION.casefold, [COLUMN.DESCRIPTION]: TRANSFORMATION.casefold,
[COLUMN.SERVER_ICON]: TRANSFORMATION.tokenData [COLUMN.SERVER_ICON]: TRANSFORMATION.getPubkey
} }
/** /**

@ -21,7 +21,7 @@
['id' => "description", 'name' => "Description"], ['id' => "description", 'name' => "Description"],
['id' => "users", 'name' => "Users"], ['id' => "users", 'name' => "Users"],
['id' => "preview", 'name' => "Preview"], ['id' => "preview", 'name' => "Preview"],
['id' => "qr", 'name' => "QR"], ['id' => "qr_code", 'name' => "QR"],
['id' => "server_icon", 'name' => "Server"], ['id' => "server_icon", 'name' => "Server"],
['id' => "join_url", 'name' => "Join URL"], ['id' => "join_url", 'name' => "Join URL"],
]; ];
@ -45,8 +45,8 @@
// However, the fetching code hides component data // However, the fetching code hides component data
// and this is a low risk use case. // and this is a low risk use case.
$token = explode("=", $room->join_link)[1]; $pubkey = explode("=", $room->join_link)[1];
$icon_hue = hexdec($token[2] . $token[2]); $icon_hue = hexdec($pubkey[2] . $pubkey[2]);
$icon_color = "hsl($icon_hue, 80%, 50%)"; $icon_color = "hsl($icon_hue, 80%, 50%)";
$hostname = explode("//", $room->join_link)[1]; $hostname = explode("//", $room->join_link)[1];
@ -79,11 +79,11 @@
> >
</td> </td>
<td class="td_server_icon" <td class="td_server_icon"
data-token="<?=$token?>" data-pubkey="<?=$pubkey?>"
title="<?=$hostname?> (<?=$token?>)" title="<?=$hostname?> (<?=$pubkey?>)"
> >
<div class="td_server_icon-circle" style="background-color: <?=$icon_color?>"> <div class="td_server_icon-circle" style="background-color: <?=$icon_color?>">
<span><?=strtoupper($token[0] . $token[1])?></span> <span><?=strtoupper($pubkey[0] . $pubkey[1])?></span>
</div> </div>
</td> </td>
<td class="td_join_url"> <td class="td_join_url">

Loading…
Cancel
Save