diff --git a/frontend/src/lib/components/Dropdown.svelte b/frontend/src/lib/components/Dropdown.svelte index d0ea077bec..1a22910311 100644 --- a/frontend/src/lib/components/Dropdown.svelte +++ b/frontend/src/lib/components/Dropdown.svelte @@ -27,7 +27,7 @@ } - + + -{#if item} - {#if isFolder(item)} -
-
+{#if isFolder(item)} +
+
+
0 ? `padding-left: ${depth * 16}px;` : ''} + >
0 ? `padding-left: ${depth * 16}px;` : ''} + class=" rounded-md p-1 flex justify-center items-center border bg-gray-50 border-gray-200 dark:bg-transparent dark:border-gray-900" > -
- {#if depth === 0} - - {:else} - - {/if} -
- -
- {#if depth === 0}f/{/if}{item.folderName} -
- ({pluralize(item.items.length, ' item')}) -
-
-
- -
- {#if opened} -
- {#each item.items as subItem} - - {/each}
- {/if} + +
+ {#if depth === 0}f/{/if}{item.folderName} +
+ ({pluralize(item.items.length, ' item')}) +
+
+
+
- {:else if isUser(item)} -
-
+ {#if opened} +
+ {#each item.items.slice(0, showMax) as subItem (subItem['path'] ?? 'folder__' + subItem['folderName'])} + + {/each} + {#if showMax < item.items.length} +
{ + if (isFolder(item)) { + showMax += Math.min(30, item.items.length - showMax) + showMax = showMax + console.log(showMax) + } + }} + > + Show more ({showMax}/{item.items.length}) +
+ {/if} +
+ {/if} +
+{:else if isUser(item)} +
+
+
0 ? `padding-left: ${depth * 16}px;` : ''} + >
0 ? `padding-left: ${depth * 16}px;` : ''} + class=" rounded-md p-1 flex justify-center items-center border bg-gray-50 border-gray-200 dark:bg-transparent dark:border-gray-900" > -
- -
+ +
-
- u/{item.username} -
({pluralize(item.items.length, ' item')})
-
+
+ u/{item.username} +
({pluralize(item.items.length, ' item')})
-
- {#if opened} -
- {#each item.items as subItem} - - {/each} -
- {/if} +
- {:else} - - {/if} + {#if opened} +
+ {#each item.items.slice(0, showMax) as subItem (subItem['path'] ?? 'folder__' + subItem['folderName'])} + + {/each} + {#if showMax < item.items.length} + + +
{ + if (isUser(item)) { + showMax += Math.min(30, item.items.length - showMax) + } + }} + > + Show more ({showMax}/{item.items.length}) +
+ {/if} +
+ {/if} +
+{:else} + {/if}