Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/src/i18n/de.strings
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
/* Lernbereich (Lektionen gibt es vorerst nur auf Deutsch) */
"web_learn_title" = "Lernen";
"web_learn_toggle_title" = "Lektionen, Aufgaben und Nachschlagen ein- oder ausblenden";
"web_learn_hide" = "Lernbereich einklappen";
"web_learn_show" = "Lernbereich aufklappen: Lektionen, Aufgaben und Nachschlagen";
"web_learn_lessons" = "Lektionen";
"web_learn_tasks" = "Aufgaben";
"web_learn_reference" = "Nachschlagen";
Expand Down
2 changes: 2 additions & 0 deletions web/src/i18n/en.strings
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
/* Learning area (lessons are German only for now) */
"web_learn_title" = "Learn";
"web_learn_toggle_title" = "Show or hide lessons, exercises and reference";
"web_learn_hide" = "Collapse the learning area";
"web_learn_show" = "Expand the learning area: lessons, exercises and reference";
"web_learn_lessons" = "Lessons";
"web_learn_tasks" = "Exercises";
"web_learn_reference" = "Reference";
Expand Down
2 changes: 2 additions & 0 deletions web/src/i18n/pt-PT.strings
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"web_run_dropped_fmt" = "… %d linhas anteriores ocultas";
"web_learn_title" = "Aprender";
"web_learn_toggle_title" = "Mostrar ou ocultar lições, exercícios e consulta";
"web_learn_hide" = "Recolher a área de aprendizagem";
"web_learn_show" = "Expandir a área de aprendizagem: lições, exercícios e consulta";
"web_learn_lessons" = "Lições";
"web_learn_tasks" = "Exercícios";
"web_learn_reference" = "Consulta";
Expand Down
34 changes: 29 additions & 5 deletions web/src/ui/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { createCanvasMeasure } from '../core/textMeasurement'
import { decodeDocument, encodeDocument } from '../core/xmlCodec'
import { DiagramRenderer, displayElement, el, flattenNodes, samePath } from './renderer'
import { CodePanel } from './codePanel'
import { LearnPanel, type LearnHost } from './learnPanel'
import { LearnPanel, sidebarIcon, type LearnHost } from './learnPanel'
import type { Exercise } from '../learn/lessonFormat'
import { progress } from '../learn/progress'
import { currentLanguage, offeredLanguages, setLanguage, t, type LanguageCode } from './i18n'
Expand Down Expand Up @@ -220,6 +220,7 @@ export class App {
private shell: HTMLElement
private learning = false
private learnButton?: HTMLButtonElement
private railButton?: HTMLButtonElement
private exerciseSaveTimer?: number
private resizeObserver?: ResizeObserver
private renderedHostSize = { width: -1, height: -1 }
Expand Down Expand Up @@ -259,11 +260,18 @@ export class App {
this.shell = document.createElement('div')
this.shell.className = 'shell'
root.replaceWith(this.shell)
this.shell.append(this.learn.element, this.learnResizer(), root)
this.shell.append(this.learnRail(), this.learn.element, this.learnResizer(), root)
const learnOpen = storedValue(learnKey)
// Link „Zu den Lektionen“ der Webseite: …/app/?learn
const fromSite = new URLSearchParams(location.search).has('learn')
this.setLearning(fromSite || (learnOpen === null ? window.innerWidth > 1100 : learnOpen === '1'), false)
// Link „Zu den Lektionen“ der Webseite: …/app/?learn. Danach aus der Adresse nehmen,
// sonst öffnet jedes Neuladen den Lernbereich wieder, obwohl man ihn eingeklappt hat.
const params = new URLSearchParams(location.search)
const fromSite = params.has('learn')
if (fromSite) {
params.delete('learn')
const query = params.toString()
history.replaceState(history.state, '', `${location.pathname}${query ? `?${query}` : ''}${location.hash}`)
}
this.setLearning(fromSite || (learnOpen === null ? window.innerWidth > 1100 : learnOpen === '1'), fromSite)
const z = Number(storedValue(zoomKey))
if (zoomSteps.some((s) => s.value === z)) this.zoom = z
this.buildUI()
Expand Down Expand Up @@ -461,6 +469,7 @@ export class App {
this.buildUI()
this.render()
this.learn.render()
this.labelLearnRail()
}

// MARK: - Lernbereich
Expand All @@ -473,8 +482,23 @@ export class App {
if (this.canvasHost) this.renderDiagramOnly()
}

/** Schmale Leiste am Rand, solange der Lernbereich eingeklappt ist. */
private learnRail(): HTMLElement {
this.railButton = h('button', { class: 'learn-rail' }) as HTMLButtonElement
this.labelLearnRail()
this.railButton.addEventListener('click', () => this.setLearning(true))
return this.railButton
}

private labelLearnRail() {
if (!this.railButton) return
this.railButton.title = t('web_learn_show')
this.railButton.innerHTML = `${sidebarIcon}<span>🎓 ${e(t('web_learn_title'))}</span>`
}

private learnHost(): LearnHost {
return {
collapse: () => this.setLearning(false),
openExercise: (ex: Exercise, doc: VSDocument) => {
const existing = this.tabs.findIndex((tab) => tab.exerciseId === ex.id)
if (existing >= 0) {
Expand Down
11 changes: 10 additions & 1 deletion web/src/ui/learnPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ export interface LearnHost {
/** Reiter einer Übung auf den Startzustand setzen (falls offen). */
resetExercise(id: string, doc: VSDocument): void
preview(doc: VSDocument): SVGSVGElement | undefined
/** Lernbereich zur schmalen Leiste einklappen. */
collapse(): void
}

/** Seitenleisten-Symbol wie in Finder, Mail und Safari (kein ✕: Einklappen ist kein Schließen). */
export const sidebarIcon =
'<svg viewBox="0 0 20 16" width="18" height="15" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="18" height="14" rx="3"/><path d="M7.5 1v14"/><path d="M3.5 4.5h2M3.5 7h2M3.5 9.5h2" stroke-linecap="round"/></svg>'

type TabName = 'lessons' | 'tasks' | 'reference'

const sections = (): { name: string; lessons: Lesson[] }[] => {
Expand Down Expand Up @@ -119,8 +125,11 @@ export class LearnPanel {
})
tabs.append(b)
}
const hide = html('button', { class: 'learn-hide', title: t('web_learn_hide'), 'aria-label': t('web_learn_hide') }, sidebarIcon)
hide.addEventListener('click', () => this.host.collapse())
const head = h('div', { class: 'learn-head' }, tabs, hide)
this.body = h('div', { class: 'learn-body' })
this.element.replaceChildren(tabs, this.body)
this.element.replaceChildren(head, this.body)
if (this.tab === 'lessons') {
const lesson = lessons.find((l) => l.id === this.lessonId)
if (lesson) this.renderLesson(lesson)
Expand Down
54 changes: 53 additions & 1 deletion web/src/ui/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,50 @@ button.danger-text:not(:disabled) {
cursor: col-resize;
user-select: none;
}
.learn-tabs {
/* Kopfzeile: Reiter und Einklapp-Knopf (Seitenleisten-Symbol wie auf dem Mac). */
.learn-head {
display: flex;
align-items: flex-start;
gap: 6px;
margin: 10px 12px 0;
}
.learn-tabs {
flex: 1;
min-width: 0;
}
.learn-hide {
flex: none;
min-height: 30px;
padding: 4px 7px;
display: inline-flex;
align-items: center;
color: var(--muted);
}
/* Eingeklappt: schmale Leiste am Rand, ein Tipp klappt den Lernbereich wieder auf. */
.learn-rail {
flex: none;
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
width: 36px;
padding: 10px 0;
border: none;
border-radius: 0;
border-inline-end: 1px solid var(--border);
background: var(--panel);
cursor: pointer;
}
.learn-rail:hover {
background: var(--accent-soft);
}
.learn-rail span {
writing-mode: vertical-rl;
white-space: nowrap;
}
.shell.learning .learn-rail {
display: none;
}
.learn-body {
overflow-y: auto;
/* Sonst: Scrollbalken erscheint → Vorschaubilder schmaler und kürzer → Scrollbalken verschwindet → … */
Expand Down Expand Up @@ -1194,6 +1235,17 @@ button[data-action='learn'][aria-pressed='true'] {
.shell .learn {
width: auto !important;
}
.learn-rail {
flex-direction: row;
justify-content: center;
width: auto;
padding: 4px 0;
border-inline-end: none;
border-bottom: 1px solid var(--border);
}
.learn-rail span {
writing-mode: horizontal-tb;
}
.shell {
flex-direction: column;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const e=`/* Texte, die es nur in der Web-Version gibt. Alle anderen kommen aus d
/* Lernbereich (Lektionen gibt es vorerst nur auf Deutsch) */
"web_learn_title" = "Lernen";
"web_learn_toggle_title" = "Lektionen, Aufgaben und Nachschlagen ein- oder ausblenden";
"web_learn_hide" = "Lernbereich einklappen";
"web_learn_show" = "Lernbereich aufklappen: Lektionen, Aufgaben und Nachschlagen";
"web_learn_lessons" = "Lektionen";
"web_learn_tasks" = "Aufgaben";
"web_learn_reference" = "Nachschlagen";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const e=`/* Texts that exist only in the web version. Everything else comes from
/* Learning area (lessons are German only for now) */
"web_learn_title" = "Learn";
"web_learn_toggle_title" = "Show or hide lessons, exercises and reference";
"web_learn_hide" = "Collapse the learning area";
"web_learn_show" = "Expand the learning area: lessons, exercises and reference";
"web_learn_lessons" = "Lessons";
"web_learn_tasks" = "Exercises";
"web_learn_reference" = "Reference";
Expand Down
1,148 changes: 574 additions & 574 deletions website/app/assets/index-CsUJQ3XX.js → website/app/assets/index-1XQjtnL-.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const e=`/* Textos que só existem na versão web. Tudo o resto vem dos Localiza
"web_run_dropped_fmt" = "… %d linhas anteriores ocultas";
"web_learn_title" = "Aprender";
"web_learn_toggle_title" = "Mostrar ou ocultar lições, exercícios e consulta";
"web_learn_hide" = "Recolher a área de aprendizagem";
"web_learn_show" = "Expandir a área de aprendizagem: lições, exercícios e consulta";
"web_learn_lessons" = "Lições";
"web_learn_tasks" = "Exercícios";
"web_learn_reference" = "Consulta";
Expand Down
4 changes: 2 additions & 2 deletions website/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>VisuStruct Web</title>
<meta name="description" content="VisuStruct im Browser: Struktogramme nach Nassi-Shneiderman erstellen, simulieren und als Java, Python oder JavaScript ausgeben. Dateien bleiben auf deinem Gerät." />
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='3' y='3' width='26' height='26' fill='white' stroke='black' stroke-width='3'/%3E%3Cpath d='M3 3 L16 15 L29 3' fill='none' stroke='black' stroke-width='3'/%3E%3C/svg%3E" />
<script type="module" crossorigin src="./assets/index-CsUJQ3XX.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BenJ52NT.css">
<script type="module" crossorigin src="./assets/index-1XQjtnL-.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BZlsQgub.css">
</head>
<body>
<div id="app"></div>
Expand Down
Loading