dashboard.rs 26 lignes · 1197 octets
//! Dashboard card factory for the admin dashboard injection point.
//!
//! Returns a [`rustwarden_core::dashboard::DashboardCardDTO`] that the application merges into the
//! admin dashboard via `RustwardenBuilder::add_dashboard_card`. Keeps
//! the federation card self-described so `rustwarden-ui` no longer
//! needs to know federation exists.

use rustwarden_core::dashboard::DashboardCardDTO;

/// Returns the federation card to inject into the admin dashboard.
///
/// The `title_key` and `desc_key` fields point at i18n keys resolved
/// at render time (`admin.dashboard.fediverse_card_title` and
/// `admin.dashboard.fediverse_card_desc`), so the card stays localized
/// without coupling this crate to a specific locale. The `href` lands
/// on the federation hub (`/admin/fediverse`) which presents the six
/// admin sub-sections; previous direct deep-link to `settings` was
/// replaced when the hub landed.
pub fn dashboard_card() -> DashboardCardDTO {
    DashboardCardDTO {
        title_key: "admin.dashboard.fediverse_card_title".into(),
        desc_key: "admin.dashboard.fediverse_card_desc".into(),
        href: "/admin/fediverse".into(),
        icon: "🌐".into(),
    }
}