UX: don't show "no more questions" if not logged in

This commit is contained in:
Pieter Vander Vennet 2025-01-14 01:52:53 +01:00
parent 9cc67a0b62
commit 8dd6b4c3ef

View file

@ -13,6 +13,7 @@
import { Utils } from "../../../Utils" import { Utils } from "../../../Utils"
import { onDestroy } from "svelte" import { onDestroy } from "svelte"
import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte" import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte"
import LoginToggle from "../../Base/LoginToggle.svelte"
export let layer: LayerConfig export let layer: LayerConfig
export let tags: UIEventSource<Record<string, string>> export let tags: UIEventSource<Record<string, string>>
@ -155,74 +156,78 @@
</TagRenderingQuestionDynamic> </TagRenderingQuestionDynamic>
{/if} {/if}
{#if $allQuestionsToAsk.length === 0} <LoginToggle {state}>
<div class="thanks"> <span slot="not-logged-in"></span>
<Tr t={Translations.t.general.questionBox.done} /> {#if $allQuestionsToAsk.length === 0}
</div> <div class="thanks">
{/if} <Tr t={Translations.t.general.questionBox.done} />
</div>
{/if}
<div class="mt-4 mb-8"> <div class="mt-4 mb-8">
{#if skipped + answered > 0} {#if skipped + answered > 0}
<div class="flex justify-center"> <div class="flex justify-center">
{#if answered === 0} {#if answered === 0}
{#if skipped === 1} {#if skipped === 1}
<Tr t={Translations.t.general.questionBox.skippedOne} /> <Tr t={Translations.t.general.questionBox.skippedOne} />
{:else} {:else}
<Tr t={Translations.t.general.questionBox.skippedMultiple.Subs({ skipped })} /> <Tr t={Translations.t.general.questionBox.skippedMultiple.Subs({ skipped })} />
{/if} {/if}
{:else if answered === 1} {:else if answered === 1}
{#if skipped === 0} {#if skipped === 0}
<Tr t={Translations.t.general.questionBox.answeredOne} /> <Tr t={Translations.t.general.questionBox.answeredOne} />
{:else if skipped === 1}
<Tr t={Translations.t.general.questionBox.answeredOneSkippedOne} />
{:else}
<Tr
t={Translations.t.general.questionBox.answeredOneSkippedMultiple.Subs({ skipped })}
/>
{/if}
{:else if skipped === 0}
<Tr t={Translations.t.general.questionBox.answeredMultiple.Subs({ answered })} />
{:else if skipped === 1} {:else if skipped === 1}
<Tr t={Translations.t.general.questionBox.answeredOneSkippedOne} /> <Tr
t={Translations.t.general.questionBox.answeredMultipleSkippedOne.Subs({ answered })}
/>
{:else} {:else}
<Tr <Tr
t={Translations.t.general.questionBox.answeredOneSkippedMultiple.Subs({ skipped })} t={Translations.t.general.questionBox.answeredMultipleSkippedMultiple.Subs({
/>
{/if}
{:else if skipped === 0}
<Tr t={Translations.t.general.questionBox.answeredMultiple.Subs({ answered })} />
{:else if skipped === 1}
<Tr
t={Translations.t.general.questionBox.answeredMultipleSkippedOne.Subs({ answered })}
/>
{:else}
<Tr
t={Translations.t.general.questionBox.answeredMultipleSkippedMultiple.Subs({
answered, answered,
skipped, skipped,
})} })}
/> />
{/if} {/if}
</div> </div>
{#if skipped + $skippedQuestions.size > 0} {#if skipped + $skippedQuestions.size > 0}
<button <button
class="w-full" class="w-full"
on:click={() => { on:click={() => {
skippedQuestions.setData(new Set()) skippedQuestions.setData(new Set())
skipped = 0 skipped = 0
}} }}
> >
<Tr t={Translations.t.general.questionBox.reactivate} /> <Tr t={Translations.t.general.questionBox.reactivate} />
</button> </button>
{/if}
{/if} {/if}
{/if}
{#if $skippedQuestions.size - skipped > 0} {#if $skippedQuestions.size - skipped > 0}
<button <button
class="w-full" class="w-full"
on:click={() => { on:click={() => {
skippedQuestions.setData(new Set()) skippedQuestions.setData(new Set())
skipped = 0 skipped = 0
}} }}
> >
Show the disabled questions for this object Show the disabled questions for this object
</button> </button>
{/if} {/if}
{#if $debug} {#if $debug}
Skipped questions are {Array.from($skippedQuestions).join(", ")} Skipped questions are {Array.from($skippedQuestions).join(", ")}
{/if} {/if}
</div> </div>
</LoginToggle>
</div> </div>
{/if} {/if}