Use icons, like the linked channels list (and fix the no-JS save button)

This commit is contained in:
2026-10-04 10:39:11 +02:00
parent 6ac6858375
commit 1530151598
+16 -13
View File
@@ -193,41 +193,43 @@ block body
- const defaultPingRooms = linkedChannelsWithDetails.filter(row => !row.ping_role_id) - const defaultPingRooms = linkedChannelsWithDetails.filter(row => !row.ping_role_id)
- const pingRoles = [...guild.roles].filter(role => role.id !== guild_id).sort((a, b) => b.position - a.position) - const pingRoles = [...guild.roles].filter(role => role.id !== guild_id).sort((a, b) => b.position - a.position)
h3.mt32.fs-category#room-notifications Room notifications h3.mt32.fs-category#room-notifications Room notifications
.s-card .s-card.p0
p.s-description.mt0 Choose which Discord role receives Matrix @room notifications p.s-description.m12 Choose which Discord role receives Matrix @room notifications
if customPingRooms.length if customPingRooms.length
.s-table-container(style="container-type: inline-size") .s-table-container(style="container-type: inline-size")
table.s-table.s-table__bx-simple(style="table-layout: fixed") table.s-table.s-table__bx-simple(style="table-layout: fixed")
thead thead
tr tr
th(scope="col" style="width: calc(50cqw - 40px)") Channel th(scope="col" style="width: calc(50cqw - 40px)") Channel
th.pr0(scope="col") Notify role th.pr12(scope="col") Notify role
tbody tbody
each row in customPingRooms each row in customPingRooms
tr tr
td.va-middle td.va-middle
label.s-label(for="ping-role-" + row.channel.id)= "#" + row.channel.name +discord(row.channel)
td.pr0 td.pr12
.d-flex.ai-start.g16 .d-flex.ai-start.g8
form.fl-grow1.wmn0(method="post" action=rel("/api/room-ping-role")) form.fl-grow1.wmn0.d-flex.ai-stretch.g8(method="post" action=rel("/api/room-ping-role"))
input(type="hidden" name="guild_id" value=guild_id) input(type="hidden" name="guild_id" value=guild_id)
input(type="hidden" name="channel_id" value=row.channel.id) input(type="hidden" name="channel_id" value=row.channel.id)
.s-select .s-select.fl-grow1.wmn0
select.w100(name="ping_role_id" id="ping-role-" + row.channel.id onchange="this.form.requestSubmit()" style="height: 32px") select.w100(name="ping_role_id" id="ping-role-" + row.channel.id aria-label="Notify role for #" + row.channel.name onchange="this.form.requestSubmit()" style="height: 32px")
if !pingRoles.some(role => role.id === row.ping_role_id) if !pingRoles.some(role => role.id === row.ping_role_id)
option(value=row.ping_role_id selected disabled) Deleted role (choose a replacement) option(value=row.ping_role_id selected disabled) Deleted role (choose a replacement)
each role in pingRoles each role in pingRoles
option(value=role.id selected=row.ping_role_id === role.id)= "@" + role.name option(value=role.id selected=row.ping_role_id === role.id)= "@" + role.name
noscript button.s-btn.s-btn__outlined.py0.box-border(type="submit" data-room-ping-save style="height: 32px; min-height: 0") Save
button.s-btn.s-btn__outlined.mt8(type="submit") Save
form.d-flex.ai-stretch(method="post" action=rel("/api/room-ping-role")) form.d-flex.ai-stretch(method="post" action=rel("/api/room-ping-role"))
input(type="hidden" name="guild_id" value=guild_id) input(type="hidden" name="guild_id" value=guild_id)
input(type="hidden" name="channel_id" value=row.channel.id) input(type="hidden" name="channel_id" value=row.channel.id)
input(type="hidden" name="ping_role_id" value="") input(type="hidden" name="ping_role_id" value="")
button.s-btn.s-btn__danger.s-btn__outlined.py0(type="submit" aria-label="Remove custom role for #" + row.channel.name style="height: 32px") Remove button.s-btn.s-btn__danger.s-btn__outlined.py0(type="submit" aria-label="Remove custom role for #" + row.channel.name style="height: 32px") Remove
script.
document.querySelectorAll('[data-room-ping-save]').forEach(button => button.remove())
if defaultPingRooms.length && pingRoles.length if defaultPingRooms.length && pingRoles.length
details.mt16 details.mt16.mx12.mb12
summary.s-label.cursor-pointer Add custom role summary.s-label.cursor-pointer Add custom role
form.mt16(method="post" action=rel("/api/room-ping-role")) form.mt16(method="post" action=rel("/api/room-ping-role"))
input(type="hidden" name="guild_id" value=guild_id) input(type="hidden" name="guild_id" value=guild_id)
@@ -247,7 +249,8 @@ block body
option(value="" selected disabled) Choose a role option(value="" selected disabled) Choose a role
each role in pingRoles each role in pingRoles
option(value=role.id)= "@" + role.name option(value=role.id)= "@" + role.name
button.s-btn.s-btn__icon.s-btn__filled.d-inline-flex.ai-center.g4.py0(type="submit" style="height: 32px") .d-flex.ai-stretch(style="height: 32px")
button.s-btn.s-btn__icon.s-btn__filled.d-inline-flex.ai-center.g4.py0.box-border(type="submit" style="min-height: 0")
!= icons.Icons.IconPlusSm != icons.Icons.IconPlusSm
span Add span Add