Skip to content

Commit d6220ac

Browse files
committed
add language settings and update web
1 parent b86d266 commit d6220ac

51 files changed

Lines changed: 1816 additions & 1046 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@learningmap/learningmap": minor
3+
---
4+
5+
Add "Auto" language detection and improve i18n system
6+
7+
- Add "Auto" option to language dropdown that automatically detects browser language
8+
- Add `getLanguage()` and `getTranslations()` methods to editor store for easier access
9+
- Change default language from "en" to "auto" for better user experience
10+
- Improve language selection logic: settings.language → defaultLanguage → browser detection
11+
- Simplify translation access throughout components via store methods
12+
- Better support for international users with automatic language detection
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"web": minor
3+
---
4+
5+
Add role-based dashboards for teachers and students
6+
7+
- Add `/teach` route with teacher dashboard for managing created learning maps
8+
- Add `/learn` route improvements with student-focused progress tracking
9+
- Add TeacherEditor wrapper that automatically saves shared maps to teacher collection
10+
- Add IndexedDB `teacherMaps` store for managing teacher's map collection
11+
- Update landing page with clear role-based entry points ("I'm a Teacher" / "I'm a Student")
12+
- Add consistent header navigation across all views with full-width layout
13+
- Add clickable logo/title throughout app to return to homepage
14+
- Teachers can now easily share maps with students via copy link functionality
15+
- Students can track their progress across all their learning maps

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ explore learning pathways. It is developed by
1212
## Platforms
1313

1414
- **Web App**: Create and share learningmaps at [learningmap.app](https://learningmap.app)
15+
- **For Teachers**: Create, manage, and share learning maps with students
16+
- **For Students**: Access shared maps, track progress, and learn at your own pace
1517
- **VS Code Extension**: Edit `.learningmap` files locally in VS Code (see [platforms/vscode](platforms/vscode))
1618
- **React Component**: Integrate learningmap into your own React app (see [packages/learningmap](packages/learningmap))
1719
- **Web Component**: Use learningmap in any web application (see [packages/web-component](packages/web-component))

docs/book/changelog.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,27 @@ If you need a new feature, open an [issue](https://github.com/openpatch/learning
1313

1414
:::
1515

16+
## v0.5.0
17+
18+
::::tabs
19+
20+
:::tab{title="New :rocket:" id="new"}
21+
22+
- Add "Auto" language detection option in settings
23+
- Add `getLanguage()` and `getTranslations()` methods to editor store
24+
25+
:::
26+
27+
:::tab{title="Improved :+1:" id="improved"}
28+
29+
- Default language is now "auto" which detects browser language automatically
30+
- Better internationalization support with improved language selection logic
31+
- Simplified translation access throughout components via store methods
32+
33+
:::
34+
35+
::::
36+
1637
## v0.3.1
1738

1839
::::tabs

docs/book/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ This is work in progress! If you have any questions, please open an issue or rea
1111

1212
Go to [learningmap.app](https://learningmap.app) to create your own learning maps!
1313

14+
## For Teachers & Students
15+
16+
The web platform at [learningmap.app](https://learningmap.app) is designed for two primary audiences:
17+
18+
- **Teachers**: Create and manage learning maps, share them with students via shareable links
19+
- **Students**: Access shared learning maps, track progress, and work through topics at their own pace
20+
21+
Both teacher and student data is stored locally in your browser using IndexedDB, ensuring privacy and offline access.
22+
1423
## How are these docs structured?
1524

1625
These docs are focused on developers, and structured the following way:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"preinstall": "npx only-allow pnpm",
88
"prepare": "husky",
9-
"dev": "node scripts/watcher.mjs",
9+
"dev": "pnpm --parallel -r dev",
1010
"build": "pnpm -r build",
1111
"test": "CI=true pnpm -r test",
1212
"lint": "pnpm -r lint",

packages/learningmap/index.html

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

packages/learningmap/map.html

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

packages/learningmap/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,25 @@
3030
"lint": "tsc --noEmit",
3131
"build": "rimraf dist && pnpm build:pkg && pnpm build:types",
3232
"build:pkg": "node ../../scripts/build.mjs",
33-
"build:types": "tsc --project tsconfig.build.json --declaration --emitDeclarationOnly"
33+
"build:types": "tsc --project tsconfig.build.json --declaration --emitDeclarationOnly",
34+
"dev": "node ../../scripts/dev.mjs"
3435
},
3536
"dependencies": {
36-
"@szhsin/react-menu": "^4.5.0",
37+
"@szhsin/react-menu": "^4.5.1",
3738
"@types/dompurify": "^3.2.0",
38-
"@xyflow/react": "^12.8.6",
39-
"dompurify": "^3.3.0",
39+
"@xyflow/react": "^12.10.0",
40+
"dompurify": "^3.3.1",
4041
"elkjs": "^0.11.0",
4142
"fast-deep-equal": "^3.1.3",
4243
"html-to-image": "1.11.13",
43-
"lucide-react": "^0.545.0",
44-
"marked": "^16.4.1",
45-
"react": "^19.2.0",
46-
"react-dom": "^19.2.0",
44+
"lucide-react": "^0.562.0",
45+
"marked": "^17.0.1",
46+
"react": "^19.2.3",
47+
"react-dom": "^19.2.3",
4748
"throttle-debounce": "^5.0.2",
4849
"tslib": "^2.8.1",
4950
"zundo": "^2.3.0",
50-
"zustand": "^5.0.8"
51+
"zustand": "^5.0.10"
5152
},
5253
"devDependencies": {
5354
"@types/react": "^19.2.2",

packages/learningmap/src/Drawer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NodeData, Resource } from "./types";
33
import { X, Lock, CheckCircle } from "lucide-react";
44
import { Video } from "./Video";
55
import StarCircle from "./icons/StarCircle";
6-
import { getTranslations } from "./translations";
6+
import { useViewerStore } from "./viewerStore";
77
import { marked } from "marked";
88
import { useMemo } from "react";
99
import DOMPurify from "dompurify";
@@ -15,7 +15,6 @@ interface DrawerProps {
1515
node: Node<NodeData>;
1616
nodes: Node<NodeData>[];
1717
onNodeClick: (_: any, node: Node<NodeData>, focus: boolean) => void;
18-
language?: string;
1918
}
2019

2120
function getUnlockConditions(node: Node<NodeData>, nodes: Node<NodeData>[]): Node<NodeData>[] {
@@ -74,8 +73,9 @@ function getCompletionOptional(node: Node<NodeData>, nodes: Node<NodeData>[]): N
7473
return unmetOptional;
7574
}
7675

77-
export function Drawer({ open, onClose, onUpdate, node, nodes, onNodeClick, language = "en" }: DrawerProps) {
78-
const t = getTranslations(language);
76+
export function Drawer({ open, onClose, onUpdate, node, nodes, onNodeClick }: DrawerProps) {
77+
const getTranslationsFromStore = useViewerStore(state => state.getTranslations);
78+
const t = getTranslationsFromStore();
7979

8080
// Parse markdown description and sanitize HTML
8181
const descriptionHtml = useMemo(() => {

0 commit comments

Comments
 (0)