Build an Android dashboard with Fission Charts

Import actual warehouse order rows and derive the queue, completion counts and charts from the same report instead of unrelated sample metrics.
Android

What you will build

Review entered order records over seven or thirty days and identify the reported work needing attention without claiming a live warehouse connection.
Validate a bounded order import before replacing the previous report
Derive queue rows and completion metrics from one authoritative record set
Keep missing completion percentages distinct from zero
Use the same selected range for written summaries and chart data, including days 28 and 29
A dashboard can look convincing whilst its totals describe different data. That is particularly easy when each card and chart starts with a separate sample array. Here, we take the opposite approach: one imported order report supplies the queue, metrics and completed-pick trend.
The warehouse lead can paste a real reporting snapshot, identify overdue work and compare seven or thirty days. The app does not claim to contact a warehouse service or persist that report. Both native and Web start empty and use the same import path.
Start from a new project (optional)

Create the project and add the target

cargo install cargo-fission
fission init android-build-an-android-dashboard-with-fission-charts
cd android-build-an-android-dashboard-with-fission-charts
fission add-target android --project-dir .
cargo add [email protected] --features charts
cargo add serde_yaml

Files created by Fission

This is the starter tree Fission generates. Keep shared app code in src/; the generated platform files handle native launch and packaging.
android-build-an-android-dashboard-with-fission-charts/
├── Cargo.toml                 # Rust package and dependencies
├── fission.toml               # app identity, targets and capabilities
├── src/
│   ├── main.rs                # generated app entrypoint
│   ├── lib.rs                 # shared app setup
│   └── app.rs                 # shared Fission screen
└── platforms/
    └── android/              # generated Android host
Keep the screen, shared state, reducers and reusable fission_component! components in the Rust project. Add a feature-specific state, service or effect module only when it gives the feature a useful boundary. The generated platform files handle native launch and packaging; shared components do not need to import platform APIs.

Run the finished example

fission run --target android --project-dir .

1. Give the warehouse team an operations home

At 8:30 each morning, the warehouse lead needs three answers before opening an order: how much work is waiting, are shipments leaving on time, and which orders need a closer look? We will build that screen for Harbour Supply, a small outdoor retailer. The report is supplied by the user and held in memory. We do not seed a different dataset into the Web preview or invent unrelated metrics.
Start with the decisions the screen supports. The metric cards summarise today's workload and the review queue names the orders that need action. In the next step, a chart adds the trend behind those totals; the summary stays visible so a reader does not have to estimate the answer from bar heights.
Paste tab-separated rows with four columns: reference, customer, days ago (0–29), and one machine status: picking, overdue, picked_on_time or picked_late. For completed rows, days ago is the completion day; for outstanding rows, it is the reporting day. This is a reporting snapshot, not a continuously advancing calendar. The parser rejects duplicates and malformed rows as one import, retaining the previous good report.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":2,"label":"src/state.rs","value":"src-state-rs"},{"index":3,"label":"src/translations.rs","value":"src-translations-rs"},{"index":4,"label":"src/lib.rs","value":"src-lib-rs"},{"index":5,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":6,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"},{"index":7,"label":"src/import.rs","value":"src-import-rs"},{"index":8,"label":"src/widgets/metric.rs","value":"src-widgets-metric-rs"},{"index":9,"label":"src/widgets/order_row.rs","value":"src-widgets-order-row-rs"},{"index":10,"label":"src/widgets/locale_picker.rs","value":"src-widgets-locale-picker-rs"},{"index":11,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
use crate::state::{OperationsDashboardState, OperationsData};
use crate::widgets::metric::OperationsMetric;
use crate::widgets::order_row::OrderReviewRow;
use crate::widgets::locale_picker::OperationsLocalePicker;
use crate::import::OrderReportImport;
use fission::prelude::*;




