-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navigation: basic-nav-view.html running, still much to do (test, doc,…
… todos, cleanup, inclusion of other navigation and page projectors)
- Loading branch information
Dierk Koenig
committed
Jan 1, 2024
1 parent
2ff9de2
commit f859a54
Showing
9 changed files
with
211 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@import "kolibri-light-fonts.css"; | ||
@import "kolibri-light-colors.css"; | ||
@import "kolibri-base.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @module navigation/ApplicationConfig | ||
* A singleton to capture base configuration data that is needed throughout the navigation layer. | ||
*/ | ||
|
||
import {PageController} from "./pageController.js"; | ||
import {StaticPageProjector} from "./projector/page/staticPageProjector.js"; | ||
|
||
export { setResourceBaseURI, resourceBaseURI, registerSiteMap } | ||
|
||
let resourceBaseURI = "./"; | ||
const setResourceBaseURI = uri => resourceBaseURI = uri; | ||
|
||
const registerSiteMap = (parentController, navigationController, pages) => { | ||
if (!pages) return; | ||
pages.forEach(page => { | ||
const pageController = PageController(page.name, null); | ||
navigationController.addPageController(pageController); | ||
pageController.setParent(parentController); | ||
if (page.home) { | ||
navigationController.setHomeLocation(pageController); | ||
} | ||
pageController.setIconPath(page.icon ?? `${resourceBaseURI}img/icons/${page.name}.svg`); | ||
if (page.file) { | ||
StaticPageProjector( | ||
/** @type { !PageControllerType } */ pageController, | ||
document.getElementById("content"), | ||
page.file); | ||
} | ||
registerSiteMap(pageController, navigationController, page.pages); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.