Skip to content

Commit

Permalink
WIP: re-adding toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethbruskiewicz committed Feb 14, 2024
1 parent 8f0d3f8 commit adcc9a5
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,23 @@ class AppConfig {
class AppContext {

dhs = {};
current_data_harmonizer = null;

constructor(appConfig) {
this.template = null;
this.appConfig = appConfig;
}

setDataHarmonizers(data_harmonizers) {
this.dhs = data_harmonizers;
// TODO finding the initial parent?
this.setCurrentDataHarmonizer(data_harmonizers['Container'].children[0]);
}

setCurrentDataHarmonizer(data_harmonizer_name) {
this.current_data_harmonizer = data_harmonizer_name;
}

// TODO: memoize?
async getTypeTree() {
return (await this.getClasses()).reduce((acc, el) => {
Expand Down Expand Up @@ -634,7 +645,7 @@ const main = async function () {
dhTabLink.setAttribute('data-bs-target', dhTabLink.href);
dhTabLink.setAttribute('role', 'tab');
dhTabLink.setAttribute('aria-controls', dhId);

dhTab.appendChild(dhTabLink);
return dhTab;
}
Expand All @@ -650,6 +661,11 @@ const main = async function () {
dhRoot.appendChild(dhSubroot); // Appending to the parent container

const dhTab = createDataHarmonizerTab(dhId, spec.name, index === 0);
dhTab.addEventListener('click', () => {
console.log('click tab', spec.name, index);
// set the current dataharmonizer tab in the context
context.setCurrentDataHarmonizer(spec.name);
})
dhTabNav.appendChild(dhTab); // Appending to the tab navigation

console.log(findSlotNamesForClass(schema, cls_key));
Expand Down Expand Up @@ -853,6 +869,7 @@ const main = async function () {
console.log('before initializeDataHarmonizers');
initializeDataHarmonizers(data_harmonizers);
// TODO assignment functions
// TODO current dataharmonizer in contexts
context.dhs = data_harmonizers;
new Toolbar(dhToolbarRoot, data_harmonizers[cls_key], menu, {
context: context,
Expand Down

0 comments on commit adcc9a5

Please sign in to comment.