dashboard.rs 28 lignes · 1175 octets
//! Dashboard extension surface used by companion crates.
//!
//! The admin dashboard rendered by `rustwarden-ui` accepts a list of
//! `DashboardCardDTO` entries injected via Axum `Extension`. Companion
//! crates (e.g. `rustwarden-fediverse-ui`) build a card and the
//! consumer application registers it through
//! `RustwardenBuilder::add_dashboard_card`. Living in
//! `rustwarden-core` keeps the type available to the builder without
//! creating a `rustwarden-core → rustwarden-ui` cycle.

use serde::Serialize;

/// A single card displayed at the bottom of the admin dashboard.
///
/// The two `*_key` fields are i18n lookup keys resolved at render time
/// against the active locale, so a card stays correctly localized
/// without requiring callers to pre-translate.
#[derive(Clone, Debug, Serialize)]
pub struct DashboardCardDTO {
    /// i18n key for the card title (resolved at render time).
    pub title_key: String,
    /// i18n key for the card description (resolved at render time).
    pub desc_key: String,
    /// Target URL the card links to.
    pub href: String,
    /// Display icon (emoji, heroicon name or daisyui token).
    pub icon: String,
}