From f859a54ea123a095f5dbf49610db1290ac8c3d1c Mon Sep 17 00:00:00 2001 From: Dierk Koenig Date: Mon, 1 Jan 2024 22:43:25 +0100 Subject: [PATCH] navigation: basic-nav-view.html running, still much to do (test, doc, todos, cleanup, inclusion of other navigation and page projectors) --- docs/css/kolibri-base-light.css | 3 + docs/src/allTests.html | 2 +- docs/src/examples/navigation/basic-nav-app.js | 74 ++---- .../examples/navigation/basic-nav-view.html | 18 +- .../kolibri/navigation/applicationConfig.js | 32 +++ .../kolibri/navigation/pageControllerTest.js | 3 +- docs/src/kolibri/navigation/pageModel.js | 3 +- .../dashboardNavigationProjector.css | 228 +++++++++++------- .../dashboard/dashboardNavigationProjector.js | 2 +- 9 files changed, 211 insertions(+), 154 deletions(-) create mode 100644 docs/css/kolibri-base-light.css create mode 100644 docs/src/kolibri/navigation/applicationConfig.js diff --git a/docs/css/kolibri-base-light.css b/docs/css/kolibri-base-light.css new file mode 100644 index 00000000..fb56a11f --- /dev/null +++ b/docs/css/kolibri-base-light.css @@ -0,0 +1,3 @@ +@import "kolibri-light-fonts.css"; +@import "kolibri-light-colors.css"; +@import "kolibri-base.css"; diff --git a/docs/src/allTests.html b/docs/src/allTests.html index 518c92e7..ce53bfb6 100644 --- a/docs/src/allTests.html +++ b/docs/src/allTests.html @@ -12,7 +12,7 @@

All Tests Report

-

1332 test(s) expected.

+

1391 test(s) expected.

Check console for possible errors.

diff --git a/docs/src/examples/navigation/basic-nav-app.js b/docs/src/examples/navigation/basic-nav-app.js index eb55139b..e623c181 100644 --- a/docs/src/examples/navigation/basic-nav-app.js +++ b/docs/src/examples/navigation/basic-nav-app.js @@ -1,57 +1,33 @@ -import {PageController} from "../../kolibri/navigation/pageController.js"; -import {StaticPageProjector} from "../../kolibri/navigation/projector/page/staticPageProjector.js"; -import {NavigationController} from "../../kolibri/navigation/navigationController.js"; -import {NavigationProjector} from "../../kolibri/navigation/projector/basicNavigationProjector.js"; -import {DashboardRefinedProjector} from "../../kolibri/navigation/projector/dashboard/dashboardNavigationProjector.js"; +import {NavigationController} from "../../kolibri/navigation/navigationController.js"; +import {DashboardRefinedProjector} from "../../kolibri/navigation/projector/dashboard/dashboardNavigationProjector.js"; +import {registerSiteMap, resourceBaseURI, setResourceBaseURI} from "../../kolibri/navigation/applicationConfig.js"; -// pages that will be displayed as content - -const homePageController = PageController("home", null); -homePageController.setIconPath('../../../img/icons/house.svg'); -StaticPageProjector( - /** @type { !PageControllerType } */ homePageController, - document.getElementById("content"), - './pages/static/home.html'); - - -const aboutPageController = PageController("about", null); -aboutPageController.setIconPath('../../../img/icons/cute-robot.svg'); -StaticPageProjector( - aboutPageController, - document.getElementById("content"), - './pages/static/about.html'); - -// navigation +// where all the resources reside relative to the home URL. +setResourceBaseURI("../../../"); const navigationController = NavigationController(); -navigationController.setWebsiteLogo('../../../img/logo/logo.svg'); +navigationController.setWebsiteLogo(resourceBaseURI + 'img/logo/logo.svg'); navigationController.setWebsiteName('Basic Navigation'); - +// this must come first since the nav registrations triggers the repaint DashboardRefinedProjector(navigationController, document.getElementById("nav")); -navigationController.addPageControllers( - homePageController, - aboutPageController +registerSiteMap(null /* no parent at start */, navigationController, + [ + { + name: "all", + icon: resourceBaseURI + "img/icons/house.svg", // override naming convention + pages: [ + { + name: "home", + file: './pages/static/home.html', + home: true, + }, + { + name: "about", + file: './pages/static/about.html' + }, + ] + } + ] ); - -navigationController.setHomeLocation(homePageController); - -// for later: more visualizations of the navigation -// const pinToBreadCrumbElement = document.getElementById('bread-crumbs'); -// BreadCrumbProjector(navigationController, pinToBreadCrumbElement); - - -/** - * If you'd like you can add our debugger below to your application to observe and alter some of your pages attributes - */ - -// const pinToDebugElement = document.getElementById("debug"); -// -// const debugPageController = PageController("debug", null); -// debugPageController.setIconPath('./pages/icons/bug.svg'); -// debugPageController.setVisible(false); -// DebugPageProjector(navigationController, debugPageController, pinToDebugElement); -// navigationController.addPageControllers(debugPageController); -// navigationController.setDebugMode(true); - diff --git a/docs/src/examples/navigation/basic-nav-view.html b/docs/src/examples/navigation/basic-nav-view.html index 73420922..81078807 100644 --- a/docs/src/examples/navigation/basic-nav-view.html +++ b/docs/src/examples/navigation/basic-nav-view.html @@ -8,26 +8,16 @@ - - - + + + + -