wordle backend and some frontend changes
Build / Build-image (push) Successful in 1m13s

This commit is contained in:
2026-08-27 22:33:19 +02:00
parent 865ac153b2
commit 5d5250287d
6 changed files with 92 additions and 47 deletions
+30 -24
View File
@@ -11,8 +11,9 @@ import Wordle from '../components/Wordle.vue';
data() {
return {
hint: ' ',
guesses: [' '],
words: [' '],
guesses: [''],
words: [''],
correct_words: [''],
guess: '',
tla: '',
context: '',
@@ -21,6 +22,7 @@ import Wordle from '../components/Wordle.vue';
loss: false,
maxGuesses: 10,
correct: false,
no_tla: false,
};
},
@@ -28,12 +30,15 @@ import Wordle from '../components/Wordle.vue';
axios
.get('/api/fetch_tla/en')
.then(response => {
this.hint = response.data.hint;
this.submitter = response.data.submitter;
this.guesses = response.data.guesses;
this.tla = response.data.tla;
this.context = response.data.context;
this.correct = response.data.correct;
if (response.data.no_tla) this.no_tla = true;
else {
this.hint = response.data.hint;
this.submitter = response.data.submitter;
this.guesses = response.data.guesses;
this.tla = response.data.tla;
this.context = response.data.context;
this.correct = response.data.correct;
}
});
},
@@ -85,26 +90,25 @@ import Wordle from '../components/Wordle.vue';
</template>
<template v-for="guess in guesses">
<template v-for="guess in guesses" v-if="guesses.length>1">
<div class="flex-container">
<template v-for="i in 3">
<GuessWord :correctness="Number(guess[i+2])">
<GuessWord :correctness="Number(guess[i+2])" :correct="correct_words[i-1]">
{{ guess[i-1] }}
</GuessWord>
</template>
</div>
</template>
</template>
<template v-if="guesses.length < maxGuesses && !correct">
<div class="flex-container" v-if="guess.length > 0">
<template v-for="word in words">
<GuessWord :correctness="words.length == 3 ? -1 : (words.length > 3 ? -2 : -3)">
{{ word }}
</GuessWord>
</template>
</div>
<template v-if="guesses.length < maxGuesses && !correct && !no_tla">
<div class="flex-container" v-if="guess.length > 0">
<template v-for="word in words">
<GuessWord :correctness="words.length == 3 ? -1 : (words.length > 3 ? -2 : -3)">
{{ word }}
</GuessWord>
</template>
</div>
<UForm class="space-y-2" ref="main-form" @submit="onSubmit" onsubmit="return false">
<UFormField>
<UInput v-model="guess" @keyup="onkeyup()" autofocus/>
@@ -115,6 +119,10 @@ import Wordle from '../components/Wordle.vue';
</UButton>
</UForm>
</template>
<template v-else>
<h2>No TLA for today, please shoot me an email to <a style="text-decoration: underline;" href="mailto:peter@sc0tt.org">
peter@sc0tt.org</a></h2>
</template>
<template v-if="!correct && guesses.length >= maxGuesses">
You ran out of guesses. Todays TLA was <b>{{ tla }}</b>
<Review/>
@@ -123,7 +131,7 @@ import Wordle from '../components/Wordle.vue';
You completed todays TLAdle! Todays TLA was <b>{{ tla }}</b>
<Review/>
</template>
<h3>Guesses left: {{ maxGuesses - guesses.length }}</h3>
<h3 v-if="!no_tla">Guesses left: {{ maxGuesses - guesses.length }}</h3>
</UCard>
<br>
<template v-if="submitter != null">
@@ -146,9 +154,7 @@ import Wordle from '../components/Wordle.vue';
<h3>The context of todays TLA:</h3>
{{ context }}
</Modal>
<Wordle correct="testword"/>
<Wordle correct="sadf"/>
</template>