fix(dashboard): dont break list when changing item visibility

This commit is contained in:
Jake/Rads 2022-06-23 23:03:05 +02:00
parent c3f92cec93
commit 150331a3e4
2 changed files with 44 additions and 74 deletions

View File

@ -162,69 +162,55 @@
{#if settings && settings.accessibility ? (!settings.accessibility.expandedcards && !settings.accessibility.pagelinks) : true} {#if settings && settings.accessibility ? (!settings.accessibility.expandedcards && !settings.accessibility.pagelinks) : true}
<Accordion class="mb-3" stayOpen> <Accordion class="mb-3" stayOpen>
{#each slicedMembers as member, index (member.id)} {#each slicedMembers as member, index (member.id)}
{#if (!isPublic && member.privacy.visibility === "public") || isPublic}
<AccordionItem> <AccordionItem>
<CardsHeader bind:item={member} slot="header"> <CardsHeader bind:item={member} slot="header">
<FaUserCircle slot="icon" /> <div slot="icon">
{#if isPublic || member.privacy.visibility === "public"}
<FaUserCircle />
{:else}
<FaLock />
{/if}
</div>
</CardsHeader> </CardsHeader>
<MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/> <MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/>
</AccordionItem> </AccordionItem>
{:else}
<AccordionItem>
<CardsHeader bind:item={member} slot="header">
<FaLock slot="icon" />
</CardsHeader>
<MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/>
</AccordionItem>
{/if}
{/each} {/each}
</Accordion> </Accordion>
{:else if settings.accessibility.expandedcards} {:else if settings.accessibility.expandedcards}
{#each slicedMembers as member, index (member.id)} {#each slicedMembers as member, index (member.id)}
{#if (!isPublic && member.privacy.visibility === "public") || isPublic}
<Card class="mb-3"> <Card class="mb-3">
<CardHeader> <CardHeader>
<CardsHeader bind:item={member}> <CardsHeader bind:item={member}>
<FaUserCircle slot="icon" /> <div slot="icon">
{#if isPublic || member.privacy.visibility === "public"}
<FaUserCircle />
{:else}
<FaLock />
{/if}
</div>
</CardsHeader> </CardsHeader>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/> <MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/>
</CardBody> </CardBody>
</Card> </Card>
{:else}
<Card class="mb-3">
<CardHeader>
<CardsHeader bind:item={member}>
<FaLock slot="icon" />
</CardsHeader>
</CardHeader>
<CardBody>
<MemberBody on:update={updateMemberList} isMainDash={isMainDash} on:deletion={deleteMemberFromList} bind:member bind:isPublic={isPublic}/>
</CardBody>
</Card>
{/if}
{/each} {/each}
{:else} {:else}
<div class="my-3"> <div class="my-3">
{#each slicedMembers as member, index (member.id)} {#each slicedMembers as member, index (member.id)}
{#if (!isPublic && member.privacy.visibility === "public") || isPublic}
<Card> <Card>
<Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/m/${member.id}` : `/profile/m/${member.id}`}> <Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/m/${member.id}` : `/profile/m/${member.id}`}>
<CardsHeader bind:item={member}> <CardsHeader bind:item={member}>
<FaUserCircle slot="icon" /> <div slot="icon">
{#if isPublic || member.privacy.visibility === "public"}
<FaUserCircle />
{:else}
<FaLock />
{/if}
</div>
</CardsHeader> </CardsHeader>
</Link> </Link>
</Card> </Card>
{:else}
<Card>
<Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/m/${member.id}` : `/profile/m/${member.id}`}>
<CardsHeader bind:item={member}>
<FaLock slot="icon" />
</CardsHeader>
</Link>
</Card>
{/if}
{/each} {/each}
</div> </div>
{/if} {/if}

View File

@ -169,69 +169,53 @@
{#if settings && settings.accessibility ? (!settings.accessibility.expandedcards && !settings.accessibility.pagelinks) : true} {#if settings && settings.accessibility ? (!settings.accessibility.expandedcards && !settings.accessibility.pagelinks) : true}
<Accordion class="mb-3" stayOpen> <Accordion class="mb-3" stayOpen>
{#each slicedGroups as group, index (group.id)} {#each slicedGroups as group, index (group.id)}
{#if (!isPublic && group.privacy.visibility === "public") || isPublic}
<AccordionItem> <AccordionItem>
<CardsHeader bind:item={group} slot="header"> <CardsHeader bind:item={group} slot="header">
<FaUsers slot="icon" /> <div slot="icon">
{#if isPublic || group.privacy.visibility === "public"}
<FaUsers />
{:else}
<FaLock />
{/if}
</div>
</CardsHeader> </CardsHeader>
<GroupBody bind:members={systemMembers} on:update={updateGroupList} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/> <GroupBody bind:members={systemMembers} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/>
</AccordionItem> </AccordionItem>
{:else}
<AccordionItem>
<CardsHeader bind:item={group} slot="header">
<FaLock slot="icon" />
</CardsHeader>
<GroupBody bind:members={systemMembers} on:update={updateGroupList} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/>
</AccordionItem>
{/if}
{/each} {/each}
</Accordion> </Accordion>
{:else if settings.accessibility.expandedcards} {:else if settings.accessibility.expandedcards}
{#each slicedGroups as group, index (group.id)} {#each slicedGroups as group, index (group.id)}
{#if (!isPublic && group.privacy.visibility === "public") || isPublic}
<Card class="mb-3"> <Card class="mb-3">
<CardHeader> <CardHeader>
<CardsHeader bind:item={group} > <div slot="icon">
<FaUsers slot="icon" /> {#if isPublic || group.privacy.visibility === "public"}
</CardsHeader> <FaUsers />
{:else}
<FaLock />
{/if}
</div>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<GroupBody bind:members={systemMembers} on:update={updateGroupList} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/> <GroupBody bind:members={systemMembers} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/>
</CardBody> </CardBody>
</Card> </Card>
{:else}
<Card class="mb-3">
<CardHeader>
<CardsHeader bind:item={group} >
<FaLock slot="icon" />
</CardsHeader>
</CardHeader>
<CardBody>
<GroupBody bind:members={systemMembers} on:update={updateGroupList} isMainDash={isMainDash} on:deletion={deleteGroupFromList} bind:group bind:isPublic={isPublic}/>
</CardBody>
</Card>
{/if}
{/each} {/each}
{:else} {:else}
<div class="my-3"> <div class="my-3">
{#each slicedGroups as group, index (group.id)} {#each slicedGroups as group, index (group.id)}
{#if (!isPublic && group.privacy.visibility === "public") || isPublic}
<Card> <Card>
<Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/g/${group.id}` : `/profile/g/${group.id}`}> <Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/g/${group.id}` : `/profile/g/${group.id}`}>
<CardsHeader bind:item={group}> <CardsHeader bind:item={group}>
<FaUsers slot="icon" /> <div slot="icon">
{#if isPublic || group.privacy.visibility === "public"}
<FaUsers />
{:else}
<FaLock />
{/if}
</div>
</CardsHeader> </CardsHeader>
</Link> </Link>
</Card> </Card>
{:else}
<Card>
<Link class="accordion-button collapsed" style="text-decoration: none;" to={!isPublic ? `/dash/g/${group.id}` : `/profile/g/${group.id}`}>
<CardsHeader bind:item={group}>
<FaUsers slot="icon" />
</CardsHeader>
</Link>
</Card>
{/if}
{/each} {/each}
</div> </div>
{/if} {/if}