fission_component! {
    pub OperationsDashboard<OperationsDashboardState> {}
    view(_dashboard, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
    if let Some(data) = state.records.as_ref().map(|records| OperationsData::from_records(records)) {
        SemanticsRegion(
            identifier: Some("harbour-operations-dashboard".to_string()),
            label: Some(cx.tr("dashboard.a11y")),
            child: Container(Column(gap: tokens.spacing.l, children: [
                Row(gap: tokens.spacing.m, align_items: ir_op::AlignItems::Center, children: [
                    Column(gap: tokens.spacing.xs, children: [
                        Text(cx.tr("dashboard.brand")).weight(tokens.typography.font_weight_bold),
                        Text(cx.tr("dashboard.subtitle")).color(tokens.colors.text_secondary),
                    ]),
                    Spacer(flex_grow: 1.0),
                    OperationsLocalePicker(),
                ]),
                Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                    OperationsMetric(
                        cx.tr("metric.orders"),
                        data.orders_today.to_string(),
                        cx.tr("metric.orders.detail").replace("{count}", &data.need_picking.to_string()),
                        key: "metric-orders-today",
                    ),
                    OperationsMetric(
                        cx.tr("metric.dispatch"),
                        data.on_time_dispatch_percent.map(|value| format!("{value}%"))
                            .unwrap_or_else(|| cx.tr("metric.dispatch.unavailable")),
                        cx.tr("metric.dispatch.detail"),
                        key: "metric-on-time-dispatch",
                    ),
                    OperationsMetric(
                        cx.tr("metric.stock"),
                        data.overdue_orders.to_string(),
                        cx.tr("metric.stock.detail"),
                        key: "metric-stock-alerts",
                    ),
                ]),
                Column(gap: tokens.spacing.s, children: [
                    Text(cx.tr("orders.review.title")).weight(tokens.typography.font_weight_semibold),
                    for order in &data.review_queue {
                        OrderReviewRow(
                            order.clone(),
                            key: order.reference.clone(),
                        ).id(WidgetId::explicit(&order.reference))
                    },
                ]),
            ]))
                .padding_all(tokens.spacing.l)
                .bg(tokens.colors.background),
        )
    } else {
        EmptyState(
            title: cx.tr("dashboard.empty.title"),
            description: Some(cx.tr("dashboard.empty.description")),
        )
    }
}

