fix(dashboard): dont use same indexes per page
changing the accordion to individual collapses meant we could implement keyboard navigation between the cards however, I only handled card collapsing state per-page, which caused an issue where opening one card on one page would open the card with the same index on every page this fixes that by indexing the cards based on its position in the whole list rather than per-page
This commit is contained in:
@@ -156,7 +156,7 @@
|
||||
</CardHeader>
|
||||
</Card>
|
||||
<ListPagination bind:currentPage bind:pageAmount />
|
||||
<CardsList on:deletion={(e) => deleteMemberFromList(e)} bind:list={members} isPublic={isPublic} isMainDash={false} itemType="member" />
|
||||
<CardsList on:deletion={(e) => deleteMemberFromList(e)} bind:list={members} isPublic={isPublic} isMainDash={false} itemType="member" itemsPerPage={itemsPerPage} currentPage={currentPage} />
|
||||
<ListPagination bind:currentPage bind:pageAmount />
|
||||
{/if}
|
||||
{/if}
|
||||
|
@@ -158,7 +158,7 @@
|
||||
</CardHeader>
|
||||
</Card>
|
||||
<ListPagination bind:currentPage bind:pageAmount />
|
||||
<CardsList on:deletion={(e) => deleteGroupFromList(e)} bind:list={groups} isPublic={isPublic} isMainDash={false} itemType="group" />
|
||||
<CardsList on:deletion={(e) => deleteGroupFromList(e)} bind:list={groups} isPublic={isPublic} isMainDash={false} itemType="group" itemsPerPage={itemsPerPage} currentPage={currentPage} />
|
||||
<ListPagination bind:currentPage bind:pageAmount />
|
||||
{/if}
|
||||
{/if}
|
||||
|
@@ -45,9 +45,9 @@
|
||||
// just a hidden option to expand the cards by default regardless of your global settings
|
||||
let openByDefault = false;
|
||||
if (searchParams && searchParams.get("open") === "true") openByDefault = true;
|
||||
|
||||
let settings = JSON.parse(localStorage.getItem("pk-settings"));
|
||||
|
||||
let rollCounter = 1;
|
||||
|
||||
onMount(async () => {
|
||||
await fetchList(amount, usePrivateMembers);
|
||||
});
|
||||
@@ -110,6 +110,7 @@
|
||||
|
||||
randomList = randomizeList(parseInt(optionAmount), optionUsePrivateMembers, optionAllowDoubles);
|
||||
navigate(`${path}${paramArray.length > 0 ? `?${paramArray.join('&')}` : ""}`);
|
||||
rollCounter ++;
|
||||
}
|
||||
|
||||
function capitalizeFirstLetter(string: string) {
|
||||
@@ -205,7 +206,7 @@
|
||||
{:else if err}
|
||||
<Alert color="danger">{err}</Alert>
|
||||
{:else}
|
||||
<CardsList openByDefault={openByDefault} bind:list={randomList} isPublic={true} isMainDash={false} itemType={type} />
|
||||
<CardsList openByDefault={openByDefault} bind:list={randomList} isPublic={true} isMainDash={false} itemType={type} itemsPerPage={5} currentPage={rollCounter} />
|
||||
{/if}
|
||||
</Col>
|
||||
</Row>
|
||||
|
Reference in New Issue
Block a user