Skip to content

Commit f986065

Browse files
committed
use sans-serif and fix saving in vs code
1 parent de88148 commit f986065

9 files changed

Lines changed: 98 additions & 87 deletions

File tree

.changeset/twenty-hairs-occur.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@learningmap/learningmap": minor
3+
"learningmap-studio": minor
4+
"web": minor
5+
"@learningmap/web-component": minor
6+
---
7+
8+
Use sans-serif instead of an unreadable custom font

packages/learningmap/src/index.css

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,15 @@
2222
--learningmap-color-white: #ffffff;
2323
}
2424

25-
/* latin-ext */
26-
@font-face {
27-
font-family: 'Concert One';
28-
font-style: normal;
29-
font-weight: 400;
30-
font-display: swap;
31-
src: url(./fonts/concert_one_latin_ext.woff2) format('woff2');
32-
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
33-
}
34-
35-
/* latin */
36-
@font-face {
37-
font-family: 'Concert One';
38-
font-style: normal;
39-
font-weight: 400;
40-
font-display: swap;
41-
src: url(./fonts/concert_one_latin.woff2) format('woff2');
42-
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
43-
}
44-
4525
/* Container */
4626
.hyperbook-learningmap-container {
4727
width: 100%;
4828
height: 100%;
4929
display: flex;
5030
flex-direction: column;
31+
color: #000;
5132
overflow: hidden;
52-
font-family: "Concert One", sans-serif;
53-
54-
button {
55-
font-family: "Concert One", sans-serif;
56-
}
33+
font-family: sans-serif;
5734
}
5835

5936
/* Toolbar */
@@ -234,12 +211,9 @@ header.drawer-header {
234211
padding: 24px;
235212
}
236213

237-
.drawer-resources ul {
238-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
239-
}
214+
.drawer-resources ul {}
240215

241216
.drawer-description {
242-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
243217
line-height: 1.6;
244218
}
245219

platforms/vscode/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
"displayName": "Learningmap Editor",
3737
"selector": [
3838
{
39-
"filenamePattern": "*.learningmap"
39+
"filenamePattern": "*.learningmap",
40+
"scheme": "file"
41+
},
42+
{
43+
"filenamePattern": "*.learningmap",
44+
"scheme": "untitled"
4045
}
4146
],
4247
"priority": "default"