fission_component! {
    pub OperationsDashboardPage<OperationsDashboardState> {}
    view(_page, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
    Container(
        Scroll(
            flex_grow: 1.0,
            height: cx.view.viewport_size().height,
            semantic_label: Some(cx.tr("dashboard.a11y")),
            child: Container(Column(gap: tokens.spacing.l, children: [
                OrderReportImport(),
                OperationsDashboard(),
            ])).padding_all(tokens.spacing.l),
        ),
    )
    .width_length(Length::percent(100.0))
    .height_length(Length::vh(100.0))
    .bg(tokens.colors.background)
}
{"id":"fission-tabs-1","index":1,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod state;
mod import;
mod widgets;
mod translations;

use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<state::OperationsDashboardState, _>::new(app::OperationsDashboardPage)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":2,"label":"src/state.rs","value":"src-state-rs"}
use std::collections::HashSet;
use fission::prelude::*;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ReportStatus { Picking, Overdue, PickedOnTime, PickedLate }

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ReportOrder {
    pub reference: String,
    pub customer: String,
    pub days_ago: u8,
    pub status: ReportStatus,
}

impl ReportOrder {
    pub fn completed(&self) -> bool {
        matches!(self.status, ReportStatus::PickedOnTime | ReportStatus::PickedLate)
    }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ImportError { pub line: usize }

pub fn parse_report(source: &str) -> Result<Vec<ReportOrder>, ImportError> {
    let mut references = HashSet::new();
    let mut records = Vec::new();
    for (index, line) in source.lines().enumerate() {
        if line.trim().is_empty() { continue; }
        let invalid = || ImportError { line: index + 1 };
        let fields: Vec<_> = line.split('\t').map(str::trim).collect();
        if fields.len() != 4 || fields[0].is_empty() || fields[1].is_empty() {
            return Err(invalid());
        }
        if !references.insert(fields[0].to_owned()) { return Err(invalid()); }
        let days_ago: u8 = fields[2].parse().map_err(|_| invalid())?;
        if days_ago >= 30 { return Err(invalid()); }
        let status = match fields[3] {
            "picking" => ReportStatus::Picking,
            "overdue" => ReportStatus::Overdue,
            "picked_on_time" => ReportStatus::PickedOnTime,
            "picked_late" => ReportStatus::PickedLate,
            _ => return Err(invalid()),
        };
        records.push(ReportOrder {
            reference: fields[0].to_owned(),
            customer: fields[1].to_owned(),
            days_ago,
            status,
        });
    }
    if records.is_empty() { return Err(ImportError { line: 1 }); }
    Ok(records)
}

#[derive(Clone, Debug, PartialEq)]
pub struct OperationsDashboardState {
    pub locale: Locale,
    pub records: Option<Vec<ReportOrder>>,
}
impl Default for OperationsDashboardState {
    fn default() -> Self {
        Self { locale: Locale::from("en-US"), records: None }
    }
}
impl GlobalState for OperationsDashboardState {}

pub struct OperationsData {
    pub orders_today: usize,
    pub need_picking: usize,
    pub on_time_dispatch_percent: Option<u32>,
    pub overdue_orders: usize,
    pub picks_7_days: Vec<f32>,
    pub picks_30_days: Vec<f32>,
    pub review_queue: Vec<ReportOrder>,
}

impl OperationsData {
    pub fn from_records(records: &[ReportOrder]) -> Self {
        let completed = records.iter().filter(|order| order.completed()).count();
        let on_time = records.iter()
            .filter(|order| order.status == ReportStatus::PickedOnTime).count();
        let mut picks_7_days = vec![0.0; 7];
        let mut picks_30_days = vec![0.0; 4];
        for order in records.iter().filter(|order| order.completed()) {
            if order.days_ago < 7 { picks_7_days[6 - usize::from(order.days_ago)] += 1.0; }
            // Oldest bucket includes days 21–29, rather than dropping two days.
            let bucket = match order.days_ago { 0..=6 => 3, 7..=13 => 2, 14..=20 => 1, _ => 0 };
            picks_30_days[bucket] += 1.0;
        }
        let mut review_queue: Vec<_> = records.iter()
            .filter(|order| !order.completed()).cloned().collect();
        review_queue.sort_by_key(|order| order.status != ReportStatus::Overdue);
        Self {
            orders_today: records.iter().filter(|order| order.days_ago == 0).count(),
            need_picking: records.iter()
                .filter(|order| order.days_ago == 0 && !order.completed()).count(),
            on_time_dispatch_percent: (completed > 0)
                .then(|| (100 * on_time / completed) as u32),
            overdue_orders: records.iter()
                .filter(|order| order.status == ReportStatus::Overdue).count(),
            picks_7_days,
            picks_30_days,
            review_queue,
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn rejects_duplicates_without_replacing_previous_records() {
        assert_eq!(parse_report("A\tMaya\t0\tpicking\nA\tElliot\t1\toverdue")
            .unwrap_err().line, 2);
    }

    #[test]
    fn thirty_day_summary_keeps_oldest_days_and_does_not_invent_dispatch_rate() {
        let records = parse_report("A\tMaya\t29\tpicked_on_time\nB\tElliot\t0\toverdue").unwrap();
        let summary = OperationsData::from_records(&records);
        assert_eq!(summary.picks_30_days.iter().sum::<f32>(), 1.0);
        assert_eq!(summary.picks_7_days.iter().sum::<f32>(), 0.0);
        assert_eq!(summary.on_time_dispatch_percent, Some(100));
        let pending = parse_report("A\tMaya\t0\tpicking").unwrap();
        assert_eq!(OperationsData::from_records(&pending).on_time_dispatch_percent, None);
    }
}
{"id":"fission-tabs-1","index":3,"label":"src/translations.rs","value":"src-translations-rs"}
use std::collections::HashMap;

use fission::prelude::*;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, source) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(source).expect("valid checked-in translations");
        env.i18n.add_bundle(TranslationBundle {
            locale: Locale::from(locale),
            messages,
        });
    }
    env
}
{"id":"fission-tabs-1","index":4,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod state;
mod import;
mod widgets;
mod translations;

use app::OperationsDashboardPage;
use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<state::OperationsDashboardState, _>::new(OperationsDashboardPage)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .run()
}

#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<state::OperationsDashboardState, OperationsDashboardPage> {
    let app = MobileApp::<state::OperationsDashboardState, _>::new(OperationsDashboardPage)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); });
    #[cfg(all(target_os = "android", debug_assertions))]
    let app = app.with_test_control_port(48761);
    app
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
    mobile_app().run()
}

