[263] UX-Reste: Quellen-Auswahl voll lesbar, Hilfe → Kurzanleitung und Fehler melden, Nachweis-Export im leeren Projekt mit Hinweis
This commit is contained in:
19 files changed
+432
-11
No files matched your search
@@ -62,9 +62,9 @@ Kennwort, anonym) als PDF; Austausch mit Fachplanern über DXF/IFC.
|
||||
5. ~~Raumprogramm in der Flächenbilanz (320 px Panel): Name- und Gruppenfeld abgeschnitten („Wohnen/“, „Wohnunge“). Vorschlag: zweizeilige Zeilen oder Tooltip/Breite, S.~~ **Erledigt 15.11.:** zweizeilige Zeilen (Name über die ganze Breite, darunter Fläche/Anzahl/Gruppe/Stand), Tooltip mit vollem Text.
|
||||
6. ~~Statusleiste bei 1280 px: Hinweistext (z. B. „1/4 Treffer — erneut klicken …“) schrumpft auf „1..“, sobald X/Y-Koordinaten stehen. Vorschlag: Hinweis mit `title`, Koordinaten verdichten, S.~~ **Erledigt 15.11.:** Hinweis mindestens 170 px mit `title`, Wertcluster schrumpfbar, unter 1500 px engere Abstände und ohne Build-Nummer (steht im Über-Dialog).
|
||||
7. ~~Ressourcen-Fenster: Reiterleiste (… „Dachtypen“ …) bei 1280 px abgeschnitten, ohne Scroll-Hinweis; Zeilennamen („Holzwerkstoff (OSB/Spanplatte)“) ohne Tooltip. Vorschlag: gleicher Rand-Fade, `title`, S.~~ **Erledigt 15.11.:** Reiter umbrechen, Zeilennamen mit `title`.
|
||||
8. ~~Begriffe/Menüs: Ansicht-Menü „Perspektive“ steht zweimal (3D-Ansicht vs. Projektion; Vorschlag „3D-Ansicht“); Datei „Projekt öffnen“ ohne „ …“ (Startbildschirm mit), „DXF/DWG importieren…“ ohne Leerzeichen; Quellen-Auswahl „eigener Wert“ im Attribute-Panel bei 280 px als „eigen…“ gekürzt, S.~~ **Erledigt 15.11. (ohne „eigen…“ im Attribute-Panel, das bleibt offen):** Ansicht-Menü „3D-Ansicht“ (Ansichtsart) statt zweimal „Perspektive“; „Projekt öffnen …“; Konvention „ …“ (Leerzeichen davor) für Menü-/Befehlstexte de+en vereinheitlicht, Test `spelling.test.ts` (Fortschrittstexte „Suche…“ und Platzhalter ausgenommen).
|
||||
9. ~~Hilfe-Menü hat nur „Tastaturkürzel …“; „Über dossier“ nur über Klick auf die Wortmarke (nicht auffindbar), keine Kurzanleitung/Fehler-melden-Eintrag. Vorschlag: Einträge „Über dossier“, „Kurzanleitung“ (Test `kurzanleitung.test.ts` existiert), S.~~ **Teilweise erledigt 15.11.:** Hilfe → „Über dossier …“ (Browser/Electron; Hook `state/aboutDialogHook.ts`); im nativen Tauri-Menü steht „Über“ im App-Menü (macOS), dort nichts geändert. **Offen:** „Kurzanleitung“ und „Fehler melden“.
|
||||
10. ~~Rückmeldungen: „Publiziert (Dateien): 1“ nennt weder Dateiname noch Ort; CSV-Nachweis im leeren Projekt exportiert Nullen ohne Hinweis; schwebende Paletten (Verlauf, BCF, Objekteinstellungen mit T ausgenommen) schliessen nicht mit Esc, S.~~ **Teilweise erledigt 15.11.:** Meldung „Publiziert: «Name.pdf»“ (bei mehreren Dateien mit Anzahl; Ort wählt der Speichern-Dialog bzw. Download-Ordner); Verlauf, BCF und Kollisionen schliessen schwebend mit Esc (`closeOnEscape`, Fokus im Fenster). **Offen:** CSV-Nachweis im leeren Projekt ohne Hinweis. e2e: `uxReview263.spec.ts`. Nicht auf dem Mac geprüft.
|
||||
8. ~~Begriffe/Menüs: Ansicht-Menü „Perspektive“ steht zweimal (3D-Ansicht vs. Projektion; Vorschlag „3D-Ansicht“); Datei „Projekt öffnen“ ohne „ …“ (Startbildschirm mit), „DXF/DWG importieren…“ ohne Leerzeichen; Quellen-Auswahl „eigener Wert“ im Attribute-Panel bei 280 px als „eigen…“ gekürzt, S.~~ **Erledigt 15.11. („eigen…“ im Attribute-Panel: erledigt 16.11., Zahlenfeld gibt nach, Label-Spalte 36 %, Drehpfeile der Zahlenfelder im Panel ausgeblendet; „eigener Wert“ steht voll innerhalb des Panels, e2e `uxReview263.spec.ts`):** Ansicht-Menü „3D-Ansicht“ (Ansichtsart) statt zweimal „Perspektive“; „Projekt öffnen …“; Konvention „ …“ (Leerzeichen davor) für Menü-/Befehlstexte de+en vereinheitlicht, Test `spelling.test.ts` (Fortschrittstexte „Suche…“ und Platzhalter ausgenommen).
|
||||
9. ~~Hilfe-Menü hat nur „Tastaturkürzel …“; „Über dossier“ nur über Klick auf die Wortmarke (nicht auffindbar), keine Kurzanleitung/Fehler-melden-Eintrag. Vorschlag: Einträge „Über dossier“, „Kurzanleitung“ (Test `kurzanleitung.test.ts` existiert), S.~~ **Teilweise erledigt 15.11.:** Hilfe → „Über dossier …“ (Browser/Electron; Hook `state/aboutDialogHook.ts`); im nativen Tauri-Menü steht „Über“ im App-Menü (macOS), dort nichts geändert. **Erledigt 16.11.:** Hilfe → „Kurzanleitung …“ (Overlay-Dialog `QuickGuideDialog.tsx`, Inhalt von `doc/KURZANLEITUNG.md` beim Build gebündelt samt Bildern, kleiner Markdown-Leser `miniMarkdown.ts`, kein Netz; Text bleibt deutsch, im en-Titel „(German)“) und „Fehler melden …“ (öffnet `https://git.openbureau.ch/karim/dossier/issues/new` über `openExternalUrl`, vorbefüllt nur mit Version und Build, `update/bugReport.ts`); im nativen Tauri-Menü (Hilfe) dieselben Einträge. Nicht in der Tauri-App geprüft (System-Browser-Öffnung dort ungeprüft).
|
||||
10. ~~Rückmeldungen: „Publiziert (Dateien): 1“ nennt weder Dateiname noch Ort; CSV-Nachweis im leeren Projekt exportiert Nullen ohne Hinweis; schwebende Paletten (Verlauf, BCF, Objekteinstellungen mit T ausgenommen) schliessen nicht mit Esc, S.~~ **Teilweise erledigt 15.11.:** Meldung „Publiziert: «Name.pdf»“ (bei mehreren Dateien mit Anzahl; Ort wählt der Speichern-Dialog bzw. Download-Ordner); Verlauf, BCF und Kollisionen schliessen schwebend mit Esc (`closeOnEscape`, Fokus im Fenster). **Erledigt 16.11.:** CSV und PDF des Flächen- und Kennzahlen-Nachweises brechen im Projekt ohne Bauteile ab und melden „Noch keine Bauteile — der Nachweis wäre leer. Es wurde nichts exportiert.“ (`isAreaReportEmpty`); die übrigen Tabellen-Exporte (Raumbuch, Kosten …) unverändert. e2e: `uxReview263.spec.ts`. Nicht auf dem Mac geprüft.
|
||||
**Nicht geprüft:** Tauri/Mac (Nebenfenster, native Menüs, Metal), 3D-Ansicht und Zeichenfläche pixelgenau (SwiftShader), Layout-Inhalt im Druck, englisch/dunkel bei 1440, Tab-Reihenfolge/Screenreader ausserhalb der Dialoge ([249]). Dunkles Thema: Kontrast der Panels und Dialoge ohne Befund; der Plan bleibt als Papier hell (Absicht?). Grösse S–M.
|
||||
- ◐ **[261]** Version und Buildnummer (15.11., Entscheid Maintainer): Anwender-Version semver **1.0.0-beta.1** (`package.json`, `tauri.conf.json`, App-`Cargo.toml`, `website/hugo.toml`; Kern-Crates bleiben 0.1.0, nichts Sichtbares). Interne Buildnummer **`JJMMTT.N`** aus `scripts/build-number.cjs`: Env `DOSSIER_BUILD` gewinnt, sonst Datum + Anzahl Commits des Tages (`git log --since=midnight`), ohne Git `JJMMTT.0`. Eingebacken über Vite-`define` (`__DOSSIER_BUILD__`, `src/update/buildInfo.ts`; Browser/Electron/Tauri) und `scripts/build-cli.mjs` (`dossier-cli --version`); Anzeige „1.0.0-beta.1 (Build 261115.1)“ in Über-Dialog, Einstellungen, Startbildschirm, macOS-Info-Fenster (shortVersion) und dezent in der Statusleiste; `tauri:build` setzt `bundle.macOS.bundleVersion` (CFBundleVersion). Tests: `src/update/buildNumber.test.ts`. **Offen:** nicht in der Tauri-App/auf dem Mac geprüft (Prüfschritt 13.35); ~~Electron-`buildVersion` nicht gesetzt~~ (16.11. gesetzt, [170]: aus `dist/build-info.json`, gleiche Nummer wie die Oberfläche); Projektdatei trägt (noch) kein Feld für die schreibende App-Version/Build (bräuchte Modellfeld in Rust + `KNOWN_KEYS` + Fassade, S); Zähler zählt Commits, nicht Builds (zwei Builds ohne Commit dazwischen = gleiche Nummer; Abhilfe `DOSSIER_BUILD=261115.3`). Grösse S.
|
||||
- ◐ **[260]** Fenster/Türen im Grundriss: Darstellungsart **symbolisch** oder **geschnitten** wählbar (15.11., Entscheid Maintainer). Symbolisch = Öffnungssymbol nach Norm unabhängig von der Schnitthöhe (heutiges Verhalten für Öffnungen im Schnitt, Brüstungen/Stürze über/unter Schnitt als Symbol); geschnitten = Darstellung nach der tatsächlichen Schnitthöhe (Öffnung über dem Schnitt: Wand geschlossen, Öffnung als Linie über Schnitt). Einstellbar im Objekteinstellungsfenster (Taste T) je Fenster/Tür bzw. Typ, Vorgabe aus Modelldarstellung.
|
||||
|
||||
@@ -203,3 +203,86 @@ test("Verlauf und BCF (schwebende Fenster) schliessen mit Esc", async ({ page })
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(bcf).toBeHidden();
|
||||
});
|
||||
|
||||
// [263] Rest: Quellen-Auswahl voll lesbar, Hilfe → Kurzanleitung / Fehler melden, CSV-Nachweis im leeren Projekt.
|
||||
// Screenshots nur auf Wunsch: E2E_SHOTS=/pfad.
|
||||
const shot = async (page: import("@playwright/test").Page, name: string) => {
|
||||
if (process.env.E2E_SHOTS) await page.screenshot({ path: `${process.env.E2E_SHOTS}/${name}.png` });
|
||||
};
|
||||
|
||||
test("Attribute-Panel: „eigener Wert“ steht ungekürzt und innerhalb des Panels", async ({ page }) => {
|
||||
await startNewProject(page);
|
||||
await fileMenu(page, /^Neu aus Vorlage: Wettbewerb$/);
|
||||
await discardIfAsked(page);
|
||||
await page.mouse.click(400, 430);
|
||||
const trigger = page.locator(".attr-val > .attr-num ~ .tb-dd-trigger").first();
|
||||
await expect(trigger).toBeVisible();
|
||||
const box = (await trigger.boundingBox())!;
|
||||
const panel = (await page.locator(".attr-grid").first().boundingBox())!;
|
||||
expect(box.x + box.width).toBeLessThanOrEqual(panel.x + panel.width + 1);
|
||||
await expect(trigger).toContainText("eigener Wert");
|
||||
await shot(page, "attr-after");
|
||||
});
|
||||
|
||||
test("Hilfe: Kurzanleitung öffnet im Dialog, Esc schliesst", async ({ page }) => {
|
||||
await startNewProject(page);
|
||||
await page.getByRole("button", { name: "Hilfe", exact: true }).click();
|
||||
await page.getByRole("option", { name: "Kurzanleitung …", exact: true }).click();
|
||||
const dlg = page.getByRole("dialog", { name: "Kurzanleitung" });
|
||||
await expect(dlg).toBeVisible();
|
||||
await expect(dlg.getByRole("heading", { name: "Erster Wettbewerb mit Dossier" })).toBeVisible();
|
||||
await expect(dlg.getByRole("heading", { name: /^1\. Leeres Projekt/ })).toHaveCount(1);
|
||||
expect(await dlg.textContent()).not.toContain("**");
|
||||
await shot(page, "guide-de");
|
||||
await dlg.locator("img").first().scrollIntoViewIfNeeded();
|
||||
await expect.poll(() => dlg.locator("img").first().evaluate((i: HTMLImageElement) => i.complete && i.naturalWidth > 0)).toBe(true);
|
||||
await shot(page, "guide-de-img");
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dlg).toBeHidden();
|
||||
});
|
||||
|
||||
test("Hilfe: Fehler melden öffnet die Issue-Seite mit Version und Build, ohne Projektdaten", async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
const w = window as unknown as { __opened: string[] };
|
||||
w.__opened = [];
|
||||
window.open = ((url?: string | URL) => {
|
||||
w.__opened.push(String(url));
|
||||
return null;
|
||||
}) as typeof window.open;
|
||||
});
|
||||
await startNewProject(page);
|
||||
await page.getByRole("button", { name: "Hilfe", exact: true }).click();
|
||||
await page.getByRole("option", { name: "Fehler melden …", exact: true }).click();
|
||||
const opened = await page.evaluate(() => (window as unknown as { __opened: string[] }).__opened);
|
||||
expect(opened).toHaveLength(1);
|
||||
const u = new URL(opened[0]!);
|
||||
expect(u.origin + u.pathname).toBe("https://git.openbureau.ch/karim/dossier/issues/new");
|
||||
expect(u.searchParams.get("body")!).toMatch(/^Version: \S+ \(Build \S+\)/);
|
||||
});
|
||||
|
||||
test("Fehler melden und Kurzanleitung auf Englisch", async ({ page }) => {
|
||||
await page.goto("/?dossierTest&lang=en");
|
||||
await page.getByRole("button", { name: "New project" }).first().click();
|
||||
await page.getByRole("menubar").getByRole("button", { name: "Help", exact: true }).click();
|
||||
await shot(page, "help-en");
|
||||
await expect(page.getByRole("option", { name: "Report a Bug …", exact: true })).toBeVisible();
|
||||
await page.getByRole("option", { name: "Quick Guide …", exact: true }).click();
|
||||
await expect(page.getByRole("dialog", { name: "Quick Guide (German)" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Flächen-Nachweis im leeren Projekt: Hinweis statt Nullen, mit Bauteilen exportiert", async ({ page }) => {
|
||||
await startNewProject(page);
|
||||
await openTab(page, "Flächenbilanz");
|
||||
const downloads: string[] = [];
|
||||
page.on("download", (d) => downloads.push(d.suggestedFilename()));
|
||||
await page.getByRole("button", { name: "CSV", exact: true }).first().click();
|
||||
await expect(page.getByText("Noch keine Bauteile — der Nachweis wäre leer.")).toBeVisible();
|
||||
await shot(page, "csv-empty");
|
||||
expect(downloads).toEqual([]);
|
||||
await fileMenu(page, /^Neu aus Vorlage: Wettbewerb$/);
|
||||
await discardIfAsked(page);
|
||||
await openTab(page, "Flächenbilanz");
|
||||
const dl = page.waitForEvent("download");
|
||||
await page.getByRole("button", { name: "CSV", exact: true }).first().click();
|
||||
expect((await dl).suggestedFilename()).toMatch(/\.csv$/);
|
||||
});
|
||||
+1
-1
@@ -49,7 +49,7 @@ export { exportProjectName, competitionIdentity, isAnonymous, competitionKeyword
|
||||
export type { CompetitionIdentity } from "../export/competitionIdentity";
|
||||
export { anonymityFindings } from "../export/competitionCheck";
|
||||
export type { AnonymityFinding, AnonymityKind } from "../export/competitionCheck";
|
||||
export { buildAreaReport, areaReportToCsv, parseAreaReportCsv, areaReportToSvg, buildAreaReportPdf } from "../export/areaReport";
|
||||
export { isAreaReportEmpty, buildAreaReport, areaReportToCsv, parseAreaReportCsv, areaReportToSvg, buildAreaReportPdf } from "../export/areaReport";
|
||||
export { setPdfFontLoader } from "../export/pdfFonts";
|
||||
export type { AreaReport, AreaReportOptions } from "../export/areaReport";
|
||||
export { sunPosition, shadowPolygons, shadowOfPrism, projectLatLon } from "../analysis/sun";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import { emptyProject, sampleProject } from "../model/sampleProject";
|
||||
import type { Project, Room, Wall } from "../model/types";
|
||||
import { computeAreaTable, computeIvhb } from "../analysis/areaTable";
|
||||
import { areaReportToCsv, areaReportToSvg, buildAreaReport, buildAreaReportPdf, layoutAreaReport, parseAreaReportCsv } from "./areaReport";
|
||||
import { isAreaReportEmpty, areaReportToCsv, areaReportToSvg, buildAreaReport, buildAreaReportPdf, layoutAreaReport, parseAreaReportCsv } from "./areaReport";
|
||||
|
||||
// Einfaches Haus: Achsen 10 × 8 m, Wände 0.3 m, EG-Räume innen 9.7 × 7.7 m (Handrechnung siehe flaechen.rs).
|
||||
function house(): Project {
|
||||
@@ -113,3 +113,10 @@ describe("Bericht", () => {
|
||||
expect(lay.pages.length).toBeGreaterThan(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isAreaReportEmpty [263]", () => {
|
||||
it("leeres Projekt: leer; Musterhaus: nicht leer", () => {
|
||||
expect(isAreaReportEmpty(emptyProject)).toBe(true);
|
||||
expect(isAreaReportEmpty(sampleProject)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -65,6 +65,12 @@ function areaCells(r: AreaRow): Cell[] {
|
||||
return [r.hnf, r.nnf, r.nf, r.vf, r.ff, r.ngf, r.kf, r.gf, r.agf].map((v) => num(v, 2)).concat(num(r.gv, 1));
|
||||
}
|
||||
|
||||
/** [263] Ohne Bauteile (kein Raum, keine Fläche, kein Volumen) wäre der Nachweis nur Nullen: dann kein Export, sondern ein Hinweis. */
|
||||
export function isAreaReportEmpty(project: Project): boolean {
|
||||
const { total, gv } = computeAreaTable(project);
|
||||
return [total.hnf, total.nnf, total.vf, total.ff, total.kf, total.gf, total.agf, total.rooms, gv].every((v) => !(Math.abs(v) > 0));
|
||||
}
|
||||
|
||||
/** Baut den Bericht aus dem Projekt. */
|
||||
export function buildAreaReport(project: Project, opts: AreaReportOptions = {}): AreaReport {
|
||||
const sections: ReportSection[] = [];
|
||||
|
||||
@@ -2607,6 +2607,7 @@ export const de = {
|
||||
"areas.basisInput": "aGF der AZ",
|
||||
"areas.includeUnderground": "Untergeschosse anrechnen",
|
||||
"areas.exportCsv": "CSV",
|
||||
"areas.export.empty": "Noch keine Bauteile — der Nachweis wäre leer. Es wurde nichts exportiert.",
|
||||
"areas.exportPdf": "PDF",
|
||||
"areas.exportPdf.fail": "PDF konnte nicht erstellt werden.",
|
||||
"areas.noLevels": "Keine Geschosse mit Räumen.",
|
||||
@@ -4464,6 +4465,10 @@ export const de = {
|
||||
"menu.help": "Hilfe",
|
||||
"menu.help.shortcuts": "Tastaturkürzel …",
|
||||
"menu.help.about": "Über dossier …",
|
||||
"menu.help.guide": "Kurzanleitung …",
|
||||
"menu.help.bugReport": "Fehler melden …",
|
||||
"help.guide.title": "Kurzanleitung",
|
||||
"help.bugReport.body": "Version: {version}\n\nWas ist passiert?\n\nWas hast du erwartet?\n\nSchritte zum Nachstellen:\n1. \n",
|
||||
"help.shortcuts.title": "Tastaturkürzel",
|
||||
"help.shortcuts.intro": "Tastenkombinationen und Befehlskürzel, wie sie gerade gelten (inklusive eigener Änderungen aus den Einstellungen).",
|
||||
"help.shortcuts.filter": "Suchen …",
|
||||
|
||||
@@ -2595,6 +2595,7 @@ export const en: Record<TranslationKey, string> = {
|
||||
"areas.basisInput": "aGF for AZ",
|
||||
"areas.includeUnderground": "Credit underground levels",
|
||||
"areas.exportCsv": "CSV",
|
||||
"areas.export.empty": "No building elements yet — the report would be empty. Nothing was exported.",
|
||||
"areas.exportPdf": "PDF",
|
||||
"areas.exportPdf.fail": "Could not create the PDF.",
|
||||
"areas.noLevels": "No levels with rooms.",
|
||||
@@ -4450,6 +4451,10 @@ export const en: Record<TranslationKey, string> = {
|
||||
"menu.help": "Help",
|
||||
"menu.help.shortcuts": "Keyboard Shortcuts …",
|
||||
"menu.help.about": "About dossier …",
|
||||
"menu.help.guide": "Quick Guide …",
|
||||
"menu.help.bugReport": "Report a Bug …",
|
||||
"help.guide.title": "Quick Guide (German)",
|
||||
"help.bugReport.body": "Version: {version}\n\nWhat happened?\n\nWhat did you expect?\n\nSteps to reproduce:\n1. \n",
|
||||
"help.shortcuts.title": "Keyboard Shortcuts",
|
||||
"help.shortcuts.intro": "Key combinations and command aliases as they apply now (including your changes from Settings).",
|
||||
"help.shortcuts.filter": "Search …",
|
||||
|
||||
+10
-1
@@ -17,6 +17,7 @@ import { isTauriRuntime } from "./projectFile";
|
||||
import { t } from "../i18n";
|
||||
import { openRenderDialog } from "../state/renderDialogHook";
|
||||
import { openShortcutOverview } from "../state/shortcutOverviewHook";
|
||||
import { openBugReport, openQuickGuide } from "../state/helpMenuHook";
|
||||
import { openImageExportDialog } from "../state/imageExportDialogHook";
|
||||
import { APP_VERSION } from "../ui/TopBar";
|
||||
import { BUILD_INFO } from "../update/buildInfo";
|
||||
@@ -502,14 +503,22 @@ export function useNativeAppMenu(
|
||||
],
|
||||
});
|
||||
|
||||
// [210] Hilfe → Tastaturkürzel (Overlay-Dialog in der App).
|
||||
// [210] Hilfe → Tastaturkürzel (Overlay-Dialog in der App); [263] Kurzanleitung (Dialog), Fehler melden (System-Browser).
|
||||
const helpMenu = await Submenu.new({
|
||||
text: t("menu.help"),
|
||||
items: [
|
||||
await MenuItem.new({
|
||||
text: t("menu.help.guide"),
|
||||
action: () => openQuickGuide(),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.help.shortcuts"),
|
||||
action: () => openShortcutOverview(),
|
||||
}),
|
||||
await MenuItem.new({
|
||||
text: t("menu.help.bugReport"),
|
||||
action: () => openBugReport(),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { t } from "../i18n";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReport, buildAreaReportPdf } from "../core";
|
||||
import { exportProjectName, areaReportToCsv, buildAreaReport, buildAreaReportPdf, isAreaReportEmpty } from "../core";
|
||||
import type { AgfBasis } from "../core";
|
||||
import { DEFAULT_AREA_INPUTS, ivhbOptionsOf, type AreaInputs } from "./areaInputs";
|
||||
import { downloadCsv } from "./downloadFile";
|
||||
@@ -29,7 +29,18 @@ export function AreaTableSection() {
|
||||
const set = (patch: Partial<AreaInputs>) => setInputs((i) => ({ ...i, ...patch }));
|
||||
const stem = `${exportProjectName(project) || "projekt"}-flaechen`;
|
||||
|
||||
// [263] Leeres Projekt: kein Export von Nullen, sondern ein Hinweis (sonst sähe die Datei wie ein Ergebnis aus).
|
||||
const emptyHint = () => {
|
||||
if (!isAreaReportEmpty(project)) return false;
|
||||
notify(t("areas.export.empty"));
|
||||
return true;
|
||||
};
|
||||
const exportCsv = () => {
|
||||
if (emptyHint()) return;
|
||||
runWithAnonymityGate(project, [`${stem}.csv`], () => downloadCsv(`${stem}.csv`, areaReportToCsv(report)));
|
||||
};
|
||||
const exportPdf = () => {
|
||||
if (emptyHint()) return;
|
||||
runWithAnonymityGate(project, [`${stem}.pdf`], async () => {
|
||||
try {
|
||||
(await buildAreaReportPdf(report)).save(`${stem}.pdf`);
|
||||
@@ -44,7 +55,7 @@ export function AreaTableSection() {
|
||||
<div className="balance-head">
|
||||
<span className="balance-section-label">{t("areas.title")}</span>
|
||||
<span className="area-actions">
|
||||
<button type="button" className="balance-export" onClick={() => runWithAnonymityGate(project, [`${stem}.csv`], () => downloadCsv(`${stem}.csv`, areaReportToCsv(report)))}>
|
||||
<button type="button" className="balance-export" onClick={exportCsv}>
|
||||
{t("areas.exportCsv")}
|
||||
</button>
|
||||
<button type="button" className="balance-export" onClick={exportPdf}>
|
||||
|
||||
Vendored
+5
@@ -4,3 +4,8 @@ declare module "*?raw" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
// [263] Vite `import.meta.glob` (Kurzanleitung-Bilder in `ui/QuickGuideDialog.tsx`), ohne die vite/client-Typen.
|
||||
interface ImportMeta {
|
||||
glob(pattern: string, options?: { query?: string; import?: string; eager?: boolean }): Record<string, unknown>;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// [263] Hilfe-Menü: Kurzanleitung und Fehler melden. Der Dialog (`ui/QuickGuideDialog.tsx`) registriert seinen Öffner;
|
||||
// „Fehler melden …“ öffnet die Issue-Seite im System-Browser (Muster `shortcutOverviewHook`, `aboutDialogHook`).
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { bugReportUrl } from "../update/bugReport";
|
||||
import { openExternalUrl } from "../native/blender";
|
||||
|
||||
let opener: (() => void) | null = null;
|
||||
|
||||
export function setQuickGuideOpener(fn: (() => void) | null): void {
|
||||
opener = fn;
|
||||
}
|
||||
|
||||
export function openQuickGuide(): void {
|
||||
opener?.();
|
||||
}
|
||||
|
||||
/** Öffnet die Issue-Seite (Tauri: System-Browser, sonst neuer Tab), vorbefüllt mit Version und Build. */
|
||||
export function openBugReport(): void {
|
||||
void openExternalUrl(bugReportUrl(t("help.bugReport.body"), t("about.build")));
|
||||
}
|
||||
+50
-2
@@ -5767,7 +5767,7 @@ body {
|
||||
display: grid;
|
||||
/* [263] Label-Spalte höchstens 42 %: ein langes Label („Strichmuster-Massstab“) presste sonst die
|
||||
Wert-Spalte auf 120 px, und die Quellen-Auswahl neben dem Zahlenfeld schrumpfte auf „e ▾“. */
|
||||
grid-template-columns: minmax(80px, 42%) 1fr;
|
||||
grid-template-columns: minmax(80px, 36%) 1fr;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
@@ -5797,10 +5797,20 @@ body {
|
||||
min-width: 0;
|
||||
justify-content: space-between;
|
||||
}
|
||||
/* [263] Quellen-Auswahl neben einem Zahlenfeld: nie unter die Breite von „eigener Wert“ schrumpfen. */
|
||||
/* [263] Quellen-Auswahl neben einem Zahlenfeld: nie unter die Breite von „eigener Wert“ schrumpfen; dafür gibt das
|
||||
Zahlenfeld nach (im 270-px-Panel ragte die Auswahl sonst rechts aus dem Panel: „eigener Wer“). */
|
||||
.attr-val > .attr-num {
|
||||
flex: 0 1 auto;
|
||||
min-width: 58px;
|
||||
}
|
||||
/* Das Drehfeld (Pfeile) frisst in dem schmalen Feld die Ziffern („0.3“); Eingabe per Tastatur/Mausrad bleibt. */
|
||||
.attr-val > input.attr-num[type="number"]::-webkit-inner-spin-button {
|
||||
display: none;
|
||||
}
|
||||
.attr-val > .attr-num ~ .tb-dd-trigger {
|
||||
flex: 1 0 auto;
|
||||
min-width: 84px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.attr-readonly {
|
||||
color: var(--label);
|
||||
@@ -9551,3 +9561,41 @@ body {
|
||||
.floating-panel:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* [263] Kurzanleitung (Hilfe-Menü): breiter Dialog, lesbarer Fliesstext, Bilder auf Dialogbreite. */
|
||||
.imp-dialog.quick-guide {
|
||||
width: min(760px, 94vw);
|
||||
max-height: 90vh;
|
||||
}
|
||||
.quick-guide-body {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
color: var(--label);
|
||||
outline: none;
|
||||
}
|
||||
.quick-guide-body h2 { font-size: 18px; margin: 0 0 8px; }
|
||||
.quick-guide-body h3 { font-size: 15px; margin: 22px 0 6px; }
|
||||
.quick-guide-body h4 { font-size: 13px; margin: 14px 0 4px; }
|
||||
.quick-guide-body p,
|
||||
.quick-guide-body ul,
|
||||
.quick-guide-body ol,
|
||||
.quick-guide-body blockquote { margin: 0 0 10px; }
|
||||
.quick-guide-body ul,
|
||||
.quick-guide-body ol { padding-left: 22px; }
|
||||
.quick-guide-body li { margin-bottom: 3px; }
|
||||
.quick-guide-body blockquote {
|
||||
padding: 6px 10px;
|
||||
border-left: 3px solid var(--line);
|
||||
background: var(--panel-2);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.quick-guide-body code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
font-size: 12px;
|
||||
background: var(--panel-2);
|
||||
padding: 0 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.quick-guide-body hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
|
||||
.quick-guide-body img { display: block; max-width: 100%; height: auto; margin: 6px 0 12px; background: #fff; border: 1px solid var(--line); }
|
||||
@@ -33,6 +33,7 @@ import { RenderDialogHost } from "./RenderDialog";
|
||||
import { CameraTourDialogHost } from "./CameraTourDialog";
|
||||
import { ImageExportDialogHost } from "./ImageExportDialog";
|
||||
import { ShortcutOverviewDialogHost } from "./ShortcutOverviewDialog";
|
||||
import { QuickGuideDialogHost } from "./QuickGuideDialog";
|
||||
import { PromptDialog } from "./PromptDialog";
|
||||
import { RecoverAutosaveDialog } from "./RecoverAutosaveDialog";
|
||||
import { BackupOfferDialog } from "./BackupOfferDialog";
|
||||
@@ -176,6 +177,8 @@ export function AppDialogs(props: {
|
||||
<CameraTourDialogHost />
|
||||
{/* [210] Kürzel-Übersicht (Menü Hilfe) */}
|
||||
<ShortcutOverviewDialogHost />
|
||||
{/* [263] Kurzanleitung (Menü Hilfe) */}
|
||||
<QuickGuideDialogHost />
|
||||
{importState && (
|
||||
<ImportDialog
|
||||
fileName={importState.fileName}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { t } from "../i18n";
|
||||
import type { View3d, ViewType } from "../model/viewTypes";
|
||||
import { openRenderDialog } from "../state/renderDialogHook";
|
||||
import { openAboutDialog } from "../state/aboutDialogHook";
|
||||
import { openBugReport, openQuickGuide } from "../state/helpMenuHook";
|
||||
import { openShortcutOverview } from "../state/shortcutOverviewHook";
|
||||
import { openImageExportDialog } from "../state/imageExportDialogHook";
|
||||
|
||||
@@ -190,7 +191,9 @@ export const AppMenuBar = memo(function AppMenuBar({
|
||||
];
|
||||
|
||||
const helpItems: DropdownItem[] = [
|
||||
{ label: t("menu.help.guide"), onSelect: openQuickGuide },
|
||||
{ label: t("menu.help.shortcuts"), onSelect: openShortcutOverview },
|
||||
{ label: t("menu.help.bugReport"), onSelect: openBugReport },
|
||||
{ divider: true },
|
||||
// [263] Auf macOS (natives Menü) steht „Über dossier“ im App-Menü; dieses Menü gibt es nur im Browser/Electron.
|
||||
{ label: t("menu.help.about"), onSelect: openAboutDialog },
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// [263] Overlay-Dialog „Kurzanleitung“ (Hilfe-Menü, Browser/Electron und natives Menü): der Inhalt von
|
||||
// doc/KURZANLEITUNG.md, beim Build gebündelt (`?raw`, Bilder als Assets) — kein Netz. Die Anleitung ist deutsch
|
||||
// (die Oberfläche übersetzt sie nicht); kein window.alert.
|
||||
|
||||
import { Fragment, memo, useEffect, useMemo, useState, type ReactNode } from "react";
|
||||
import guideMd from "../../doc/KURZANLEITUNG.md?raw";
|
||||
import { t } from "../i18n";
|
||||
import { setQuickGuideOpener } from "../state/helpMenuHook";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
import { parseMarkdown, type Block, type Inline } from "./miniMarkdown";
|
||||
|
||||
const IMAGES = import.meta.glob("../../doc/kurzanleitung/*.png", { query: "?url", import: "default", eager: true }) as Record<string, string>;
|
||||
|
||||
function imageUrl(src: string): string | undefined {
|
||||
return IMAGES[`../../doc/${src}`];
|
||||
}
|
||||
|
||||
function inline(parts: Inline[]): ReactNode {
|
||||
return parts.map((p, i) => {
|
||||
switch (p.t) {
|
||||
case "b":
|
||||
return <strong key={i}>{p.s}</strong>;
|
||||
case "i":
|
||||
return <em key={i}>{p.s}</em>;
|
||||
case "code":
|
||||
return <code key={i}>{p.s}</code>;
|
||||
default:
|
||||
return <Fragment key={i}>{p.s}</Fragment>;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderBlock(b: Block, i: number): ReactNode {
|
||||
switch (b.t) {
|
||||
case "h":
|
||||
return b.level === 1 ? <h2 key={i}>{inline(b.inl)}</h2> : b.level === 2 ? <h3 key={i}>{inline(b.inl)}</h3> : <h4 key={i}>{inline(b.inl)}</h4>;
|
||||
case "p":
|
||||
return <p key={i}>{inline(b.inl)}</p>;
|
||||
case "quote":
|
||||
return <blockquote key={i}>{inline(b.inl)}</blockquote>;
|
||||
case "ul":
|
||||
return <ul key={i}>{b.items.map((it, j) => <li key={j}>{inline(it)}</li>)}</ul>;
|
||||
case "ol":
|
||||
return <ol key={i}>{b.items.map((it, j) => <li key={j}>{inline(it)}</li>)}</ol>;
|
||||
case "hr":
|
||||
return <hr key={i} />;
|
||||
case "img": {
|
||||
const url = imageUrl(b.src);
|
||||
return url ? <img key={i} src={url} alt={b.alt} loading="lazy" /> : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const QuickGuideDialogHost = memo(function QuickGuideDialogHost() {
|
||||
const [open, setOpen] = useState(false);
|
||||
useEffect(() => {
|
||||
setQuickGuideOpener(() => setOpen(true));
|
||||
return () => setQuickGuideOpener(null);
|
||||
}, []);
|
||||
const dialogRef = useModalFocus({ onEscape: () => setOpen(false) });
|
||||
const blocks = useMemo(() => (open ? parseMarkdown(guideMd) : []), [open]);
|
||||
if (!open) return null;
|
||||
return (
|
||||
<div className="imp-overlay" onClick={() => setOpen(false)}>
|
||||
<div
|
||||
ref={dialogRef}
|
||||
className="imp-dialog quick-guide"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={t("help.guide.title")}
|
||||
data-testid="quick-guide"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<header className="imp-head">
|
||||
<span className="imp-head-title">{t("help.guide.title")}</span>
|
||||
<button className="imp-close" onClick={() => setOpen(false)} aria-label={t("export.close")}>
|
||||
×
|
||||
</button>
|
||||
</header>
|
||||
<div className="imp-body quick-guide-body" tabIndex={0}>
|
||||
{blocks.map(renderBlock)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { parseInline, parseMarkdown } from "./miniMarkdown";
|
||||
|
||||
describe("miniMarkdown [263]", () => {
|
||||
it("Inline: fett, kursiv, Code, Rest bleibt Text", () => {
|
||||
expect(parseInline("a **b** *c* `d` e*")).toEqual([
|
||||
{ t: "text", s: "a " }, { t: "b", s: "b" }, { t: "text", s: " " }, { t: "i", s: "c" }, { t: "text", s: " " },
|
||||
{ t: "code", s: "d" }, { t: "text", s: " e*" },
|
||||
]);
|
||||
});
|
||||
it("Blöcke: Überschrift, Absatz über Zeilen, Listen mit Fortsetzung, Zitat, Bild, Linie", () => {
|
||||
const b = parseMarkdown("# T\n\nzeile eins\nzeile zwei\n\n1. a\n weiter\n2. b\n\n- x\n\n> q\n> r\n\n\n\n---\n");
|
||||
expect(b.map((x) => x.t)).toEqual(["h", "p", "ol", "ul", "quote", "img", "hr"]);
|
||||
expect((b[1] as { inl: { s: string }[] }).inl[0]!.s).toBe("zeile eins zeile zwei");
|
||||
expect((b[2] as { items: unknown[][] }).items).toHaveLength(2);
|
||||
expect(b[5]).toEqual({ t: "img", alt: "alt", src: "p/a.png" });
|
||||
});
|
||||
it("die echte Kurzanleitung lässt sich lesen: Überschriften, Bilder, keine Rohzeichen", () => {
|
||||
const md = readFileSync(join(process.cwd(), "doc", "KURZANLEITUNG.md"), "utf8");
|
||||
const b = parseMarkdown(md);
|
||||
expect(b[0]).toMatchObject({ t: "h", level: 1 });
|
||||
expect(b.filter((x) => x.t === "h" && x.level === 2).length).toBeGreaterThanOrEqual(10);
|
||||
expect(b.filter((x) => x.t === "img").length).toBe(5);
|
||||
expect(JSON.stringify(b.filter((x) => x.t !== "img"))).not.toContain("**");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
// [263] Minimaler Markdown-Leser für die Kurzanleitung (doc/KURZANLEITUNG.md) im Hilfe-Dialog: Überschriften, Absätze,
|
||||
// Listen (`-`, `1.`), Zitate, Trennlinie, Bilder und im Text **fett**, *kursiv*, `Code`. Mehr braucht das Dokument nicht;
|
||||
// Tabellen/Codeblöcke gibt es dort nicht. Reine Funktion (Test `miniMarkdown.test.ts`), die Darstellung steht in
|
||||
// `QuickGuideDialog.tsx` (kein dangerouslySetInnerHTML).
|
||||
|
||||
export type Inline = { t: "text" | "b" | "i" | "code"; s: string };
|
||||
export type Block =
|
||||
| { t: "h"; level: 1 | 2 | 3; inl: Inline[] }
|
||||
| { t: "p"; inl: Inline[] }
|
||||
| { t: "quote"; inl: Inline[] }
|
||||
| { t: "ul" | "ol"; items: Inline[][] }
|
||||
| { t: "img"; alt: string; src: string }
|
||||
| { t: "hr" };
|
||||
|
||||
/** Zerlegt eine Zeile in Text-, Fett-, Kursiv- und Code-Stücke. Unabgeschlossene Zeichen bleiben Text. */
|
||||
export function parseInline(src: string): Inline[] {
|
||||
const out: Inline[] = [];
|
||||
const re = /`([^`]+)`|\*\*([^*]+)\*\*|\*([^*\s][^*]*)\*/g;
|
||||
let last = 0;
|
||||
for (const m of src.matchAll(re)) {
|
||||
if (m.index! > last) out.push({ t: "text", s: src.slice(last, m.index) });
|
||||
if (m[1] !== undefined) out.push({ t: "code", s: m[1] });
|
||||
else if (m[2] !== undefined) out.push({ t: "b", s: m[2] });
|
||||
else out.push({ t: "i", s: m[3]! });
|
||||
last = m.index! + m[0].length;
|
||||
}
|
||||
if (last < src.length) out.push({ t: "text", s: src.slice(last) });
|
||||
return out;
|
||||
}
|
||||
|
||||
export function parseMarkdown(md: string): Block[] {
|
||||
const lines = md.replace(/\r\n?/g, "\n").split("\n");
|
||||
const blocks: Block[] = [];
|
||||
let para: string[] = [];
|
||||
let quote: string[] = [];
|
||||
let list: { t: "ul" | "ol"; items: string[] } | null = null;
|
||||
const flush = () => {
|
||||
if (para.length) blocks.push({ t: "p", inl: parseInline(para.join(" ")) });
|
||||
if (quote.length) blocks.push({ t: "quote", inl: parseInline(quote.join(" ")) });
|
||||
if (list) blocks.push({ t: list.t, items: list.items.map(parseInline) });
|
||||
para = [];
|
||||
quote = [];
|
||||
list = null;
|
||||
};
|
||||
for (const raw of lines) {
|
||||
const line = raw.trimEnd();
|
||||
let m: RegExpMatchArray | null;
|
||||
if (!line.trim()) flush();
|
||||
else if ((m = line.match(/^(#{1,3})\s+(.*)$/))) {
|
||||
flush();
|
||||
blocks.push({ t: "h", level: m[1]!.length as 1 | 2 | 3, inl: parseInline(m[2]!) });
|
||||
} else if (/^-{3,}$/.test(line)) {
|
||||
flush();
|
||||
blocks.push({ t: "hr" });
|
||||
} else if ((m = line.match(/^!\[([^\]]*)\]\(([^)]+)\)$/))) {
|
||||
flush();
|
||||
blocks.push({ t: "img", alt: m[1]!, src: m[2]! });
|
||||
} else if ((m = line.match(/^>\s?(.*)$/))) {
|
||||
if (!quote.length) flush();
|
||||
quote.push(m[1]!);
|
||||
} else if ((m = line.match(/^(?:([-*])|(\d+)\.)\s+(.*)$/))) {
|
||||
const kind = m[1] ? "ul" : "ol";
|
||||
if (!list || list.t !== kind) {
|
||||
flush();
|
||||
list = { t: kind, items: [] };
|
||||
}
|
||||
list.items.push(m[3]!);
|
||||
} else if (list && /^\s+\S/.test(raw)) {
|
||||
list.items[list.items.length - 1] += " " + line.trim(); // Fortsetzungszeile eines Listenpunkts
|
||||
} else {
|
||||
if (quote.length || list) flush();
|
||||
para.push(line.trim());
|
||||
}
|
||||
}
|
||||
flush();
|
||||
return blocks;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { BUG_REPORT_URL, bugReportUrl } from "./bugReport";
|
||||
|
||||
describe("bugReportUrl [263]", () => {
|
||||
it("zeigt auf die Issue-Seite und trägt nur Version und Build", () => {
|
||||
const url = bugReportUrl("Version: {version}\n\nWas passiert?", "Build", { version: "1.0.0-beta.1", build: "261116.1" });
|
||||
expect(url.startsWith(`${BUG_REPORT_URL}?body=`)).toBe(true);
|
||||
const body = decodeURIComponent(url.split("?body=")[1]!);
|
||||
expect(body).toBe("Version: 1.0.0-beta.1 (Build 261116.1)\n\nWas passiert?");
|
||||
expect(new URL(url).hostname).toBe("git.openbureau.ch");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
// [263] Hilfe → „Fehler melden …“: Adresse der Issue-Seite im Gitea des Projekts, mit Version und Build vorbefüllt.
|
||||
// Bewusst nichts weiter (keine Projektdaten, kein Dateiname, keine Systemangaben): die Person ergänzt selbst.
|
||||
|
||||
import { BUILD_INFO, formatBuildInfo, type BuildInfo } from "./buildInfo";
|
||||
|
||||
export const BUG_REPORT_URL = "https://git.openbureau.ch/karim/dossier/issues/new";
|
||||
|
||||
/** `versionLine` kommt fertig übersetzt (z. B. „Version 1.0.0-beta.1 (Build 261115.1)“), `bodyTemplate` enthält `{version}`. */
|
||||
export function bugReportUrl(bodyTemplate: string, buildWord: string, info: BuildInfo = BUILD_INFO): string {
|
||||
const body = bodyTemplate.replace("{version}", formatBuildInfo(info, buildWord));
|
||||
return `${BUG_REPORT_URL}?body=${encodeURIComponent(body)}`;
|
||||
}
|
||||
Reference in new issue
Block a user