Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sidebar setup guide fixes: #2105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,14 +850,14 @@ export class App extends LiteElement {
iframe.removeEventListener("load", oneLoad);
};

iframe.classList.add(tw`opacity-0`);

if (pathName) {
if (iframe.src.slice(this.docsUrl.length) !== pathName) {
iframe.classList.add(tw`opacity-0`);
iframe.addEventListener("load", oneLoad);
iframe.src = `${this.docsUrl}${pathName}`;
}
} else {
iframe.classList.add(tw`opacity-0`);
iframe.addEventListener("load", oneLoad);
iframe.src = this.docsUrl;
}
Expand Down
28 changes: 26 additions & 2 deletions frontend/src/pages/org/workflows-new.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { localized, msg } from "@lit/localize";
import { mergeDeep } from "immutable";
import { customElement, property } from "lit/decorators.js";
import { customElement, property, state } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { when } from "lit/directives/when.js";

Expand All @@ -12,6 +12,15 @@ import { WorkflowScopeType } from "@/types/workflow";
import LiteElement, { html } from "@/utils/LiteElement";
import type { FormState as WorkflowFormState } from "@/utils/workflow";

const workflowTabToGuideHash: Record<string, string> = {
crawlSetup: "scope",
crawlLimits: "limits",
browserSettings: "browser-settings",
crawlScheduling: "scheduling",
crawlMetadata: "metadata",
confirmSettings: "scope",
};

/**
* Usage:
* ```ts
Expand All @@ -33,6 +42,21 @@ export class WorkflowsNew extends LiteElement {
@property({ type: Object })
initialWorkflow?: WorkflowParams;

@state()
userGuideHashLink = "scope";

connectedCallback(): void {
super.connectedCallback();

this.userGuideHashLink =
workflowTabToGuideHash[window.location.hash.slice(1)] || "scope";

window.addEventListener("hashchange", () => {
const hashValue = window.location.hash.slice(1);
this.userGuideHashLink = workflowTabToGuideHash[hashValue] || "scope";
});
}

private get defaultNewWorkflow(): WorkflowParams {
return {
name: "",
Expand Down Expand Up @@ -93,7 +117,7 @@ export class WorkflowsNew extends LiteElement {
UserGuideEventMap["btrix-user-guide-show"]["detail"]
>("btrix-user-guide-show", {
detail: {
path: "/user-guide/workflow-setup/#scope",
path: `/user-guide/workflow-setup/#${this.userGuideHashLink}`,
},
bubbles: true,
}),
Expand Down
Loading