use std::sync::Arc; use topcoat::{ Result, context::{Cx, app_context}, router::page, view::{Child, View}, }; use crate::app::pane::{self, ListSpec, Mobile}; use crate::i18n::{self, Msg, t}; use crate::store::{ListFilter, Store}; /// GET /unfiled: notes that are not in any notebook, beside the list. #[page] async fn unfiled(cx: &Cx) -> Result { let store = app_context::>(cx); let notebooks = store.list_notebooks().await.map_err(topcoat::Error::from_anyhow)?; let page = pane::load_page(cx, store, ListFilter::Unfiled) .await .map_err(topcoat::Error::from_anyhow)?; let lang = i18n::lang(cx); let spec = ListSpec { title: t(lang, Msg::Unfiled).to_owned(), heading: true, count: page.total, notebook_id: String::new(), groups: pane::groups(lang, &page.notes, ¬ebooks, &page.previews, None, false), empty: t(lang, Msg::EmptyUnfiled), more: page.more, }; let list = pane::list_pane(cx, lang, spec, Child::new(())); Ok(pane::split( cx, Mobile::List, Child::new(list), Child::new(pane::empty_detail(cx, lang)), )) }