Skip to content

apps desktop app

Douwe de Vries edited this page Jul 1, 2026 · 1 revision

Desktop app

Active contributors: Douwe de Vries

Purpose

The desktop app is the primary CSV Anonymizer runtime. It combines a React renderer with a Tauri shell so users can select local files, paste small samples, generate quick values, configure settings, preview transformations, and write protected output without sending standard workflow data off device.

Directory layout

Path Role
frontend/src/App.tsx Top-level React composition for input modes, error toast, theme toggle, and Local AI settings modal
frontend/src/tauri.ts Typed command wrappers around Tauri invoke calls and browser preview fallbacks
frontend/src/components Workflow views, settings UI, theme controls, preview, result, and report rendering
frontend/src/hooks Workflow orchestration, settings persistence, Local AI status, preview, and job polling
src-tauri/src/main.rs Tauri builder, managed stores, plugins, and command registration
src-tauri/src/commands Command handlers for CSV, files, jobs, settings, and Local AI
src-tauri/tauri.conf.json Window, CSP, frontend build, bundle, and product metadata

Key abstractions

Abstraction Source Notes
Input mode frontend/src/App.tsx Switches between CSV file, paste sample, and quick by data type panels.
Workflow state frontend/src/hooks/useAnonymizerWorkflow.ts Composes CSV selection, analysis, preview, job polling, settings, and Local AI status.
Command wrapper frontend/src/tauri.ts Keeps frontend command calls typed and centralized.
Tauri command src-tauri/src/commands/*.rs Validates desktop concerns and calls Rust core services.
Managed state src-tauri/src/main.rs Stores jobs, Local AI downloads, path grants, and settings.
Theme mode frontend/src/hooks/useTheme.ts Resolves system, light, or dark theme and forwards the value to Tauri.

How it works

sequenceDiagram
    participant User
    participant React as React renderer
    participant Wrapper as frontend/src/tauri.ts
    participant Tauri as Tauri command shell
    participant Core as Rust core

    User->>React: Choose mode and configure workflow
    React->>Wrapper: Call typed command wrapper
    Wrapper->>Tauri: invoke(command, args)
    Tauri->>Core: Analyze, preview, transform, or report
    Core-->>Tauri: Typed data
    Tauri-->>Wrapper: Serialized response
    Wrapper-->>React: UI state update
Loading

frontend/src/App.tsx mounts a shared header, error toast, InputModeTabs, and three mode panels. CSV mode renders AnonymizerWorkflowView, paste mode renders PasteDataWorkflowView, and quick mode renders QuickDataTypeWorkflowView. The Local AI settings modal is opened from workflows and renders LocalAiSettingsBlock.

The CSV workflow uses useAnonymizerWorkflow to connect file picking, CSV analysis, column selection, preview, preflight checks, background anonymization, settings, and Local AI readiness. Paste and quick workflows use direct command wrappers from frontend/src/tauri.ts but reuse shared components such as column selection, preview, copy output, and privacy report rendering.

Settings are split across the CSV workflow settings panel and the top-level Local AI modal. AppSettingsPanel covers overwrite behavior, output suffix, sample rows, preview rows, and remembered paths. LocalAiSettingsBlock covers the optional Ollama-backed Smart replacement configuration.

Theme handling is top level. ThemeModeToggle updates settings.themeMode, useTheme resolves system, light, or dark mode, updates document attributes and classes, and calls setAppTheme so the Tauri window theme follows the app setting.

Integration points

Entry points for modification

  • Change mode routing or top-level modal behavior in frontend/src/App.tsx.
  • Add or rename frontend command calls in frontend/src/tauri.ts, then add matching Tauri commands and DTOs.
  • Add desktop command registration through src-tauri/src/tauri_command_list.rs and src-tauri/src/main.rs.
  • Change desktop security, window, build, or bundle behavior in src-tauri/tauri.conf.json.
  • Keep long-running file transforms in background job paths instead of blocking the renderer.
  • Keep settings updates going through usePersistentSettings so local state and saved settings stay reconciled.

Key source files

File Why it matters
frontend/src/App.tsx Top-level mode switcher, theme control, footer, error toast, and Local AI modal.
frontend/src/tauri.ts Frontend command wrapper layer for settings, CSV, paste, quick, jobs, output opening, and Local AI.
src-tauri/src/main.rs Initializes Tauri state and command handlers.
src-tauri/tauri.conf.json Defines runtime configuration, CSP, frontend build command, windows, icons, and bundle metadata.
frontend/src/hooks/useAnonymizerWorkflow.ts CSV workflow state composition used by the desktop app.
frontend/src/hooks/useTheme.ts Theme resolution and Tauri theme bridge.
frontend/src/components/AppSettingsPanel.tsx Main workflow settings panel.
frontend/src/components/LocalAiSettingsBlock.tsx Local AI settings modal body.

Clone this wiki locally