MingaEditor.Dashboard (Minga v0.1.0)

Copy Markdown View Source

Dashboard home screen renderer.

Renders the editor's landing page when no file buffers are open. Shows an ASCII mountain range header, quick-action shortcuts, recent files, and a version string. All content is horizontally centered.

This is a pure rendering module: it takes dimensions, theme, and state, and returns a list of DisplayList.draw() tuples. No side effects.

Summary

Types

Command dispatched when a dashboard item is selected.

Dashboard item: an action the user can select.

Dashboard state: cursor position and computed items.

Functions

Moves the dashboard cursor down, wrapping at the bottom.

Moves the dashboard cursor up, wrapping at the top.

Returns a fresh dashboard state with quick actions and recent files.

Renders the dashboard as a list of display list draws.

Returns the command for the currently selected item, or nil if no items.

Types

command()

@type command() :: atom() | {:open_file, String.t()}

Command dispatched when a dashboard item is selected.

item()

@type item() :: %{label: String.t(), shortcut: String.t(), command: command()}

Dashboard item: an action the user can select.

state()

@type state() :: %{cursor: non_neg_integer(), items: [item()]}

Dashboard state: cursor position and computed items.

Functions

cursor_down(state)

@spec cursor_down(state()) :: state()

Moves the dashboard cursor down, wrapping at the bottom.

cursor_up(state)

@spec cursor_up(state()) :: state()

Moves the dashboard cursor up, wrapping at the top.

new_state(recent_files \\ [])

@spec new_state([String.t()]) :: state()

Returns a fresh dashboard state with quick actions and recent files.

render(width, height, theme, dash_state)

Renders the dashboard as a list of display list draws.

Lays out the mountain range header, quick actions, recent files heading, recent file entries, and a bottom-pinned version string, all horizontally centered in the given width x height area.

selected_command(map)

@spec selected_command(state()) :: command() | nil

Returns the command for the currently selected item, or nil if no items.