Skip to content

Commit e2909e0

Browse files
committed
Rewrite UI to make it responsive and close to original FCC
Includes: - update frontend deps - move from Tailwind to Vuetify
1 parent 37052f4 commit e2909e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2749
-1881
lines changed

.gitignore

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,python,database,visualstudiocode,intellij
2-
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,python,database,visualstudiocode,intellij
1+
# Created by https://www.toptal.com/developers/gitignore/api/linux,macos,python,database,intellij
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,macos,python,database,intellij
33

44
### Database ###
55
*.accdb
@@ -344,14 +344,6 @@ poetry.toml
344344
# LSP config files
345345
pyrightconfig.json
346346

347-
### VisualStudioCode ###
348-
.vscode/*
349-
!.vscode/settings.json
350-
!.vscode/tasks.json
351-
!.vscode/launch.json
352-
!.vscode/extensions.json
353-
!.vscode/*.code-snippets
354-
355347
# Local History for Visual Studio Code
356348
.history/
357349

@@ -363,7 +355,7 @@ pyrightconfig.json
363355
.history
364356
.ionide
365357

366-
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,python,database,visualstudiocode,intellij
358+
# End of https://www.toptal.com/developers/gitignore/api/linux,macos,python,database,intellij
367359

368360
# local dirs used for working files
369361
tmp
@@ -377,3 +369,4 @@ output
377369
zimui/public/content
378370
zimui/public/mathjax
379371
scraper/src/fcc2zim/mathjax
372+
scraper/src/fcc2zim/fonts

.vscode/extensions.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Make the UI responsive (#22)
13+
- Enhance the UI design to be closer to original FCC UI (#23)
14+
1015
## [1.3.0] - 2025-01-24
1116

1217
### Changed

scraper/openzim.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,15 @@ source="https://github.com/mathjax/MathJax/archive/refs/tags/3.2.2.zip"
77
zip_paths=["MathJax-3.2.2"]
88
target_paths=["mathjax"]
99
remove = ["mathjax/.github","mathjax/.gitignore","mathjax/.travis.yml","mathjax/bower.json","mathjax/composer.json","mathjax/CONTRIBUTING.md","mathjax/package.json"]
10+
11+
[files.assets.actions."lato"]
12+
action="extract_items"
13+
source="https://dev.kiwix.org/fonts/lato2/lato.zip"
14+
zip_paths=["lato"]
15+
target_paths=["fonts/lato"]
16+
17+
[files.assets.actions."hack"]
18+
action="extract_items"
19+
source="https://dev.kiwix.org/fonts/Hack-ZeroSlash/Hack-ZeroSlash.zip"
20+
zip_paths=["Hack-ZeroSlash"]
21+
target_paths=["fonts/Hack-ZeroSlash"]

scraper/src/fcc2zim/build.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,8 @@ def build_curriculum_redirects(curriculum_dist: Path):
2828
superblock_dict = json.load(course_index_str)
2929

3030
redirects: list[CurriculumRedirect] = []
31-
for superblock in superblock_dict:
32-
course_list = superblock_dict[superblock]
33-
for course in course_list:
34-
meta_json_path = Path(
35-
curriculum_dist,
36-
"curriculum",
37-
superblock,
38-
course,
39-
"_meta.json",
40-
)
41-
challenges = json.loads(meta_json_path.read_text())["challenges"]
31+
for superblock, course_data in superblock_dict.items():
32+
for course, challenges in course_data.items():
4233
for challenge in challenges:
4334
title = challenge["title"]
4435
redirects.append(
@@ -57,6 +48,7 @@ def build_command(
5748
):
5849
logger.info("Scraper: build phase starting")
5950

51+
# Add Mathjax files
6052
mathjax = (Path(__file__) / "../mathjax").resolve()
6153
count_mathjax_files = len(list(mathjax.rglob("*")))
6254
logger.info(f"Adding {count_mathjax_files} MathJax files in {mathjax}")
@@ -71,6 +63,21 @@ def build_command(
7163
is_front=False,
7264
)
7365

66+
# Add fonts files
67+
fonts = (Path(__file__) / "../fonts").resolve()
68+
count_fonts_files = len(list(fonts.rglob("*")))
69+
logger.info(f"Adding {count_fonts_files} fonts files in {fonts}")
70+
for file in fonts.rglob("*"):
71+
if not file.is_file():
72+
continue
73+
path = Path("content") / Path(file).relative_to(fonts.parent)
74+
logger.debug(f"Adding {path} to ZIM")
75+
creator.add_item_for(
76+
path=str(path),
77+
fpath=file,
78+
is_front=False,
79+
)
80+
7481
# Add zimui files
7582
for file in zimui_dist.rglob("*"):
7683
if file.is_dir():

scraper/src/fcc2zim/prebuild.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ def get_challenges_for_lang(tmp_path: Path, language: str):
1212
return Path(tmp_path, language).rglob("*.md")
1313

1414

15-
def update_index(path: Path, superblock: str, slug: str):
15+
def update_index(
16+
path: Path, superblock: str, slug: str, challenges: list[dict[str, str]]
17+
):
1618
index_path = path.joinpath("index.json")
1719
if not index_path.exists():
1820
index_path.write_bytes(json.dumps({}).encode("utf-8"))
1921

2022
index = json.loads(index_path.read_text())
2123
if superblock not in index:
22-
index[superblock] = []
24+
index[superblock] = {}
2325
if slug not in index[superblock]:
24-
index[superblock].append(slug)
26+
index[superblock][slug] = challenges
2527

2628
with open(index_path, "w") as outfile:
2729
json.dump(index, outfile, indent=4)
@@ -51,25 +53,19 @@ def write_course_to_path(
5153
us to render a page listing all available courses
5254
"""
5355
curriculumdir.mkdir(parents=True, exist_ok=True)
54-
meta: dict[str, list[dict[str, str]]] = {"challenges": []}
56+
challenges: list[dict[str, str]] = []
57+
# meta: dict[str, list[dict[str, str]]] = {"challenges": []}
5558

5659
for challenge in challenge_list:
5760
challenge_dest_path = curriculumdir.joinpath(
5861
challenge.course_superblock, challenge.course_slug
5962
)
6063
challenge_dest_path.mkdir(parents=True, exist_ok=True)
6164
shutil.copy2(challenge.path, challenge_dest_path.joinpath(challenge.path.name))
62-
meta["challenges"].append(
63-
{"title": challenge.title(), "slug": challenge.path.stem}
64-
)
65-
66-
meta_path = curriculumdir.joinpath(superblock, course_slug, "_meta.json")
67-
meta_path.parent.mkdir(parents=True, exist_ok=True)
68-
with open(meta_path, "w") as outfile:
69-
json.dump(meta, outfile, indent=4)
65+
challenges.append({"title": challenge.title(), "slug": challenge.path.stem})
7066

7167
# Create an index with a list of the courses
72-
update_index(curriculumdir, superblock, course_slug)
68+
update_index(curriculumdir, superblock, course_slug, challenges)
7369

7470

7571
def prebuild_command(
@@ -83,9 +79,7 @@ def prebuild_command(
8379
8480
This gives following files:
8581
- <curriculum_dist>/index.json
86-
=> { 'superblock': ['basic-javascript'] }
87-
- <curriculum_dist>/<superblock>/<course_slug>/_meta.json
88-
=> { challenges: [{slug, title}] }
82+
=> { 'superblock': {'course_slug': [ {challenge_slug, challenge_title} ] } }
8983
- <curriculum_dist>/<superblock>/<course_slug>/{slug}.md
9084
"""
9185
logger.info("Scraper: prebuild phase starting")

zimui/eslint.config.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

zimui/eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// eslint.config.mjs
2+
import pluginVue from 'eslint-plugin-vue'
3+
import {
4+
defineConfigWithVueTs,
5+
vueTsConfigs,
6+
configureVueProject
7+
} from '@vue/eslint-config-typescript'
8+
9+
configureVueProject({
10+
tsSyntaxInTemplates: true,
11+
scriptLangs: ['ts']
12+
})
13+
14+
export default defineConfigWithVueTs(
15+
pluginVue.configs['flat/essential'],
16+
vueTsConfigs.recommendedTypeChecked,
17+
{
18+
ignores: ['**/*.js']
19+
}
20+
)

