+ `,
+ styleUrls: [`unknown-person.component.css`],
+})
+export class UnknownPersonComponent {
+ @Input({ required: true }) step!: number;
+}
diff --git a/apps/performance/christmas-web-worker/src/assets/.gitkeep b/apps/performance/christmas-web-worker/src/assets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/apps/performance/christmas-web-worker/src/favicon.ico b/apps/performance/christmas-web-worker/src/favicon.ico
new file mode 100644
index 0000000..317ebcb
Binary files /dev/null and b/apps/performance/christmas-web-worker/src/favicon.ico differ
diff --git a/apps/performance/christmas-web-worker/src/index.html b/apps/performance/christmas-web-worker/src/index.html
new file mode 100644
index 0000000..fc6ebdf
--- /dev/null
+++ b/apps/performance/christmas-web-worker/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ performance-christmas-web-worker
+
+
+
+
+
+
+
+
diff --git a/apps/performance/christmas-web-worker/src/main.ts b/apps/performance/christmas-web-worker/src/main.ts
new file mode 100644
index 0000000..31c5da4
--- /dev/null
+++ b/apps/performance/christmas-web-worker/src/main.ts
@@ -0,0 +1,4 @@
+import { bootstrapApplication } from '@angular/platform-browser';
+import { AppComponent } from './app/app.component';
+
+bootstrapApplication(AppComponent).catch((err) => console.error(err));
diff --git a/apps/performance/christmas-web-worker/src/styles.scss b/apps/performance/christmas-web-worker/src/styles.scss
new file mode 100644
index 0000000..77e408a
--- /dev/null
+++ b/apps/performance/christmas-web-worker/src/styles.scss
@@ -0,0 +1,5 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+/* You can add global styles to this file, and also import other style files */
diff --git a/apps/performance/christmas-web-worker/tailwind.config.js b/apps/performance/christmas-web-worker/tailwind.config.js
new file mode 100644
index 0000000..38183db
--- /dev/null
+++ b/apps/performance/christmas-web-worker/tailwind.config.js
@@ -0,0 +1,14 @@
+const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
+const { join } = require('path');
+
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: [
+ join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'),
+ ...createGlobPatternsForDependencies(__dirname),
+ ],
+ theme: {
+ extend: {},
+ },
+ plugins: [],
+};
diff --git a/apps/performance/christmas-web-worker/tsconfig.app.json b/apps/performance/christmas-web-worker/tsconfig.app.json
new file mode 100644
index 0000000..5822042
--- /dev/null
+++ b/apps/performance/christmas-web-worker/tsconfig.app.json
@@ -0,0 +1,10 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../../dist/out-tsc",
+ "types": []
+ },
+ "files": ["src/main.ts"],
+ "include": ["src/**/*.d.ts"],
+ "exclude": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts"]
+}
diff --git a/apps/performance/christmas-web-worker/tsconfig.editor.json b/apps/performance/christmas-web-worker/tsconfig.editor.json
new file mode 100644
index 0000000..4ee6393
--- /dev/null
+++ b/apps/performance/christmas-web-worker/tsconfig.editor.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src/**/*.ts"],
+ "compilerOptions": {
+ "types": []
+ }
+}
diff --git a/apps/performance/christmas-web-worker/tsconfig.json b/apps/performance/christmas-web-worker/tsconfig.json
new file mode 100644
index 0000000..51c7908
--- /dev/null
+++ b/apps/performance/christmas-web-worker/tsconfig.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ "target": "es2022",
+ "useDefineForClassFields": false,
+ "forceConsistentCasingInFileNames": true,
+ "strict": true,
+ "noImplicitOverride": true,
+ "noPropertyAccessFromIndexSignature": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "files": [],
+ "include": [],
+ "references": [
+ {
+ "path": "./tsconfig.app.json"
+ },
+ {
+ "path": "./tsconfig.editor.json"
+ }
+ ],
+ "extends": "../../../tsconfig.base.json",
+ "angularCompilerOptions": {
+ "enableI18nLegacyMessageIdFormat": false,
+ "strictInjectionParameters": true,
+ "strictInputAccessModifiers": true,
+ "strictTemplates": true
+ }
+}
diff --git a/challenge-number.json b/challenge-number.json
index 6e455d3..cd65533 100644
--- a/challenge-number.json
+++ b/challenge-number.json
@@ -1,6 +1,6 @@
{
- "total": 39,
+ "total": 40,
"🟢": 14,
- "🟠": 118,
+ "🟠": 119,
"🔴": 207
}
diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs
index aac1882..fa9feca 100644
--- a/docs/astro.config.mjs
+++ b/docs/astro.config.mjs
@@ -4,6 +4,7 @@ import { defineConfig } from 'astro/config';
export const locales = {
root: { label: 'English', lang: 'en' },
es: { label: 'Español', lang: 'es' },
+ fr: { label: 'Français', lang: 'fr' },
'pt-br': { label: 'Português (Brasil)', lang: 'pt-BR' },
};
@@ -29,6 +30,7 @@ export default defineConfig({
autogenerate: { directory: 'guides' },
translations: {
es: 'Guías',
+ fr: 'Guides',
'pt-BR': 'Guias',
},
},
@@ -37,6 +39,7 @@ export default defineConfig({
autogenerate: { directory: 'challenges' },
translations: {
es: 'Desafíos',
+ fr: 'Challenges',
'pt-BR': 'Desafios'
},
},
@@ -76,6 +79,10 @@ export default defineConfig({
label: 'Español',
lang: 'es',
},
+ fr: {
+ label: 'Français',
+ lang: 'fr',
+ },
'pt-br': {
label: 'Português (Brasil)',
lang: 'pt-BR',
diff --git a/docs/src/content/docs/challenges/angular/39-injection-token.md b/docs/src/content/docs/challenges/angular/39-injection-token.md
index 5dfdbd8..36aab19 100644
--- a/docs/src/content/docs/challenges/angular/39-injection-token.md
+++ b/docs/src/content/docs/challenges/angular/39-injection-token.md
@@ -6,7 +6,6 @@ challengeNumber: 39
command: angular-injection-token
sidebar:
order: 118
- badge: New
---
## Information
diff --git a/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md b/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md
new file mode 100644
index 0000000..a341d4d
--- /dev/null
+++ b/docs/src/content/docs/challenges/performance/40-christmas-web-worker.md
@@ -0,0 +1,32 @@
+---
+title: 🟠 Web workers
+description: Challenge 40 is about learning how to create and use a web worker
+author: thomas-laforge
+challengeNumber: 40
+command: performance-christmas-web-worker
+sidebar:
+ order: 119
+ badge: New
+---
+
+## Information
+
+This challenge has been created for Angular Advent Calendar 2023.
+
+This application is basic. We click on the **Discover** button to reveal the surprise hidden behind the black screen. However, the current application provides an awful user experience. When we click on the button, the page freezes, and after a while, it reveals the secret all at once without a smooth animation.
+
+> Note: To create the application freeze, the loader is based on a very heavy computation function. We could have used a basic timer, but that's not the point of this challenge.
+
+Since JavaScript is single-threaded, when we perform a heavy task, the browser cannot update the UI or respond to mouse clicks or any events. To free the main thread, the goal is to isolate the heavy computation into a different thread. To do so, we will need to use web workers. Web workers can run any scripts in the background, in isolation from the main thread, allowing the browser to still provide your user with a good experience.
+
+In Angular, this technology is often underused, however, it's straightforward to create one. There is a schematic that you can find here.
+
+## Statement
+
+The goal of this challenge is to create a smooth animation by isolating the heavy computation function into a web worker.
+
+First, create a web worker using the schematics, then move the issuing function. Finally, the animation should be smooth and provide an awesome user experience.
+
+### Note
+
+Since we are inside an Nx workspace, simply replace the `ng` command with `nx` when running the schematic.
diff --git a/docs/src/content/docs/fr/guides/getting-started.md b/docs/src/content/docs/fr/guides/getting-started.md
new file mode 100644
index 0000000..c74353a
--- /dev/null
+++ b/docs/src/content/docs/fr/guides/getting-started.md
@@ -0,0 +1,57 @@
+---
+title: Comment démarrer
+description: Un guide sur la manière de commencer avec sur Angular Challenges.
+sidebar:
+ order: 1
+---
+
+Pour commencer avec les Challenges Angular, suivez ces étapes :
+
+## Créez un compte Github
+
+Si vous souhaitez soumettre une réponse, vous devrez avoir votre propre compte GitHub. De plus, avoir un compte GitHub est toujours bénéfique et c'est gratuit.
+
+## Forkez le projet GitHub
+
+Accédez au [répertoire des Challenges Angular](https://github.com/tomalaforge/angular-challenges) et cliquez sur le bouton Fork dans l'en-tête. Cela créera une copie de ce dépôt sur votre propre page GitHub.
+
+## Clonez le dépôt sur votre machine locale
+
+Sélectionnez un répertoire sur votre ordinateur local et clonez ce dépôt.
+
+Ouvrez un terminal, accédez au répertoire choisi et tapez la commande suivante :
+
+```bash
+git clone https://github.com/[VOTRE_NOM_GITHUB]/angular-challenges.git
+```
+
+:::note
+Vous pouvez trouver l'URL de clonage en cliquant sur le bouton <> Code dans votre propre instance du dépôt des Challenges Angular.
+
+
+
+:::
+
+## Ouvrez le projet dans votre IDE préféré
+
+Ouvrez le projet dans n'importe quel IDE de votre choix.
+
+## Installez toutes les dépendances
+
+```bash
+npm ci
+```
+
+## Choisissez un challenge
+
+Votre projet est maintenant opérationnel. La seule étape restante est de choisir un challenge 🚀
+
+Chaque challenge se compose de :
+
+- Nom : indiquant de quoi traite le défi.
+- Numéro : ordre de création. Le numéro n'a pas de signification particulière mais aide pour la référence dans la section des Demandes de Tirage (Pull Requests) GitHub.
+- Badge : aide à visualiser le degré de difficulté. C'est entièrement subjectif 😅
+ - 🟢 facile
+ - 🟠 moyen
+ - 🔴 difficile
diff --git a/docs/src/content/docs/fr/guides/resolve-challenge.md b/docs/src/content/docs/fr/guides/resolve-challenge.md
new file mode 100644
index 0000000..e16ac5c
--- /dev/null
+++ b/docs/src/content/docs/fr/guides/resolve-challenge.md
@@ -0,0 +1,93 @@
+---
+title: Résoudre un Challenge
+description: Guide pour résoudre un challenge
+sidebar:
+ order: 2
+---
+
+Dans ce guide, vous apprendrez comment résoudre un challenge et soumettre une réponse sur le répertoire principal de Github.
+
+## Introduction
+
+Ce répertoire utilise [Nx](https://nx.dev/getting-started/intro). Nx est un monorépo qui vous permet de stocker plusieurs applications à l'intérieur du même espace de travail. Chaque challenge est une application distincte. Si vous ouvrez le répertoire `apps`, vous trouverez plusieurs dossiers, chacun lié à un challenge spécifique. Chaque dossier représente une application autonome complète `Nx`. Pour exécuter et démarrer l'une d'entre elles, ouvrez votre terminal et exécutez :
+
+```bash
+npx nx serve
+```
+
+:::note
+Si vous n'êtes pas sûr de votre `NOM_APPLICATION`, ouvrez le fichier README.md. La commande `serve` y est écrite, avec un lien vers la documentation du challenge.
+:::
+
+:::note
+Si vous installez `nx` globalement sur votre ordinateur, vous éviterez de préfixer chaque commande par `npx`.
+
+Pour installer `nx` globalement, exécutez
+
+```bash
+npm i -g nx
+```
+
+:::
+
+## Créer une Branche Git
+
+Avant de commencer à résoudre un challenge, créez une branche git pour y ajouter vos modifications.
+
+```bash
+git checkout -b
+```
+
+## Résoudre un Challenge
+
+Suivez les instructions décrites sur chaque Challenge pour le résoudre.
+
+## Commitez et Pousser votre Travail
+
+La dernière étape consiste à valider votre travail en suivant les [Conventional Guidelines](https://www.conventionalcommits.org/en/v1.0.0/).
+
+Enfin, poussez votre travail vers le répertoire distant avec la commande suivante
+
+```bash
+ git push --set-upstream origin
+```
+
+:::tip[Pas besoin de retenir la commande par coeur]
+Vous n'avez pas besoin de mémoriser précisément la commande. Il vous suffit de vous rappeler `git push `et si c'est la première fois que vous poussez cette branche, `git` vous fournira la commande complète.
+:::
+
+## Soumettre votre Travail sur le répertoire Principal
+
+Maintenant, tout votre travail se trouve dans votre instance locale du dépôt de Angular Challenges.
+
+La prochaine étape est de vous rendre sur la page principale de Angular Challenges et de créer une nouvelle Pull Request.
+
+Github devrait afficher en en-tête une notification pour vous aider à créer la pull request.
+
+Si ce n'est pas le cas, vous avez soit mal effectué l'une des étapes précédentes, soit vous pouvez vous rendre sur l'onglet Pull Request et cliquer sur le bouton New pull request.
+
+Une fois que vous avez choisi les deux branches à comparer, vous devriez arriver sur la page suivante :
+
+
+
+Dans la section du titre, commencez par Réponse : suivi de votre numéro de challenge. Ensuite, vous êtes libre d'ajouter tout ce que vous souhaitez.
+
+:::danger
+C'est très important. Cela permet aux autres de savoir quel challenge vous tentez de résoudre.
+:::
+
+Dans la section de description, vous pouvez ajouter des questions, des problèmes rencontrés ou tout autre contenu que vous souhaitez partager. Vous pouvez laisser vide si vous n'avez rien à dire.
+
+Vous pouvez maintenant cliquer sur Créer pull request.
+
+Je la lirai et commenterai quand j'aurai du temps libre.
+
+
Ne vous inquiétez pas si votre réponse n'est pas examinée immédiatement. Je le fais gratuitement et pendant mon temps libre. Si vous souhaitez me soutenir, vous pouvez le faire en me sponsorisant sur github. Cela validera que mon travail vous aide, vous ou votre équipe.
+
+:::note
+Tout le monde peut commenter ou lire les Pull Requests des autres participants.
+:::
+
+:::tip[Champion OSS]
+🔥 Une fois que vous avez terminé ce tutoriel, vous êtes prêt à contribuer à n'importe quel répertoire public Github et à soumettre une PR. C'est aussi simple que ça. 🔥
+:::
diff --git a/docs/src/content/docs/fr/index.mdx b/docs/src/content/docs/fr/index.mdx
new file mode 100644
index 0000000..6907cdc
--- /dev/null
+++ b/docs/src/content/docs/fr/index.mdx
@@ -0,0 +1,78 @@
+---
+title: Bienvenue sur Angular Challenges
+description: Commence par résoudre ces défis et deviens un meilleur ingénieur FrontEnd Angular.
+template: splash
+noCommentSection: true
+banner:
+ content: J'aurai moins de temps libre dans les deux prochains mois, donc ne vous inquiétez pas si vos pull requests prennent du temps à être examinées.
+hero:
+ tagline: Commence maintenant et deviens un expert Angular !
+ image:
+ file: ../../../assets/angular-challenge.webp
+ actions:
+ - text: C'est parti !
+ link: /guides/getting-started/
+ icon: right-arrow
+ variant: primary
+ - text: Aller au dernier Challenge
+ link: /challenges/performance/40-christmas-web-worker/
+ icon: rocket
+ - text: Donne une étoile
+ link: https://github.com/tomalaforge/angular-challenges
+ icon: github
+ variant: secondary
+---
+
+import { Card, CardGrid } from '@astrojs/starlight/components';
+import MyIcon from '../../../components/MyIcon.astro';
+
+
+
+ Ce répertoire rassemble 40 défis liés à Angular, Nx, RxJS, Ngrx et Typescript. Ces défis portent sur des problèmes réels ou des fonctionnalités spécifiques pour améliorer vos compétences.
+
+
+
+ L'un des objectifs de ce répertoire est de rendre plus accessible les
+ contributions aux logiciels Open Source (OSS). En résolvant ces défis, vous
+ apprendrez comment commencer à contribuer à n'importe quel projet Open Source.
+
+
+
+ Apprendre et démarrer sur un nouveau framework est toujours difficile. Cette
+ série de défis propose des cas d'utilisation réels pour appliquer ce que vous
+ avez appris. N'importe qui peut commenter ou aider.{' '}
+
+ Apprendre seul est bien, mais apprendre aux côtés des autres vous fera
+ progresser davantage et plus rapidement.
+
+
+
+
+ Avez-vous un problème, un bug intéressant ou une idée ? N'hésitez pas ;{' '}
+ créez vos propres challenges sans perdre de temps.
+
+
+
+ Résoudre ces challenges vous préparera aux éventuels défis techniques que vous
+ pourriez rencontrer lors d'un entretien pour un rôle d'ingénieur frontend.
+
+
+
+ Ce projet est gratuit et vise à le rester le plus longtemps possible. Cependant, tout est réalisé pendant mon temps libre, y compris la création de challenges et la relecture des pull requests. Le sponsoring peut me soutenir et contribuer à la croissance du projet.
+
+
+
+---
+
+
+
+
diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx
index 3c7eabf..8cc1ae6 100644
--- a/docs/src/content/docs/index.mdx
+++ b/docs/src/content/docs/index.mdx
@@ -15,7 +15,7 @@ hero:
icon: right-arrow
variant: primary
- text: Go to the latest Challenge
- link: /challenges/angular/39-injection-token/
+ link: /challenges/performance/40-christmas-web-worker/
icon: rocket
- text: Give a star
link: https://github.com/tomalaforge/angular-challenges
@@ -27,8 +27,8 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
import MyIcon from '../../components/MyIcon.astro';
-
- This repository gathers 39 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript.
+
+ This repository gathers 40 Challenges related to Angular, Nx, RxJS, Ngrx and Typescript.
These challenges resolve around real-life issues or specific features to elevate your skills.