File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ <h1>Decoration Gallery</h1>
152152 < div id ="grid " class ="grid "> </ div >
153153
154154 < script >
155- // Fetch logos and decorations from separate json files dynamically
155+ // Fetch logos and decorations from separate JSON files dynamically
156156 function loadGroupLogos ( ) {
157157 return fetch ( 'https://raw.githubusercontent.com/DiscoLook/discolook.github.io/refs/heads/main/group_logos.json?' + Date . now ( ) )
158158 . then ( response => response . json ( ) )
@@ -194,7 +194,10 @@ <h1>Decoration Gallery</h1>
194194 const grid = document . getElementById ( 'grid' ) ;
195195 grid . innerHTML = '' ; // Clear any existing content
196196
197- Object . entries ( data . groups ) . forEach ( ( [ groupName , groupItems ] ) => {
197+ // Sort groups by the number of decorations (descending order)
198+ const sortedGroups = Object . entries ( data . groups ) . sort ( ( a , b ) => b [ 1 ] . length - a [ 1 ] . length ) ;
199+
200+ sortedGroups . forEach ( ( [ groupName , groupItems ] ) => {
198201 // Create and append group title
199202 const groupTitle = document . createElement ( 'h2' ) ;
200203 groupTitle . className = 'group-title' ;
You can’t perform that action at this time.
0 commit comments