platforms/vscode/src/LearningmapEditorProvider.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ export class LearningmapEditorProvider implements vscode.CustomTextEditorProvide
104104
// Listen for messages from the webview
105105
webviewPanel.webview.onDidReceiveMessage(async e => {
106106
switch (e.type) {
107+
case 'change':
108+
// Content changed in the webview - update the document to mark it as dirty
109+
// Set flag to prevent circular updates
110+
isUpdatingFromDocument = true;
111+
await this.saveDocument(document, e.content);
112+
// Reset flag after a delay
113+
setTimeout(() => {
114+
isUpdatingFromDocument = false;
115+
}, 200);
116+
return;
107117
case 'save':
108118
if (!isUpdatingFromDocument) {
109119
await this.saveDocument(document, e.content);

platforms/vscode/src/webview.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,40 @@ interface VSCodeMessage {
2727
function WebviewEditor() {
2828
const [isReady, setIsReady] = useState(false);
2929
const isLoadingFromFile = useRef(false);
30+
const changeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
3031

3132
// Get store methods
3233
const getRoadmapData = useEditorStore(state => state.getRoadmapData);
3334
const loadRoadmapData = useEditorStore(state => state.loadRoadmapData);
35+
36+
// Subscribe to store changes to notify VS Code of unsaved changes (debounced)
37+
useEffect(() => {
38+
const unsubscribe = useEditorStore.subscribe(() => {
39+
// Don't notify during initial load
40+
if (!isLoadingFromFile.current && isReady) {
41+
// Clear previous timeout
42+
if (changeTimeoutRef.current) {
43+
clearTimeout(changeTimeoutRef.current);
44+
}
45+
46+
// Debounce change notifications to avoid rapid updates during dragging
47+
changeTimeoutRef.current = setTimeout(() => {
48+
const data = getRoadmapData();
49+
vscode.postMessage({
50+
type: 'change',
51+
content: data,
52+
});
53+
}, 500); // Wait 500ms after last change before notifying
54+
}
55+
});
56+
57+
return () => {
58+
unsubscribe();
59+
if (changeTimeoutRef.current) {
60+
clearTimeout(changeTimeoutRef.current);
61+
}
62+
};
63+
}, [getRoadmapData, isReady]);
3464

3565
// Handle explicit save command
3666
const handleSave = () => {
-23.6 KB
Binary file not shown.

platforms/web/src/Landing.css

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
/* Import Concert One font */
2-
@font-face {
3-
font-family: 'Concert One';
4-
font-style: normal;
5-
font-weight: 400;
6-
font-display: swap;
7-
src: url(/concert_one_latin.woff2) format('woff2');
8-
}
9-
101
body {
11-
font-family: "Concert One", sans-serif;
2+
font-family: sans-serif;
123
}
134

145
.landing-container {
156
min-height: 100vh;
167
display: flex;
178
flex-direction: column;
189
background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
10+
font-family: sans-serif;
1911
}
2012

2113
/* Header */

platforms/web/src/Learn.css

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
height: 100vh;
44
display: flex;
55
flex-direction: column;
6-
font-family: "Concert One", sans-serif;
6+
font-family: sans-serif;
77
}
88

99
/* Toolbar matching EditorToolbar design */
@@ -55,7 +55,6 @@
5555
align-items: center;
5656
gap: 6px;
5757
transition: all 0.2s;
58-
font-family: "Concert One", sans-serif;
5958
}
6059

6160
.toolbar-button:hover {
@@ -71,7 +70,6 @@
7170
justify-content: center;
7271
height: 100vh;
7372
gap: 1rem;
74-
font-family: "Concert One", sans-serif;
7573
}
7674

7775
.learn-spinner {
@@ -106,7 +104,6 @@
106104
border-radius: 4px;
107105
cursor: pointer;
108106
font-size: 1rem;
109-
font-family: "Concert One", sans-serif;
110107
}
111108

112109
.learn-error button:hover {
@@ -119,7 +116,6 @@
119116
min-height: 100vh;
120117
display: flex;
121118
flex-direction: column;
122-
font-family: "Concert One", sans-serif;
123119
}
124120

125121
.learn-list-content {
@@ -156,7 +152,6 @@
156152
border: 1px solid #dee2e6;
157153
border-radius: 4px;
158154
font-size: 1rem;
159-
font-family: "Concert One", sans-serif;
160155
}
161156

162157
.add-map-form button {
@@ -169,7 +164,6 @@
169164
font-size: 1rem;
170165
font-weight: 400;
171166
transition: background 0.2s;
172-
font-family: "Concert One", sans-serif;
173167
}
174168

175169
.add-map-form button:hover {
@@ -217,7 +211,6 @@
217211
font-size: 1rem;
218212
font-weight: 400;
219213
transition: all 0.2s;
220-
font-family: "Concert One", sans-serif;
221214
display: inline-block;
222215
}
223216

@@ -293,7 +286,6 @@
293286
justify-content: center;
294287
border-radius: 4px;
295288
transition: all 0.2s;
296-
font-family: "Concert One", sans-serif;
297289
}
298290

299291
.remove-button:hover {
@@ -351,7 +343,6 @@
351343
font-size: 1rem;
352344
font-weight: 400;
353345
transition: background 0.2s;
354-
font-family: "Concert One", sans-serif;
355346
}
356347

357348
.continue-button:hover {

platforms/web/vite.config.ts

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,62 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react'
3-
import { VitePWA } from 'vite-plugin-pwa'
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react";
3+
import { VitePWA } from "vite-plugin-pwa";
44

55
// https://vite.dev/config/
66
export default defineConfig({
77
plugins: [
88
react(),
99
VitePWA({
10-
registerType: 'prompt',
11-
includeAssets: ['logo.svg', 'concert_one_latin.woff2'],
10+
registerType: "prompt",
11+
includeAssets: ["logo.svg"],
1212
manifest: {
13-
name: 'Learningmap - Interactive Visual Maps for Teaching and Learning',
14-
short_name: 'Learningmap',
15-
description: 'Create, share, and explore interactive visual learning maps. Perfect for teachers and students. All data stored locally in your browser for privacy and offline access.',
16-
theme_color: '#ffffff',
17-
background_color: '#ffffff',
18-
display: 'standalone',
19-
scope: '/',
20-
start_url: '/',
13+
name: "Learningmap - Interactive Visual Maps for Teaching and Learning",
14+
short_name: "Learningmap",
15+
description:
16+
"Create, share, and explore interactive visual learning maps. Perfect for teachers and students. All data stored locally in your browser for privacy and offline access.",
17+
theme_color: "#ffffff",
18+
background_color: "#ffffff",
19+
display: "standalone",
20+
scope: "/",
21+
start_url: "/",
2122
icons: [
2223
{
23-
src: 'pwa-192x192.png',
24-
sizes: '192x192',
25-
type: 'image/png'
24+
src: "pwa-192x192.png",
25+
sizes: "192x192",
26+
type: "image/png",
2627
},
2728
{
28-
src: 'pwa-512x512.png',
29-
sizes: '512x512',
30-
type: 'image/png'
29+
src: "pwa-512x512.png",
30+
sizes: "512x512",
31+
type: "image/png",
3132
},
3233
{
33-
src: 'pwa-512x512.png',
34-
sizes: '512x512',
35-
type: 'image/png',
36-
purpose: 'any maskable'
37-
}
38-
]
34+
src: "pwa-512x512.png",
35+
sizes: "512x512",
36+
type: "image/png",
37+
purpose: "any maskable",
38+
},
39+
],
3940
},
4041
workbox: {
41-
globPatterns: ['**/*.{js,css,html,svg,png,woff2,json}'],
42+
globPatterns: ["**/*.{js,css,html,svg,png,woff2,json}"],
4243
runtimeCaching: [
4344
{
4445
urlPattern: /^https:\/\/json\.openpatch\.org\/.*/i,
45-
handler: 'NetworkFirst',
46+
handler: "NetworkFirst",
4647
options: {
47-
cacheName: 'json-api-cache',
48+
cacheName: "json-api-cache",
4849
expiration: {
4950
maxEntries: 50,
50-
maxAgeSeconds: 60 * 60 * 24 * 7 // 1 week
51+
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
5152
},
5253
cacheableResponse: {
53-
statuses: [0, 200]
54-
}
55-
}
56-
}
57-
]
58-
}
59-
})
54+
statuses: [0, 200],
55+
},
56+
},
57+
},
58+
],
59+
},
60+
}),
6061
],
61-
})
62+
});

0 commit comments

Comments
 (0)