diff --git a/src/app/challenge/challenge.component.ts b/src/app/challenge/challenge.component.ts
index 9bddd3f..d9307c4 100644
--- a/src/app/challenge/challenge.component.ts
+++ b/src/app/challenge/challenge.component.ts
@@ -1,15 +1,16 @@
import {Component} from '@angular/core';
import {LetterComponent} from "../letter/letter.component";
-import {NgForOf} from "@angular/common";
+import {NgForOf, NgIf} from "@angular/common";
import sentences from "./sentenceProvider";
@Component({
selector: 'app-challenge',
standalone: true,
- imports: [
- LetterComponent,
- NgForOf
- ],
+ imports: [
+ LetterComponent,
+ NgForOf,
+ NgIf
+ ],
templateUrl: './challenge.component.html',
styleUrl: './challenge.component.scss'
})
@@ -18,19 +19,27 @@ export class ChallengeComponent {
enteredText = "";
getSentence() {
- const sentenceArray = sentences.split('\n');
- return sentenceArray[Math.floor(Math.random() * sentenceArray.length)];
+ const sentenceArray = sentences.split('\n');
+ return sentenceArray[Math.floor(Math.random() * sentenceArray.length)];
}
+
getText() {
- this.text = this.text.replace(/ /g, '\u00A0');
- return this.text.split('')
+ return this.text.split('');
}
onChangeInput($event: Event) {
const target = $event.target as HTMLInputElement;
this.enteredText = target.value;
- console.log()
+
+ const trimmedText = this.text.trim();
+ const trimmedEnteredText = this.enteredText.trim();
+ for (let i = 0; i < trimmedText.length; i++) {
+ if (trimmedText.charCodeAt(i) !== trimmedEnteredText.charCodeAt(i)) {
+ console.log(`Difference at position ${i}: '${trimmedText[i]}' (${trimmedText.charCodeAt(i)}) vs '${trimmedEnteredText[i]}' (${trimmedEnteredText.charCodeAt(i)})`);
+ }
+ }
+
}
nextSentence() {
diff --git a/src/app/challenge/sentenceProvider.ts b/src/app/challenge/sentenceProvider.ts
index 6ebe8ff..fe0c997 100644
--- a/src/app/challenge/sentenceProvider.ts
+++ b/src/app/challenge/sentenceProvider.ts
@@ -1,62 +1,52 @@
-let sentences = `It isn't true that my mattress is made of cotton candy.
-Had he known what was going to happen, he would have never stepped into the shower.
-You're good at English when you know the difference between a man eating chicken and a man-eating chicken.
-The tart lemonade quenched her thirst, but not her longing.
-People keep telling me "orange" but I still prefer "pink".
-Her hair was windswept as she rode in the black convertible.
-The water flowing down the river didn’t look that powerful from the car
-Mom didn’t understand why no one else wanted a hot tub full of jello.
-Everybody should read Chaucer to improve their everyday vocabulary.
-It must be five o'clock somewhere.
-He was 100% into fasting with her until he understood that meant he couldn't eat.
-The sunblock was handed to the girl before practice, but the burned skin was proof she did not apply it.
-The estate agent quickly marked out his territory on the dance floor.
-If you like tuna and tomato sauce, try combining the two, it’s really not as bad as it sounds.
-He said he was not there yesterday; however, many people saw him there.
-Normal activities took extraordinary amounts of concentration at the high altitude.
-The snow-covered path was no help in finding his way out of the back-country.
-Instead of a bachelorette party
-She opened up her third bottle of wine of the night.
-I’m a living furnace.
-The spa attendant applied the deep cleaning mask to the gentleman’s back.
-She couldn't understand why nobody else could see that the sky is full of cotton candy.
-Beach-combing replaced wine tasting as his new obsession.
-The teenage boy was accused of breaking his arm simply to get out of the test.
-Thirty years later, she still thought it was okay to put the toilet paper roll under rather than over.
-As the asteroid hurtled toward earth, Becky was upset her dentist appointment had been canceled.
-The old apple revels in its authority.
-Too many prisons have become early coffins.
-Despite what your teacher may have told you, there is a wrong way to wield a lasso.
-Situps are a terrible way to end your day.
-The lyrics of the song sounded like fingernails on a chalkboard.
-Don't put peanut butter on the dog's nose.
-Today we gathered moss for my uncle's wedding.
-She wrote him a long letter, but he didn't read it.
-He didn’t want to go to the dentist, yet he went anyway.
-It was obvious she was hot, sweaty, and tired.
-Smoky the Bear secretly started the fires.
-If you don't like toenails, you probably shouldn't look at your feet.
-His mind was blown that there was nothing in space except space itself.
-The urgent care center was flooded with patients after the news of a new deadly virus was made public.
-The fact that there's a stairway to heaven and a highway to hell explains life well.
-Watching the geriatric men’s softball team brought back memories of 3 yr olds playing t-ball.
-Chocolate covered crickets were his favorite snack.
-Henry couldn't decide if he was an auto mechanic or a priest.
-Various sea birds are elegant, but nothing is as elegant as a gliding pelican.
-The thick foliage and intertwined vines made the hike nearly impossible.
-The bird had a belief that it was really a groundhog.
-She had some amazing news to share but nobody to share it with.
-The light in his life was actually a fire burning all around him.
-Two seats were vacant.
-The toilet paper floated in the air, but she was thankful it wasn't a spider.
-I flushed the spider down the toilet.
-The hummingbird's wings blurred while it eagerly sipped the sugar water from the feeder.
-Getting up at dawn is for the birds.
-Sucking on the ice cube made the toothache less painful.
-Shitting rainbows is a disgusting way to describe something amazing.
-The fish dreamed of escaping the fishbowl and into the toilet where he saw his friend go.
-The fish listened intently to what the frogs had to say.
-Buying deodorant is a rite of passage for young teens.
-A floating human heart is a creepy thing to see in the middle of the ocean.`;
-
+let sentences = `The dog sniffed curiously around the new litter box, confused by the cat's presence.
+"Why does the furnace always seem to break on the coldest day?" she wondered, shivering.
+The unmistakable aroma of wet dog filled the room after the rainstorm.
+"Remember to hydrate," the coach yelled, as the players ran laps under the hot sun.
+The cat's fur glistened in the sunlight, showcasing its healthy skin.
+A plumber's day is never dull, especially when the next call involves a clogged toilet.
+He wrinkled his nose at the bad smell emanating from the forgotten gym bag.
+The water in the lake was so clear, you could see the fish swimming below.
+"Training a puppy requires patience, especially when it comes to housebreaking," she advised.
+The crackling sound from the furnace was a comforting reminder of warmth in winter.
+She applied sunscreen diligently, knowing the importance of protecting her skin.
+The cat proudly presented its latest catch, much to its owner's dismay.
+A walk in the park often turned into a poop-scooping adventure with his new puppy.
+The stench from the garbage can was a clear reminder to take out the trash.
+"This toilet has seen better days," he thought, reaching for the plunger.
+Water droplets glistened on the leaves after the morning dew.
+He couldn't help but laugh at the dog's silly antics in the bath.
+A sudden whiff of sulfur indicated that the furnace needed servicing.
+The cat's indifference to the new dog was both amusing and frustrating.
+"Hydration is key," she reminded herself, filling her water bottle.
+The toilet overflowed, leading to a chaotic and wet mess in the bathroom.
+He marveled at how the skin heals itself after a minor cut.
+The litter box duty was the least favorite of all the pet-related chores.
+As the furnace kicked on, a warm and cozy feeling enveloped the room.
+The dog's excitement for its daily walk was infectious and uplifting.
+He noticed a strange smell coming from the basement, hinting at a possible furnace issue.
+Applying moisturizer became a daily ritual to combat dry skin.
+The cat curled up in the sunbeam, purring contentedly.
+Walking the dog was more about sniffing every tree than actual exercise.
+The bathroom air freshener worked overtime to combat the lingering bad smells.
+He was fascinated by the water's ability to shape the landscape over time.
+The skin clinic offered new treatments for rejuvenation and care.
+The playful kitten knocked over the water bowl again.
+A routine checkup of the furnace ensured it would run smoothly all winter.
+The dog's muddy paws were a clear sign of an adventurous day.
+"There's nothing like a hot shower to relax," she thought, turning on the water.
+The cat's agility and grace were always a marvel to watch.
+He dreaded the toilet cleaning, but it was a necessary evil.
+Hydrating face masks became her go-to for maintaining healthy skin.
+The dog trainer emphasized the importance of consistency in training.
+A faint burning smell suggested it was time to service the furnace.
+The cat's disdain for the new puppy was evident in its hissing.
+After a long run, he appreciated the importance of replenishing his body with water.
+The smell of rain on hot pavement was both refreshing and nostalgic.
+"This new toilet cleaner works wonders," she noted with satisfaction.
+He carefully applied aloe vera to soothe his sunburned skin.
+The kitten's playful antics with a water bottle cap were endlessly entertaining.
+Regular maintenance of the furnace was key to avoiding unexpected breakdowns.
+The dog's loyalty and companionship were unmatched.
+She marveled at the way water droplets formed patterns on the window during a storm.`;
+sentences = sentences.replace(/\u00A0/g, ' ');
export default sentences;
diff --git a/src/app/letter/letter.component.html b/src/app/letter/letter.component.html
index ecc6a51..9027b4e 100644
--- a/src/app/letter/letter.component.html
+++ b/src/app/letter/letter.component.html
@@ -1 +1 @@
-
{{letter}}
+
{{ getEncodedLetter() }}
diff --git a/src/app/letter/letter.component.ts b/src/app/letter/letter.component.ts
index dea3f1e..3c20e31 100644
--- a/src/app/letter/letter.component.ts
+++ b/src/app/letter/letter.component.ts
@@ -31,4 +31,8 @@ export class LetterComponent {
}
return "";
}
+
+ getEncodedLetter() {
+ return this.letter.replace(' ', '\u00A0');
+ }
}
diff --git a/src/assets/sentences.txt b/src/assets/sentences.txt
deleted file mode 100644
index 3c2bb3d..0000000
--- a/src/assets/sentences.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-It isn't true that my mattress is made of cotton candy.
-Had he known what was going to happen, he would have never stepped into the shower.
-You're good at English when you know the difference between a man eating chicken and a man-eating chicken.
-The tart lemonade quenched her thirst, but not her longing.
-People keep telling me "orange" but I still prefer "pink".
-Her hair was windswept as she rode in the black convertible.
-The water flowing down the river didn’t look that powerful from the car
-Mom didn’t understand why no one else wanted a hot tub full of jello.
-Everybody should read Chaucer to improve their everyday vocabulary.
-It must be five o'clock somewhere.
-He was 100% into fasting with her until he understood that meant he couldn't eat.
-The sunblock was handed to the girl before practice, but the burned skin was proof she did not apply it.
-The estate agent quickly marked out his territory on the dance floor.
-If you like tuna and tomato sauce, try combining the two, it’s really not as bad as it sounds.
-He said he was not there yesterday; however, many people saw him there.
-Normal activities took extraordinary amounts of concentration at the high altitude.
-The snow-covered path was no help in finding his way out of the back-country.
-Instead of a bachelorette party
-She opened up her third bottle of wine of the night.
-I’m a living furnace.
-The spa attendant applied the deep cleaning mask to the gentleman’s back.
-She couldn't understand why nobody else could see that the sky is full of cotton candy.
-Beach-combing replaced wine tasting as his new obsession.
-The teenage boy was accused of breaking his arm simply to get out of the test.
-Thirty years later, she still thought it was okay to put the toilet paper roll under rather than over.
-As the asteroid hurtled toward earth, Becky was upset her dentist appointment had been canceled.
-The old apple revels in its authority.
-Too many prisons have become early coffins.
-Despite what your teacher may have told you, there is a wrong way to wield a lasso.
-Situps are a terrible way to end your day.
-The lyrics of the song sounded like fingernails on a chalkboard.
-Don't put peanut butter on the dog's nose.
-Today we gathered moss for my uncle's wedding.
-She wrote him a long letter, but he didn't read it.
-He didn’t want to go to the dentist, yet he went anyway.
-It was obvious she was hot, sweaty, and tired.
-Smoky the Bear secretly started the fires.
-If you don't like toenails, you probably shouldn't look at your feet.
-His mind was blown that there was nothing in space except space itself.
-The urgent care center was flooded with patients after the news of a new deadly virus was made public.
-The fact that there's a stairway to heaven and a highway to hell explains life well.
-Watching the geriatric men’s softball team brought back memories of 3 yr olds playing t-ball.
-Chocolate covered crickets were his favorite snack.
-Henry couldn't decide if he was an auto mechanic or a priest.
-Various sea birds are elegant, but nothing is as elegant as a gliding pelican.
-The thick foliage and intertwined vines made the hike nearly impossible.
-The bird had a belief that it was really a groundhog.
-She had some amazing news to share but nobody to share it with.
-The light in his life was actually a fire burning all around him.
-Two seats were vacant.