move sorting to backend
This commit is contained in:
@@ -136,6 +136,16 @@ export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
albumUsers.sort((a, b) => {
|
||||||
|
if (a.role === AlbumUserRole.VIEWER && b.role === AlbumUserRole.EDITOR) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (a.role === AlbumUserRole.EDITOR && b.role === AlbumUserRole.VIEWER) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return a.user.name.localeCompare(b.user.name);
|
||||||
|
});
|
||||||
|
|
||||||
const assets = entity.assets || [];
|
const assets = entity.assets || [];
|
||||||
|
|
||||||
const hasSharedLink = entity.sharedLinks?.length > 0;
|
const hasSharedLink = entity.sharedLinks?.length > 0;
|
||||||
|
|||||||
@@ -99,15 +99,7 @@
|
|||||||
<p class="text-sm">Owner</p>
|
<p class="text-sm">Owner</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#each album.albumUsers.toSorted((a, b) => {
|
{#each album.albumUsers as { user, role }}
|
||||||
if (a.role === AlbumUserRole.Viewer && b.role === AlbumUserRole.Editor) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a.role === AlbumUserRole.Editor && b.role === AlbumUserRole.Viewer) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return a.user.name.localeCompare(b.user.name);
|
|
||||||
}) as { user, role }}
|
|
||||||
<div
|
<div
|
||||||
class="flex w-full place-items-center justify-between gap-4 p-5 rounded-xl transition-colors hover:bg-gray-50 dark:hover:bg-gray-700"
|
class="flex w-full place-items-center justify-between gap-4 p-5 rounded-xl transition-colors hover:bg-gray-50 dark:hover:bg-gray-700"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user