Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
laurielim committed Jul 30, 2023
1 parent f22af82 commit e83a43c
Show file tree
Hide file tree
Showing 26 changed files with 501 additions and 476 deletions.
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"prettier.documentSelectors": [
"**/*.svelte"
],
"prettier.documentSelectors": ["**/*.svelte"],
"tailwindCSS.classAttributes": [
"class",
"accent",
Expand Down Expand Up @@ -108,4 +106,4 @@
"width",
"zIndex"
]
}
}
42 changes: 21 additions & 21 deletions lessons/lesson-1.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"id": 1,
"title": "Lesson 1",
"description": "Use basic phrases, talk about food and drink",
"content": [
{
"type": "match",
"options": {
"man": "misier",
"woman": "madam",
"bread": "dipain",
"girl": "tifi"
}
},
{
"type": "multipleChoice",
"question": "How do you say 'girl'?",
"answer": "tifi",
"options": ["tifi", "diri", "misier"]
}
]
}
"id": 1,
"title": "Lesson 1",
"description": "Use basic phrases, talk about food and drink",
"content": [
{
"type": "match",
"options": {
"man": "misier",
"woman": "madam",
"bread": "dipain",
"girl": "tifi"
}
},
{
"type": "multipleChoice",
"question": "How do you say 'girl'?",
"answer": "tifi",
"options": ["tifi", "diri", "misier"]
}
]
}
38 changes: 19 additions & 19 deletions lessons/lesson-2.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"id": 2,
"title": "Lesson 2",
"description": "Greet people, use affirmative phrases",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "Jean"],
"answer": "apel",
"options": ["dipain", "bwar", "apel"],
"translation": "I'm called Jean"
},
{
"type": "multipleChoice",
"question": "How do you say 'rice'?",
"answer": "diri",
"options": ["tifi", "diri", "misier"]
}
]
}
"id": 2,
"title": "Lesson 2",
"description": "Greet people, use affirmative phrases",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "Jean"],
"answer": "apel",
"options": ["dipain", "bwar", "apel"],
"translation": "I'm called Jean"
},
{
"type": "multipleChoice",
"question": "How do you say 'rice'?",
"answer": "diri",
"options": ["tifi", "diri", "misier"]
}
]
}
38 changes: 19 additions & 19 deletions lessons/lesson-3.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"id": 3,
"title": "Lesson 3",
"description": "Say what you don't do, use articles",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "koné"],
"answer": "pa",
"options": ["pa", "bwar", "delo"],
"translation": "I don't know"
},
{
"type": "translate",
"question": "A boy",
"answer": "Ene garson",
"options": ["tifi", "Ene", "pa", "garson"]
}
]
}
"id": 3,
"title": "Lesson 3",
"description": "Say what you don't do, use articles",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "koné"],
"answer": "pa",
"options": ["pa", "bwar", "delo"],
"translation": "I don't know"
},
{
"type": "translate",
"question": "A boy",
"answer": "Ene garson",
"options": ["tifi", "Ene", "pa", "garson"]
}
]
}
38 changes: 19 additions & 19 deletions lessons/lesson-4.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"id": 4,
"title": "Lesson 4",
"description": "Discuss food and drink, talk about animals",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "delo"],
"answer": "bwar",
"options": ["dipain", "bwar", "apel"],
"translation": "I drink water"
},
{
"type": "multipleChoice",
"question": "How do you say 'rice'?",
"answer": "diri",
"options": ["tifi", "diri", "misier"]
}
]
}
"id": 4,
"title": "Lesson 4",
"description": "Discuss food and drink, talk about animals",
"content": [
{
"type": "fillBlank",
"question": ["Mo", "delo"],
"answer": "bwar",
"options": ["dipain", "bwar", "apel"],
"translation": "I drink water"
},
{
"type": "multipleChoice",
"question": "How do you say 'rice'?",
"answer": "diri",
"options": ["tifi", "diri", "misier"]
}
]
}
2 changes: 1 addition & 1 deletion src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ body {
font-family: 'Quicksand';
src: url('/fonts/Quicksand.ttf');
font-display: swap;
}
}
30 changes: 15 additions & 15 deletions src/lib/components/HeaderLead.svelte
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<script lang="ts">
import { drawerStore } from "@skeletonlabs/skeleton";
import { drawerStore } from '@skeletonlabs/skeleton';
function drawerOpen(): void {
drawerStore.open({
width: 'w-[280px] md:w-[400px]',
function drawerOpen(): void {
drawerStore.open({
width: 'w-[280px] md:w-[400px]'
});
}
</script>

<div class="flex items-center">
<button class="lg:hidden btn btn-sm mr-4" on:click={drawerOpen}>
<span>
<svg viewBox="0 0 100 80" class="fill-token w-4 h-4">
<rect width="100" height="20" />
<rect y="30" width="100" height="20" />
<rect y="60" width="100" height="20" />
</svg>
</span>
</button>
<a href="/"><strong class="text-xl uppercase">Kreolingo</strong></a>
</div>
<button class="lg:hidden btn btn-sm mr-4" on:click={drawerOpen}>
<span>
<svg viewBox="0 0 100 80" class="fill-token w-4 h-4">
<rect width="100" height="20" />
<rect y="30" width="100" height="20" />
<rect y="60" width="100" height="20" />
</svg>
</span>
</button>
<a href="/"><strong class="text-xl uppercase">Kreolingo</strong></a>
</div>
9 changes: 2 additions & 7 deletions src/lib/components/HeaderTrail.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<a
class="btn hover:variant-ringed"
href="/about"
>
About
</a>
<a class="btn hover:variant-ringed" href="/about"> About </a>
<a
class="btn hover:variant-ringed hidden md:block"
href="https://github.com/laurielim/kreolingo"
target="_blank"
rel="noreferrer"
>
Github
</a>
</a>
44 changes: 22 additions & 22 deletions src/lib/components/Navigation.svelte
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<script lang="ts">
import { drawerStore } from "@skeletonlabs/skeleton";
import { drawerStore } from '@skeletonlabs/skeleton';
function drawerClose() {
drawerStore.close();
function drawerClose() {
drawerStore.close();
}
export let lessons: any[];
export let path: string;
$: classesActive = (href: string) => (href === path.replace("/", "") ? 'variant-ghost-primary' : '');
export let lessons: any[];
export let path: string;
$: classesActive = (href: string) =>
href === path.replace('/', '') ? 'variant-ghost-primary' : '';
</script>

<h2 class="p-4 text-xl"><a href="/">Lessons</a></h2>
<hr />
<div class="flex flex-col justify-between min-h-[90%]">
<nav class="list-nav p-4">
<ul>
{#each lessons as lesson}
<li class="my-2 text-lg">
<a
class="{classesActive(lesson.slug)}"
href="{lesson.slug}"
on:click={drawerClose}>
{lesson.title}
</a>
</li>
{/each}
</ul>
</nav>
<p class="ml-4 pb-2">Created by <a class="anchor" href="//laurielim.github.io/">Laurie Lim Sam</a></p>
</div>
<nav class="list-nav p-4">
<ul>
{#each lessons as lesson}
<li class="my-2 text-lg">
<a class={classesActive(lesson.slug)} href={lesson.slug} on:click={drawerClose}>
{lesson.title}
</a>
</li>
{/each}
</ul>
</nav>
<p class="ml-4 pb-2">
Created by <a class="anchor" href="//laurielim.github.io/">Laurie Lim Sam</a>
</p>
</div>
52 changes: 26 additions & 26 deletions src/lib/data/lessons.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import fs from "fs";
import path from "path";
const lessonsDirectory = path.join(process.cwd(), 'lessons')
import fs from 'fs';
import path from 'path';
const lessonsDirectory = path.join(process.cwd(), 'lessons');

export function getAllLessons() {
const fileNames = fs.readdirSync(lessonsDirectory);
const allLessonsData = fileNames.map((fileName: string) => {
// Remove ".json" from file name to get id
const slug = fileName.replace(/\.json$/, '');
const fileNames = fs.readdirSync(lessonsDirectory);
const allLessonsData = fileNames.map((fileName: string) => {
// Remove ".json" from file name to get id
const slug = fileName.replace(/\.json$/, '');

const lesson = getLessonBySlug(slug);
const lesson = getLessonBySlug(slug);

return {
slug,
...lesson,
}
})
return allLessonsData;
return {
slug,
...lesson
};
});
return allLessonsData;
}

export function getLessonBySlug(slug: string) {
// Read file content
const fileName = `${slug}.json`
const fullPath = path.join(lessonsDirectory, fileName)
try {
if (fs.existsSync(fullPath)) {
const fileContents = fs.readFileSync(fullPath, 'utf8')
return JSON.parse(fileContents);
}
} catch(err) {
return null
}
}
// Read file content
const fileName = `${slug}.json`;
const fullPath = path.join(lessonsDirectory, fileName);
try {
if (fs.existsSync(fullPath)) {
const fileContents = fs.readFileSync(fullPath, 'utf8');
return JSON.parse(fileContents);
}
} catch (err) {
return null;
}
}
Loading

0 comments on commit e83a43c

Please sign in to comment.