diff --git a/src/renderer/src/stories/Main.js b/src/renderer/src/stories/Main.js index 172c036b8..9a68987cd 100644 --- a/src/renderer/src/stories/Main.js +++ b/src/renderer/src/stories/Main.js @@ -1,7 +1,6 @@ import { LitElement, html } from "lit"; import useGlobalStyles from "./utils/useGlobalStyles.js"; import { GuidedFooter } from "./pages/guided-mode/GuidedFooter"; -import { GuidedCapsules } from "./pages/guided-mode/GuidedCapsules.js"; import { GuidedHeader } from "./pages/guided-mode/GuidedHeader.js"; import { unsafeHTML } from "lit/directives/unsafe-html.js"; @@ -131,7 +130,6 @@ export class Main extends LitElement { let footer = page?.footer; // Page-specific footer let header = page?.header; // Page-specific header - let capsules = page?.capsules; // Page-specific capsules if (page) { this.to = page.to; @@ -160,24 +158,9 @@ export class Main extends LitElement { if (footer === true) footer = {}; if (footer && "onNext" in footer && !("next" in footer)) footer.next = "Next"; - // Default Capsules Behavior + // Define header states const section = sections[info.section]; if (section) { - if (capsules === true || !("capsules" in page)) { - let pages = Object.values(section.pages); - const pageIds = Object.keys(section.pages); - if (pages.length > 1) { - const capsulesProps = { - n: pages.length, - skipped: pages.map((page) => page.skipped), - selected: pages.map((page) => page.pageLabel).indexOf(page.info.label), - }; - - capsules = new GuidedCapsules(capsulesProps); - capsules.onClick = (i) => this.toRender.page.to(pageIds[i]); - } - } - if (header === true || !("header" in page) || !("sections" in page.header)) { const sectionNames = Object.entries(sections) .filter(([name, info]) => !Object.values(info.pages).every((state) => state.skipped)) @@ -207,17 +190,10 @@ export class Main extends LitElement { return html` ${headerEl} - ${ - capsules - ? html`
${capsules}
` - : html`` - } ${ title ? html`
@@ -231,9 +207,7 @@ export class Main extends LitElement { : "" } -
+
${page}
${footerEl} diff --git a/src/renderer/src/stories/pages/guided-mode/GuidedCapsules.js b/src/renderer/src/stories/pages/guided-mode/GuidedCapsules.js deleted file mode 100644 index 95db22a8d..000000000 --- a/src/renderer/src/stories/pages/guided-mode/GuidedCapsules.js +++ /dev/null @@ -1,54 +0,0 @@ -import { LitElement, html } from "lit"; - -export class GuidedCapsules extends LitElement { - constructor({ n = 0, selected = 0, skipped = [] } = {}) { - super(); - this.n = n; - this.selected = selected; - this.skipped = skipped; - this.style.width = "100%"; - } - - static get properties() { - return { - n: { type: Number, reflect: true }, - selected: { type: Number, reflect: true }, - skipped: { type: Array }, - }; - } - - attributeChangedCallback(...args) { - const attrs = ["n", "selected"]; - super.attributeChangedCallback(...args); - if (attrs.includes(args[0])) this.requestUpdate(); - } - - createRenderRoot() { - return this; - } - - onClick = () => {}; - - render() { - if (!this.n) return html``; - - return html` -
-
- ${Array.from( - { length: this.n }, - (_, i) => - html`
this.onClick(i)} - class="guided--capsule ${i === this.selected ? `active` : ""} ${this.skipped[i] - ? `skipped` - : ""}" - >
` - )} -
-
- `; - } -} - -customElements.get("nwb-guided-capsules") || customElements.define("nwb-guided-capsules", GuidedCapsules);