feat: add a hub for the client's own pages and gate mews:do action links
This commit is contained in:
parent
df705d831f
commit
b311b9f7dd
21 changed files with 966 additions and 404 deletions
53
app/lib/application/pages/hub_page.dart
Normal file
53
app/lib/application/pages/hub_page.dart
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
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<MewsPage> 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')),
|
||||
]),
|
||||
],
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue