Skip to content

Commit

Permalink
fix: wrong path to assets
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves committed Apr 2, 2024
1 parent 7b71e33 commit a01d6ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,17 @@ function nextCard() {
setTimeout(() => (animated.value = true));
}
const speak = async () => {
async function speak () {
const card = cards.value[index.value];
speechSynthesis.speak(
Object.assign(
new SpeechSynthesisUtterance(flashcards.value[currentCard.value].front),
{ lang: lang.value }
new SpeechSynthesisUtterance(showTranslation.value ? card.back : card.front),
{ lang: showTranslation.value ? 'en' : lang.value }
)
);
};
const handleKeyDown = (event) => {
function handleKeyDown (event) {
if (event.key === "d" || event.key === "ArrowLeft") {
prevCard();
}
Expand All @@ -155,6 +156,10 @@ const handleKeyDown = (event) => {
if (event.key === "r") {
shuffle();
}
if (event.key === "p" && canSpeak.value) {
speak();
}
};
onMounted(async () => {
Expand Down
2 changes: 1 addition & 1 deletion components/word-pairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const fetchPairs = async (language: string): Promise<Pair[]> => {
let source: Array<[string, string]>;

if (knownLanguages.includes(language)) {
source = await fetch(`/lang/${language}.json`).then((x) => x.json());
source = await fetch(`/assets/lang/${language}.json`).then((x) => x.json());
} else {
source = JSON.parse(await generateWordPairs({ language, count: 20 }));
}
Expand Down

0 comments on commit a01d6ae

Please sign in to comment.