tweak the prompt for contacts to be able to skip them

This commit is contained in:
2024-02-01 11:52:31 -07:00
parent b38ebc45e1
commit f53a6f3045
3 changed files with 36 additions and 15 deletions

View File

@@ -2,9 +2,9 @@
<div v-if="visible" class="dialog-overlay">
<div class="dialog">
<h1 class="text-xl font-bold text-center mb-4">Here's one:</h1>
<span class="flex justify-between h-24">
<span class="flex justify-between">
<span
class="rounded-l border border-slate-400 bg-slate-200 h-full px-4 py-2 flex h-screen"
class="rounded-l border border-slate-400 bg-slate-200 px-4 py-2 flex"
@click="prevIdea()"
>
<fa icon="chevron-left" class="m-auto" />
@@ -17,22 +17,35 @@
</p>
</span>
<div v-if="currentIdeaIndex == IDEAS.length + 0">
<p class="text-center text-lg font-bold">
Did this person or someone near them do something &ndash; maybe a
while ago?
<br />
<span v-if="currentContact?.name == null" class="text-orange-500">
<p class="text-center">
<span
v-if="currentContact == null"
class="text-orange-500 text-lg font-bold"
>
That's all your contacts.
</span>
<span v-else>{{
currentContact.name || AppString.NO_CONTACT_NAME
}}</span>
<span v-else>
<span class="text-lg font-bold">
Did {{ currentContact.name || AppString.NO_CONTACT_NAME }}
<br />
or someone near them do anything &ndash; maybe a while ago?
</span>
<span class="flex justify-between">
<span />
<button
class="text-center bg-slate-500 text-white px-1.5 py-2 rounded-md mt-4"
@click="nextIdeaPastContacts()"
>
Skip Contacts <fa icon="forward" />
</button>
</span>
</span>
</p>
</div>
</div>
<span
class="rounded-r border border-slate-400 bg-slate-200 h-full px-4 py-2 flex h-screen"
class="rounded-r border border-slate-400 bg-slate-200 px-4 py-2 flex"
@click="nextIdea()"
>
<fa icon="chevron-right" class="m-auto" />
@@ -42,7 +55,7 @@
class="block w-full text-center text-md uppercase bg-slate-500 text-white px-1.5 py-2 rounded-md mt-4"
@click="cancel"
>
That's it.
That's it!
</button>
</div>
</div>
@@ -108,7 +121,7 @@ export default class GivenPrompts extends Vue {
if (
this.currentIdeaIndex == this.CONTACT_PROMPT_INDEX - 1 ||
(this.currentIdeaIndex == this.CONTACT_PROMPT_INDEX &&
this.currentContact)
this.shownContactDbIndices.length < this.numContacts)
) {
this.currentIdeaIndex = this.CONTACT_PROMPT_INDEX;
this.findNextUnshownContact();
@@ -128,7 +141,7 @@ export default class GivenPrompts extends Vue {
(this.CONTACT_PROMPT_INDEX + 1) %
(this.IDEAS.length + this.OTHER_PROMPTS) ||
(this.currentIdeaIndex == this.CONTACT_PROMPT_INDEX &&
this.currentContact)
this.shownContactDbIndices.length < this.numContacts)
) {
this.currentIdeaIndex = this.CONTACT_PROMPT_INDEX;
this.findNextUnshownContact();
@@ -144,6 +157,12 @@ export default class GivenPrompts extends Vue {
}
}
nextIdeaPastContacts() {
this.currentIdeaIndex = 0;
this.currentContact = undefined;
this.shownContactDbIndices = [];
}
async findNextUnshownContact() {
// get a random contact
if (this.shownContactDbIndices.length === this.numContacts) {