Skip to content
André Paul Grandsire edited this page Aug 8, 2026 · 3 revisions

Shared Types and Utils

This document describes the root-level shared types and the src/utils/ helpers.

Shared Types (src/*.ts)

Root-level files define the application's shared contracts:

  • app.types.ts - Core types (ITask, sorting option interfaces)
  • app.enums.ts - Enums (SortingField, SortingStrategy, AppSignals, CssClasses, WidgetIds)
  • app.strings.ts - Localized strings loaded through gettext
  • app.wrapper.ts - DoitApplication lifecycle and global action registration
  • app.entrypoint.ts - Application entry point

Static config (src/static/)

Static configuration grouped by domain:

  • actions.ts - ActionNames enum for Gio SimpleActions
  • settings.ts - DoItSettings and SortingModeSchema key names
  • sorting.ts - Predefined SortingFieldOptions and SortingModeOptions
  • sidebar.ts - MagicFilters, GeneralSectionItems, and the sidebar filter data key
  • tasks.ts - SymbolicIcons, task entry styles, and delete button icons
  • messages.ts - AppDebug message catalog for development logging

Stores (src/store/)

list-store.ts

Holds the app-wide task list as a Gio.ListStore<TaskItem> singleton and handles persistence.

project-store.ts

Discovers project groups from the task store and emits signals when projects change.

Utils (src/utils/)

settings.ts

Access to Gio.Settings backed by the application schema. Exposes typed getters/setters:

const settings = get_settings();
settings.get_int('window-width');
settings.set_string('sorting-mode', SortingField.byTitle);

sort.ts

Pure comparator factories for task sorting. Comparators operate on a SortableTask view:

  • create_comparator(extractors, strategy)
  • sort_by_date(strategy), sort_by_status(strategy), sort_by_title(strategy)
  • sort_by_project(strategy), sort_by_project_name(strategy)

tasks.sort.ts

Sorting preferences orchestration built on sort.ts and settings.ts:

  • sort_by(field, strategy) - builds a comparator from a SortingField
  • retrieve_sort_preferences() - reads persisted mode/strategy
  • persist_sort_preferences(field, strategy) - saves mode/strategy

log-manager.ts

Development-only logging helpers: log(), warn(), error().

application.js

Build-time generated file (via meson.build configure_file) exposing the application id, name, resource path, and template-path helpers.