zimui/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,40 @@
1919
"@freecodecamp/curriculum-helpers": "^3.8.0",
2020
"chai": "^5.1.2",
2121
"codemirror": "^6.0.1",
22-
"pinia": "^2.3.0",
22+
"pinia": "^3.0.1",
2323
"resize-observer-polyfill": "^1.5.1",
24+
"splitpanes": "^3.2.0",
2425
"vue": "^3.5.13",
2526
"vue-codemirror": "^6.1.1",
26-
"vue-router": "4.5.0"
27+
"vue-router": "4.5.0",
28+
"vuetify": "^3.7.15"
2729
},
2830
"devDependencies": {
29-
"@pinia/testing": "^0.1.7",
31+
"@pinia/testing": "^1.0.0",
3032
"@tsconfig/node22": "^22.0.0",
3133
"@types/assert": "^1.5.11",
32-
"@types/chai": "^5.0.1",
34+
"@types/chai": "^5.2.0",
3335
"@types/glob": "^8.1.0",
3436
"@types/jsdom": "^21.1.7",
3537
"@types/marked": "^6.0.0",
36-
"@types/node": "^22.9.3",
38+
"@types/node": "^22.13.9",
39+
"@types/splitpanes": "^2.2.6",
3740
"@vitejs/plugin-legacy": "^6.0.0",
3841
"@vitejs/plugin-vue": "^5.2.1",
39-
"@vitest/eslint-plugin": "1.1.10",
42+
"@vitest/eslint-plugin": "1.1.36",
4043
"@vue/eslint-config-prettier": "^10.1.0",
41-
"@vue/eslint-config-typescript": "^14.1.4",
44+
"@vue/eslint-config-typescript": "^14.5.0",
4245
"@vue/test-utils": "^2.4.6",
4346
"@vue/tsconfig": "^0.7.0",
44-
"autoprefixer": "^10.4.20",
4547
"eslint": "^9.18.0",
4648
"eslint-plugin-cypress": "^4.1.0",
47-
"eslint-plugin-vue": "^9.32.0",
49+
"eslint-plugin-vue": "^10.0.0",
4850
"glob": "^11.0.1",
49-
"jsdom": "^25.0.1",
51+
"jsdom": "^26.0.0",
5052
"marked": "^15.0.6",
5153
"npm-run-all2": "^7.0.1",
52-
"postcss": "^8.5.1",
5354
"prettier": "^3.4.2",
5455
"start-server-and-test": "^2.0.9",
55-
"tailwindcss": "^3.4.17",
5656
"terser": "^5.37.0",
5757
"ts-node": "^10.9.2",
5858
"typescript": "^5.7.3",

zimui/postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)