@@ -118,42 +118,6 @@ <h2 class="text-base font-bold text-gray-900">Connection Settings</h2>
118118 < button onclick ="toggleApiKeyVisibility() " class ="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 ">
119119 < svg id ="eye-icon " class ="w-4 h-4 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 "> < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M15 12a3 3 0 11-6 0 3 3 0 016 0z "/> < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z "/> </ svg >
120120 </ button >
121-
122- <!-- Invite Link -->
123- < div class ="bg-white rounded-xl border border-gray-200 shadow-sm p-5 space-y-3 ">
124- < h3 class ="text-sm font-semibold text-gray-800 "> Invite Link</ h3 >
125- < div class ="flex gap-2 ">
126- < button onclick ="getInviteCode() " class ="btn-send text-white text-xs font-semibold px-4 py-2 rounded-lg flex items-center gap-1.5 ">
127- < svg class ="w-3.5 h-3.5 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 "> < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1 "/> </ svg >
128- Get Link
129- </ button >
130- < button onclick ="revokeInviteCode() " class ="border border-red-300 text-red-500 text-xs font-semibold px-4 py-2 rounded-lg hover:bg-red-50 transition-colors flex items-center gap-1.5 ">
131- < svg class ="w-3.5 h-3.5 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 "> < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636 "/> </ svg >
132- Revoke
133- </ button >
134- </ div >
135- < div id ="sg-invite-display " class ="hidden bg-gray-50 rounded-lg px-3 py-2 flex items-center justify-between gap-2 ">
136- < span id ="sg-invite-url " class ="text-xs text-green-700 font-mono break-all "> </ span >
137- < button onclick ="copyInviteLink() " class ="shrink-0 text-xs text-gray-500 hover:text-gray-700 border border-gray-300 px-2 py-1 rounded "> Copy</ button >
138- </ div >
139- </ div >
140-
141- <!-- Leave Group -->
142- < div class ="bg-white rounded-xl border border-red-100 shadow-sm p-5 ">
143- < div class ="flex items-center justify-between ">
144- < div >
145- < h3 class ="text-sm font-semibold text-red-600 "> Leave Group</ h3 >
146- < p class ="text-xs text-gray-500 mt-0.5 "> Remove this account from the group.</ p >
147- </ div >
148- < button onclick ="leaveGroup() " class ="border border-red-300 text-red-500 font-semibold text-sm px-4 py-2 rounded-lg hover:bg-red-50 transition-colors flex items-center gap-2 ">
149- < svg class ="w-4 h-4 " fill ="none " stroke ="currentColor " viewBox ="0 0 24 24 "> < path stroke-linecap ="round " stroke-linejoin ="round " stroke-width ="2 " d ="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1 "/> </ svg >
150- Leave Group
151- </ button >
152- </ div >
153- </ div >
154-
155- </ div >
156-
157121 </ div >
158122 </ div >
159123 < div >
@@ -1742,6 +1706,7 @@ <h3 class="text-sm font-semibold text-gray-800">Privacy Settings</h3>
17421706 const res = await fetch ( url , { headers : { 'apikey' : cfg . apikey } } ) ;
17431707 const data = await res . json ( ) ;
17441708 allGroups = Array . isArray ( data ) ? data : [ ] ;
1709+ filteredGroups = [ ...allGroups ] ;
17451710 renderGroupList ( allGroups ) ;
17461711 document . getElementById ( 'groups-count' ) . textContent = `${ allGroups . length } groups` ;
17471712 const badge = document . getElementById ( 'resp-badge' ) ;
@@ -1778,10 +1743,13 @@ <h3 class="text-sm font-semibold text-gray-800">Privacy Settings</h3>
17781743 } ) . join ( '' ) ;
17791744 }
17801745
1746+ let filteredGroups = [ ] ;
1747+
17811748 function filterGroups ( ) {
17821749 const q = document . getElementById ( 'group-search' ) . value . toLowerCase ( ) ;
1783- const filtered = allGroups . filter ( g => ( g . subject || '' ) . toLowerCase ( ) . includes ( q ) ) ;
1784- renderGroupList ( filtered ) ;
1750+ filteredGroups = allGroups . filter ( g => ( g . subject || '' ) . toLowerCase ( ) . includes ( q ) ) ;
1751+ document . getElementById ( 'groups-count' ) . textContent = `${ filteredGroups . length } groups` ;
1752+ renderGroupList ( filteredGroups ) ;
17851753 }
17861754
17871755 function toggleGroup ( jid , name , checked ) {
@@ -1791,14 +1759,16 @@ <h3 class="text-sm font-semibold text-gray-800">Privacy Settings</h3>
17911759 }
17921760
17931761 function selectAllGroups ( ) {
1794- allGroups . forEach ( g => { selectedGroups [ g . id ] = g . subject || g . id ; } ) ;
1795- renderGroupList ( allGroups ) ;
1762+ const list = filteredGroups . length > 0 || document . getElementById ( 'group-search' ) . value ? filteredGroups : allGroups ;
1763+ list . forEach ( g => { selectedGroups [ g . id ] = g . subject || g . id ; } ) ;
1764+ renderGroupList ( list ) ;
17961765 renderSelectedChips ( ) ;
17971766 }
17981767
17991768 function clearGroupSelection ( ) {
18001769 selectedGroups = { } ;
1801- renderGroupList ( allGroups ) ;
1770+ const list = filteredGroups . length > 0 || document . getElementById ( 'group-search' ) . value ? filteredGroups : allGroups ;
1771+ renderGroupList ( list ) ;
18021772 renderSelectedChips ( ) ;
18031773 }
18041774
0 commit comments