import '../../database/database.dart'; import '../../l10n/strings.dart'; import '../../mews/document.dart'; import 'mews_urls.dart'; import 'page_blocks.dart'; /// The hub names every page the client provides and says what each one holds, /// so the reader has somewhere to start. Its menu is the navigation, so it /// carries no strip of its own. Future buildHubPage( Uri url, { required MewsDatabase db, required Strings strings, }) async { final bookmarks = await db.countBookmarks(); final sites = await db.countSubscriptions(); final visits = await db.countHistory(); return internalPage( url: url, title: strings.t('hub-title'), body: [ HeadingBlock(1, [MewsText(strings.t('hub-title'))]), itemList([ itemRow( href: MewsUrls.bookmarks, label: strings.t('nav-bookmarks'), note: countText(strings, bookmarks, none: 'count-bookmarks-none', one: 'count-bookmarks-one', many: 'count-bookmarks-many'), ), itemRow( href: MewsUrls.subscriptions, label: strings.t('nav-subscriptions'), note: countText(strings, sites, none: 'count-sites-none', one: 'count-sites-one', many: 'count-sites-many'), ), itemRow( href: MewsUrls.history, label: strings.t('nav-history'), note: countText(strings, visits, none: 'count-pages-none', one: 'count-pages-one', many: 'count-pages-many'), ), itemRow(href: MewsUrls.settings, label: strings.t('nav-settings')), ]), ], ); }