Dynamically update show more title

155172a2b45a660822aa01e7aa69cd8e2f209a04

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +6 -1Ignore whitespace
public/scripts/templates/welcomePanel.html+1 -1
@@ -73,7 +73,7 @@
73 {{/with}}73 {{/with}}
74 {{/each}}74 {{/each}}
75 {{#if more}}75 {{#if more}}
76 <button class="menu_button menu_button_icon showMoreChats" data-i18n="[title]Show more recent chats" title="Show more recent chats">76 <button class="menu_button menu_button_icon showMoreChats">
77 <small class="fa-solid fa-chevron-down fa-fw fa-1x"></small>77 <small class="fa-solid fa-chevron-down fa-fw fa-1x"></small>
78 </button>78 </button>
79 {{/if}}79 {{/if}}
public/scripts/welcome-screen.js+5 -0
@@ -135,12 +135,17 @@ async function sendWelcomePanel() {
135 });135 });
136 const hiddenChats = fragment.querySelectorAll('.recentChat.hidden');136 const hiddenChats = fragment.querySelectorAll('.recentChat.hidden');
137 fragment.querySelectorAll('button.showMoreChats').forEach((button) => {137 fragment.querySelectorAll('button.showMoreChats').forEach((button) => {
138 const showRecentChatsTitle = t`Show more recent chats`;
139 const hideRecentChatsTitle = t`Show less recent chats`;
140
141 button.setAttribute('title', showRecentChatsTitle);
138 button.addEventListener('click', () => {142 button.addEventListener('click', () => {
139 const rotate = button.classList.contains('rotated');143 const rotate = button.classList.contains('rotated');
140 hiddenChats.forEach((chatItem) => {144 hiddenChats.forEach((chatItem) => {
141 chatItem.classList.toggle('hidden', rotate);145 chatItem.classList.toggle('hidden', rotate);
142 });146 });
143 button.classList.toggle('rotated', !rotate);147 button.classList.toggle('rotated', !rotate);
148 button.setAttribute('title', rotate ? showRecentChatsTitle : hideRecentChatsTitle);
144 });149 });
145 });150 });
146 fragment.querySelectorAll('button.openTemporaryChat').forEach((button) => {151 fragment.querySelectorAll('button.openTemporaryChat').forEach((button) => {