#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
    let _ = mobile_app().run_with_android_app(app_handle);
}

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<state::OperationsDashboardState, _>::new(OperationsDashboardPage)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":5,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
import.title: "Import an order report"
import.label: "Tab-separated report"
import.help: "Reference, customer, days ago (0–29), status. One order per line."
import.action: "Apply report"
import.invalid: "Check line {line}: four tab-separated fields, a unique reference, a day from 0 to 29 and a supported status are required. Previous data is unchanged."
orders.status.picked: "Picked"
orders.detail.overdue: "Dispatch deadline has passed; review this order first."
orders.detail.picking: "Picking is outstanding."
chart.day.ago: "{day} days ago"
language.english: "English"
language.spanish: "Spanish"
dashboard.a11y: "Harbour Supply warehouse fulfilment dashboard"
dashboard.brand: "Harbour Supply"
dashboard.subtitle: "Fulfilment · Main warehouse · Morning shift"
dashboard.empty.title: "Warehouse data is not available yet"
dashboard.empty.description: "Connect the order service to review today's picks and dispatch risks."
metric.orders: "Records dated today"
metric.orders.detail: "{count} still need picking"
metric.dispatch: "On-time dispatch"
metric.dispatch.detail: "Of completed orders in this report"
metric.dispatch.unavailable: "Not available"
metric.stock: "Overdue orders"
metric.stock.count: "{count} items"
metric.stock.detail: "Review these before the remaining queue"
orders.review.title: "Orders to review"
orders.status.picking: "Picking"
orders.status.at_risk: "At risk"
orders.detail.stove: "Trail stove · 2 items · dispatch by 9:15"
orders.detail.filter: "Water filter · 1 item · waiting for stock"
chart.title: "Completed picks"
chart.a11y: "Harbour Supply completed picks by day or week"
chart.heading: "Completed picks"
chart.subtitle: "Warehouse orders picked over {period}"
chart.series.picks: "Orders picked"
chart.period.week1: "21–29 days ago"
chart.period.week2: "14–20 days ago"
chart.period.week3: "7–13 days ago"
chart.period.week4: "0–6 days ago"
chart.day.mon: "Mon"
chart.day.tue: "Tue"
chart.day.wed: "Wed"
chart.day.thu: "Thu"
chart.day.fri: "Fri"
chart.day.sat: "Sat"
chart.day.sun: "Sun"
chart.range.7: "7 days"
chart.range.30: "30 days"
chart.total: "{count} orders"
chart.summary: "The team picked {count} orders during this period."
{"id":"fission-tabs-1","index":6,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
import.title: "Importar un informe de pedidos"
import.label: "Informe separado por tabulaciones"
import.help: "Referencia, cliente, días atrás (0–29), estado. Un pedido por línea."
import.action: "Aplicar informe"
import.invalid: "Revisa la línea {line}: hacen falta cuatro campos, una referencia única, un día de 0 a 29 y un estado válido. Los datos anteriores no cambian."
orders.status.picked: "Preparado"
orders.detail.overdue: "El plazo de envío ha pasado; revisa primero este pedido."
orders.detail.picking: "La preparación está pendiente."
chart.day.ago: "Hace {day} días"
language.english: "Inglés"
language.spanish: "Español"
dashboard.a11y: "Panel de preparación de pedidos de Harbour Supply"
dashboard.brand: "Harbour Supply"
dashboard.subtitle: "Preparación · Almacén principal · Turno de mañana"
dashboard.empty.title: "Los datos del almacén aún no están disponibles"
dashboard.empty.description: "Conecta el servicio de pedidos para revisar la preparación y los riesgos de envío de hoy."
metric.orders: "Registros de hoy"
metric.orders.detail: "Aún falta preparar {count}"
metric.dispatch: "Envíos a tiempo"
metric.dispatch.detail: "De los pedidos completados en este informe"
metric.dispatch.unavailable: "No disponible"
metric.stock: "Pedidos vencidos"
metric.stock.count: "{count} artículos"
metric.stock.detail: "Revísalos antes del resto de la cola"
orders.review.title: "Pedidos por revisar"
orders.status.picking: "En preparación"
orders.status.at_risk: "En riesgo"
orders.detail.stove: "Hornillo de montaña · 2 artículos · envío antes de las 9:15"
orders.detail.filter: "Filtro de agua · 1 artículo · pendiente de existencias"
chart.title: "Pedidos preparados"
chart.a11y: "Pedidos preparados por Harbour Supply por día o semana"
chart.heading: "Pedidos preparados"
chart.subtitle: "Pedidos preparados durante {period}"
chart.series.picks: "Pedidos preparados"
chart.period.week1: "Hace 21–29 días"
chart.period.week2: "Hace 14–20 días"
chart.period.week3: "Hace 7–13 días"
chart.period.week4: "Hace 0–6 días"
chart.day.mon: "Lun"
chart.day.tue: "Mar"
chart.day.wed: "Mié"
chart.day.thu: "Jue"
chart.day.fri: "Vie"
chart.day.sat: "Sáb"
chart.day.sun: "Dom"
chart.range.7: "7 días"
chart.range.30: "30 días"
chart.total: "{count} pedidos"
chart.summary: "El equipo preparó {count} pedidos durante este periodo."
{"id":"fission-tabs-1","index":7,"label":"src/import.rs","value":"src-import-rs"}
use fission::prelude::*;
use crate::state::{parse_report, OperationsDashboardState};

fission_component! {
    pub OrderReportImport<OperationsDashboardState> {
        state {
            source: String = String::new(),
            invalid_line: Option<usize> = None,
        }
    }
    view(import, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
    Column(gap: tokens.spacing.s, children: [
        Text(cx.tr("import.title")).size(tokens.typography.heading2_size),
        TextInput(
            label: Some(cx.tr("import.label").into()),
            helper_text: Some(cx.tr("import.help").into()),
            bind: import.source,
            multiline: true,
            semantics_identifier: "harbour.import.source".to_string(),
        ),
        Button(
            child: Text(cx.tr("import.action")),
            key: "import-report",
            on_press: reduce {
                match parse_report(&import.source) {
                    Ok(records) => {
                        state.records = Some(records);
                        import.invalid_line = None;
                    }
                    Err(error) => import.invalid_line = Some(error.line),
                }
            },
        ).semantics_identifier("harbour.import.apply"),
        if let Some(line) = import.invalid_line {
            Text(cx.tr("import.invalid").replace("{line}", &line.to_string()))
                .color(tokens.colors.error)
        },
    ])
}
{"id":"fission-tabs-1","index":8,"label":"src/widgets/metric.rs","value":"src-widgets-metric-rs"}
use fission::prelude::*;

fission_component! {
    pub OperationsMetric<()> {
        props { label: String, value: String, detail: String }
    }
    view(metric, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
    Container(Column(gap: tokens.spacing.xs, children: [
        Text(metric.label.clone()).color(tokens.colors.text_secondary),
        Text(metric.value.clone()).weight(tokens.typography.font_weight_bold),
        Text(metric.detail.clone()).color(tokens.colors.text_secondary),
    ]))
    .padding_all(tokens.spacing.m)
    .bg(tokens.colors.surface)
    .border(tokens.colors.border, 1.0)
    .border_radius(tokens.radii.medium)
}
{"id":"fission-tabs-1","index":9,"label":"src/widgets/order_row.rs","value":"src-widgets-order-row-rs"}
use fission::prelude::*;
use crate::state::{ReportOrder, ReportStatus};

fission_component! {
    pub OrderReviewRow<()> {
        props { order: ReportOrder }
    }
    view(order, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let status = match &order.order.status {
            ReportStatus::Picking => cx.tr("orders.status.picking"),
            ReportStatus::Overdue => cx.tr("orders.status.at_risk"),
            ReportStatus::PickedOnTime | ReportStatus::PickedLate => cx.tr("orders.status.picked"),
        };
    } =>
    SemanticsRegion(
        identifier: Some(order.order.reference.clone()),
        label: Some(format!("{} · {} · {} · {}", order.order.reference, order.order.customer, status, cx.tr(if order.order.status == ReportStatus::Overdue { "orders.detail.overdue" } else { "orders.detail.picking" }))),
        child: Container(Column(gap: tokens.spacing.xs, children: [
            Row(gap: tokens.spacing.s, wrap: ir_op::FlexWrap::Wrap, children: [
                Text(order.order.reference.clone()).weight(tokens.typography.font_weight_semibold),
                Text(order.order.customer.clone()).color(tokens.colors.text_secondary),
                Spacer(flex_grow: 1.0),
                Badge(text: status.clone()),
            ]),
            Text(cx.tr(if order.order.status == ReportStatus::Overdue { "orders.detail.overdue" } else { "orders.detail.picking" })).color(tokens.colors.text_secondary),
        ]))
            .padding_all(tokens.spacing.m)
            .bg(tokens.colors.surface)
            .border(tokens.colors.border, 1.0)
            .border_radius(tokens.radii.medium),
    )
}
{"id":"fission-tabs-1","index":10,"label":"src/widgets/locale_picker.rs","value":"src-widgets-locale-picker-rs"}
use fission::prelude::*;
use crate::state::OperationsDashboardState;
use fission::i18n::Locale;

fission_component! {
    pub OperationsLocalePicker<OperationsDashboardState> {}
    view(_picker, state, cx) =>
    Row(gap: cx.view.env().theme.tokens.spacing.xs, children: [
        Button(
            child: Text(cx.tr("language.english")),
            key: "locale-en-US",
            variant: if state.locale == Locale::from("en-US") { ButtonVariant::Primary } else { ButtonVariant::Outline },
            on_press: reduce { state.locale = Locale::from("en-US"); },
        ).semantics_identifier("harbour.locale.en-US"),
        Button(
            child: Text(cx.tr("language.spanish")),
            key: "locale-es-ES",
            variant: if state.locale == Locale::from("es-ES") { ButtonVariant::Primary } else { ButtonVariant::Outline },
            on_press: reduce { state.locale = Locale::from("es-ES"); },
        ).semantics_identifier("harbour.locale.es-ES"),
    ])
}
{"id":"fission-tabs-1","index":11,"label":"src/widgets/mod.rs","value":"src-widgets-mod-rs"}
pub mod metric;
pub mod order_row;
pub mod locale_picker;
{"id":"fission-tabs-1"}
Paste these rows from a spreadsheet or use literal tabs between their four fields:
HS-2048	Maya Chen	0	picking
HS-2051	Elliot Park	0	overdue
HS-2030	Alex Rivera	2	picked_on_time
HS-2010	Robin Patel	29	picked_late
Apply the report. The overdue order should appear first, the report should contain two records dated today, and the on-time rate should be 50% of the two completed records. Submit a duplicate reference; the error must leave the previous report intact.
Show the app preview
Hide the app preview

2. Build an Android dashboard with Fission Charts

Choose the chart from the decision it needs to support. The warehouse lead wants to compare completed picks over time, so a bar chart is a useful first view. The 7 days and 30 days controls change the selected window and update both the chart and its text summary from the dashboard data in GlobalState. The same imported records supply both ranges. Four equal seven-day buckets would only cover twenty-eight days, so the oldest thirty-day bucket explicitly includes days 21–29. Its nine-day count is not directly comparable as a per-day rate with the other seven-day buckets; the labels expose that distinction.
Keeping the filter in this chart component's retained local state is appropriate because no other screen reads it. When the app is connected to a service, load the selected range through an effect and model loading and failure separately from the empty state. This example renders the empty state when dashboard data is absent. Fission Charts supplies axis labels, a legend and tooltips, while the separate summary gives the total without asking someone to estimate bar heights. See the Fission Charts reference for other chart types and interactions.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/analytics.rs","value":"src-analytics-rs"},{"index":1,"label":"src/lib.rs","value":"src-lib-rs"},{"index":2,"label":"preview/lib.rs","value":"preview-lib-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/analytics.rs","value":"src-analytics-rs"}
use crate::state::{OperationsDashboardState, OperationsData};
use crate::import::OrderReportImport;
use fission::prelude::*;
use fission::charts::axis::AxisType;
use fission::charts::{Axis, BarSeries, Chart, Legend, Tooltip};

fission_component! {
    pub FulfilmentTrend<OperationsDashboardState> {
        props { width: f32 }
        state { thirty_days: bool = false }
    }
    view(trend, state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let trend_data = state.records.as_ref().map(|records| {
            let data = OperationsData::from_records(records);
            let (labels, picks) = if trend.thirty_days {
                (
                    vec![cx.tr("chart.period.week1"), cx.tr("chart.period.week2"), cx.tr("chart.period.week3"), cx.tr("chart.period.week4")],
                    data.picks_30_days.clone(),
                )
            } else {
                (
                    (0..7).rev().map(|day| cx.tr("chart.day.ago").replace("{day}", &day.to_string())).collect::<Vec<_>>(),
                    data.picks_7_days.clone(),
                )
            };
            let total = picks.iter().sum::<f32>().round() as u32;
            let period = cx.tr(if trend.thirty_days { "chart.range.30" } else { "chart.range.7" });
            let chart_title = cx.tr("chart.title");
            let picks_label = cx.tr("chart.series.picks");
            let chart: Widget = Chart::new()
                .width(trend.width)
                .height(320.0)
                .title(&chart_title)
                .x_axis(Axis {
                    axis_type: AxisType::Category,
                    data: labels,
                    name: None,
                    min: None,
                    max: None,
                    boundary_gap: true,
                    inverse: false,
                    split_line: true,
                    label_rotate: None,
                })
                .y_axis(Axis::value())
                .legend(Legend::top_right())
                .tooltip(Tooltip::axis_trigger())
                .series(vec![BarSeries::new(&picks_label).data(picks).into()])
                .into();
            (total, period, chart)
        });
    } =>
    if let Some((total, period, chart)) = trend_data {
        SemanticsRegion(
            identifier: Some("harbour-completed-picks-trend".to_string()),
            label: Some(cx.tr("chart.a11y")),
            child: Container(Column(gap: tokens.spacing.m, children: [
                Row(gap: tokens.spacing.m, align_items: ir_op::AlignItems::Center, children: [
                    Column(gap: tokens.spacing.xs, children: [
                        Text(cx.tr("chart.heading")).weight(tokens.typography.font_weight_semibold),
                        Text(cx.tr("chart.subtitle").replace("{period}", &period))
                            .color(tokens.colors.text_secondary),
                    ]),
                    Spacer(flex_grow: 1.0),
                    Badge(text: cx.tr("chart.total").replace("{count}", &total.to_string())),
                ]),
                Row(gap: tokens.spacing.s, children: [
                    Button(
                        child: Text(cx.tr("chart.range.7")),
                        key: "range-seven-days",
                        variant: if trend.thirty_days { ButtonVariant::Outline } else { ButtonVariant::Primary },
                        on_press: reduce { trend.thirty_days = false; },
                    ).semantics_identifier("harbour.range.7-days"),
                    Button(
                        child: Text(cx.tr("chart.range.30")),
                        key: "range-thirty-days",
                        variant: if trend.thirty_days { ButtonVariant::Primary } else { ButtonVariant::Outline },
                        on_press: reduce { trend.thirty_days = true; },
                    ).semantics_identifier("harbour.range.30-days"),
                ]),
                chart,
                Text(cx.tr("chart.summary").replace("{count}", &total.to_string()))
                    .color(tokens.colors.text_secondary),
            ]))
                .padding_all(tokens.spacing.l)
                .bg(tokens.colors.surface)
                .border(tokens.colors.border, 1.0)
                .border_radius(tokens.radii.large),
        )
    } else {
        EmptyState(
            title: cx.tr("dashboard.empty.title"),
            description: Some(cx.tr("dashboard.empty.description")),
        )
    }
}

fission_component! {
    pub FulfilmentDashboard<OperationsDashboardState> {}
    view(_dashboard, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let chart_width = (cx.view.viewport_size().width - tokens.spacing.l * 4.0).max(1.0);
    } =>
    Container(
        Scroll(
            flex_grow: 1.0,
            height: cx.view.viewport_size().height,
            semantic_label: Some(cx.tr("dashboard.a11y")),
            child: Container(Column(gap: tokens.spacing.m, children: [
                OrderReportImport(),
                crate::app::OperationsDashboard,
                FulfilmentTrend(chart_width),
            ])).padding_all(tokens.spacing.l),
        ),
    )
    .width_length(Length::percent(100.0))
    .height_length(Length::vh(100.0))
    .bg(tokens.colors.background)
}
{"id":"fission-tabs-1","index":1,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod state;
mod import;
mod widgets;
mod analytics;
mod translations;

use analytics::FulfilmentDashboard;
use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<state::OperationsDashboardState, _>::new(FulfilmentDashboard)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .run()
}

#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<state::OperationsDashboardState, FulfilmentDashboard> {
    let app = MobileApp::<state::OperationsDashboardState, _>::new(FulfilmentDashboard)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); });
    #[cfg(all(target_os = "android", debug_assertions))]
    let app = app.with_test_control_port(48761);
    app
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
    mobile_app().run()
}

