# quixelation/schulm-dlejena-tools architecture

> Architecture diagram of the GitHub repository quixelation/schulm-dlejena-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quixelation/schulm-dlejena-tools
- Repository: https://github.com/quixelation/schulm-dlejena-tools

## Overview

This project is a browser extension specifically designed to enhance the Moodle™ system used by Jena’s schools. It provides a set of features such as dashboard design improvements, a todo manager, and custom course management functionalities. The extension is built in a modular way using modern front-end technologies (e.g., Svelte for the popup and settings UIs) and standard build tools (Rollup, npm) to bundle and deploy its diverse functionalities.

##### Project Type & Purpose
- This is a browser extension aimed at improving the user experience of Moodle™ for school-related tasks.
- The extension integrates several functions such as dashboard customization, a todo list (Todomanager), course topic management, auto-downloads, and additional UI enhancements.
- It bridges the browser’s native extension APIs and the Moodle system through injected scripts and a background layer.

##### Analysis of the File Structure
- Key directories include:
- “src/background” – Contains the background script responsible for managing long-lived operations and internal communications.
- “src/content-renderer” – Contains scripts injected into the Moodle webpage that adjust page elements and UI behaviors.
- “src/popup” – Houses the UI components for the extension’s popup, built with Svelte. This part includes various UI components, components pages like “Info.svelte” or “home.svelte”, and utility modules for communication.
- “src/settings” – Contains the settings page components and logic.
- “src/manager” – Implements core business logic for features like dashboard adjustments, course progress alterations, command palettes, and more.
- “src/todoManager” – Implements the todo list functionality integrated within the extension.
- “assets” – Contains design assets (design files, posters, and UI design elements) to be used in the extension.
- “page” – Appears to be used for an additional page (possibly for external management or a separate web deployment) which interfaces with the extension.
- Other files like “dist”, “package.json”, and configuration files (e.g., Rollup, ESLint, Prettier, GitHub workflows) indicate the build, testing, and deployment configurations.

##### High-Level Components and Their Interactions
- Background Component: Acts as the central mediator for communication (handling messaging between the extension UI, content scripts, and external APIs like Todoist).
- Popup & Settings UIs: Built with Svelte and assembled through Rollup, they provide the frontend user interfaces for settings, user interactions, and additional controls. The popup connects to the background script to fetch or send data.
- Manager Modules: These handle core business logic, such as processing course data, handling downloads, and managing user commands.
- Todo Manager & Todoist OAuth: Separate modules for managing the todo list and interfacing with external systems (like Todoist). They also include communication logic encapsulated in separate directories/files.

##### Architectural Patterns & Design Principles
- Modular Architecture: The project separates concerns clearly into background scripts, content scripts, popup/setting UIs, and business logic (managers). This modularization supports maintainability and scalability.
- Component-Based UI: The use of Svelte enables a component-based design for the popup and settings pages.
- Clear Separation of Concerns: For example, the "manager" directory gathers various functionality modules (commands, navigation, course progress) away from the UI layers.
- Build & Deployment Pipeline: The setup of multiple GitHub workflows for code analysis, build, and artifact handling (as seen in the “.github/workflows” directory) emphasizes continuous integration and structured deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "Extension UI Components"
        PopUI["Popup UI (Svelte)"]:::ui
        SetUI["Settings UI (Svelte)"]:::ui
    end

    %% Background Layer
    subgraph "Background Layer"
        BG["Background Script"]:::service
    end

    %% Business Logic
    subgraph "Business Logic"
        Manager["Manager Modules (Core Business Logic)"]:::business
    end

    %% Content Scripts
    subgraph "Content Scripts"
        Content["Content Renderer"]:::content
    end

    %% Todo Services
    subgraph "Todo Services"
        TodoMan["Todo Manager"]:::todo
        TodoOAuth["Todoist OAuth Integration"]:::todo
    end

    %% External Systems
    Moodle["Moodle System"]:::external
    TodoistAPI["Todoist API"]:::external

    %% Connections: UI to Background
    PopUI -->|"message_passing"| BG
    SetUI -->|"message_passing"| BG

    %% Connections: Background to Content and Business Logic
    BG -->|"script_injection"| Content
    BG -->|"delegate_logic"| Manager

    %% Connections: Content Renderer modifying Moodle
    Content -->|"DOM_modification"| Moodle

    %% Connections: Business Logic to Todo Services
    Manager -->|"manage_todos"| TodoMan
    Manager -->|"handle_auth"| TodoOAuth

    %% Connection: Todoist OAuth to Todoist API
    TodoOAuth -->|"API_calls"| TodoistAPI

    %% Click Events
    click BG "https://github.com/quixelation/schulm-dlejena-tools/blob/master/src/background/background.ts"
    click Content "https://github.com/quixelation/schulm-dlejena-tools/tree/master/src/content-renderer/"
    click PopUI "https://github.com/quixelation/schulm-dlejena-tools/tree/master/src/popup/"
    click SetUI "https://github.com/quixelation/schulm-dlejena-tools/tree/master/src/settings/"
    click Manager "https://github.com/quixelation/schulm-dlejena-tools/tree/master/src/manager/"
    click TodoMan "https://github.com/quixelation/schulm-dlejena-tools/tree/master/src/todoManager/"
    click TodoOAuth "https://github.com/quixelation/schulm-dlejena-tools/blob/master/src/todoist-oauth/index.ts"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef service fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef content fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef business fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef todo fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