#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
    let _ = mobile_app().run_with_android_app(app_handle);
}

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<state::OperationsDashboardState, _>::new(FulfilmentDashboard)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":2,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod state;
mod import;
mod widgets;
mod translations;
mod analytics;
use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<state::OperationsDashboardState, _>::new(analytics::FulfilmentDashboard)
        .with_env(translations::create_env())
        .with_sync_env(|state, env| { env.locale = state.locale.clone(); })
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
Import the same four rows in this stage. Seven days includes one completed pick; thirty days includes both, including day 29 in the oldest bucket. Change only the language and confirm the record values stay unchanged whilst chart labels, summaries and controls translate.
Show the app preview
Hide the app preview

3. Verify the dashboard on Android

Run the finished screen in an emulator at a narrow phone size, then rotate or resize it and repeat the same check. The summary should match the selected chart range, order details should wrap without hiding their status, and the chart should remain readable when its labels get longer. This example renders an empty state when no dashboard data exists. Before connecting a service, add and test separate loading and service-error states so a slow or failed request is not presented as an empty warehouse.
The chart filter is local presentation state. Keep shared date filters in GlobalState only if another route reads them; when the range needs a server query, dispatch an effect and preserve the last successful summary while the new range loads.
From the generated project root, run the app and confirm the Android host starts before making a release build:
fission doctor android --project-dir .
fission run --target android --project-dir .
fission test --target android --project-dir .
cargo test
fission build --target android --project-dir . --release
fission doctor reports missing Android tools, fission run launches the selected emulator or connected device, and fission test checks that the generated host can start. These commands check the Rust app and Android package; they do not replace a visual check at each window size.
Use these references when you want to change the chart or move the selected range into shared app state: