Skip to content

Commit 93e7d9c

Browse files
committed
wip
1 parent 28a3571 commit 93e7d9c

File tree

17 files changed

+60
-25
lines changed

17 files changed

+60
-25
lines changed

packages/api-headless-cms-workflows/src/utils/state.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import type { IEntryState } from "@webiny/api-headless-cms/types/index.js";
22
import type { IWorkflowStateModel } from "@webiny/api-workflows/context/abstractions/WorkflowState.js";
33

4-
export const getStateValues = (state: IWorkflowStateModel): IEntryState | undefined => {
5-
const activeStep = state.getActiveStep();
6-
if (!activeStep) {
7-
return undefined;
8-
}
4+
export const getStateValues = (state: IWorkflowStateModel): IEntryState => {
5+
const activeStep = state.currentStep;
96

107
return {
118
workflowId: state.workflowId,

packages/api-website-builder-workflows/src/utils/state.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import type { IWorkflowStateModel } from "@webiny/api-workflows";
22
import type { IWbPageState } from "~/types.js";
33

4-
export const getStateValues = (state: IWorkflowStateModel): IWbPageState | undefined => {
5-
const activeStep = state.getActiveStep();
6-
if (!activeStep) {
7-
return undefined;
8-
}
9-
4+
export const getStateValues = (state: IWorkflowStateModel): IWbPageState => {
5+
const activeStep = state.currentStep;
106
return {
117
workflowId: state.workflowId,
128
stepId: activeStep.id,

packages/api-website-builder-workflows/src/websiteBuilder/updatePage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const attachUpdatePageLifecycleEvents = (params: IParams) => {
1111
const { context } = params;
1212
context.websiteBuilder.pages.onPageBeforeUpdate.subscribe(async ({ original }) => {
1313
let state: IWorkflowState;
14+
1415
try {
1516
state = await context.workflowState.getTargetState(WB_PAGE_APP, original.id);
1617
} catch {

packages/app-aco/src/components/Table/createTableData.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import type { FolderTableRow, RecordTableRow } from "~/table.types.js";
44
export const createRecordsData = <T extends { id: string; $selectable?: boolean }>(
55
items: T[]
66
): RecordTableRow<T>[] => {
7+
console.log({
8+
items
9+
});
710
return items.map(item => ({
811
id: item.id,
912
$type: "RECORD",

packages/app-aco/src/features/folders/createFolder/CreateFolder.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe("CreateFolder", () => {
2525
const gateway = new CreateFolderMockGateway();
2626

2727
let container: Container;
28-
const foldersCache = new ListCache<Folder>()
28+
const foldersCache = new ListCache<Folder>();
2929

3030
beforeEach(() => {
3131
container = new Container();

packages/app-aco/src/features/folders/loadFolderHierarchy/LoadFolderHierarchy.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ describe("GetFolderHierarchy", () => {
175175

176176
expect(foldersCache.hasItems()).toBe(false);
177177

178-
await expect(useCase.execute("folder-0")).rejects.toThrow(
179-
"Gateway error"
180-
);
178+
await expect(useCase.execute("folder-0")).rejects.toThrow("Gateway error");
181179

182180
expect(spy).toHaveBeenCalledTimes(1);
183181
expect(foldersCache.hasItems()).toBe(false);

packages/app-aco/src/features/folders/loadFolderHierarchy/abstractions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ export const LoadFolderHierarchyGateway = createAbstraction<ILoadFolderHierarchy
4040

4141
export namespace LoadFolderHierarchyGateway {
4242
export type Interface = ILoadFolderHierarchyGateway;
43-
export type Return = Promise<LoadFolderHierarchyGatewayResponse>
43+
export type Return = Promise<LoadFolderHierarchyGatewayResponse>;
4444
}

packages/app-website-builder-workflows/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@webiny/feature": "0.0.0",
2121
"@webiny/icons": "0.0.0",
2222
"mobx": "^6.15.0",
23+
"mobx-react-lite": "^3.4.3",
2324
"react": "18.2.0",
2425
"react-dom": "18.2.0",
2526
"react-helmet": "^6.1.0"

packages/app-website-builder-workflows/src/Components/PageEditor/PageEditorAutoSave.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React from "react";
22
import { PageEditorConfig } from "@webiny/app-website-builder";
33
import { useWorkflowState } from "@webiny/app-workflows";
4+
import { observer } from "mobx-react-lite";
45

56
const { Ui } = PageEditorConfig;
67

78
interface IWrappedAutoSave {
89
element?: React.ReactElement | null;
910
}
10-
const WrappedAutoSave = (props: IWrappedAutoSave) => {
11+
const WrappedAutoSave = observer((props: IWrappedAutoSave) => {
1112
const { presenter } = useWorkflowState();
1213
/**
1314
* Autosave should work only when the page does not have a workflow state assigned.
@@ -17,9 +18,9 @@ const WrappedAutoSave = (props: IWrappedAutoSave) => {
1718
}
1819

1920
return null;
20-
};
21+
});
2122

22-
export const PageEditorAutoSave = Ui.TopBar.Action.createDecorator(Original => {
23+
export const PageEditorAutoSave = Ui.TopBar.Element.createDecorator(Original => {
2324
return function PageEditorAutoSaveDecorated(props) {
2425
if (props.name === "autoSave") {
2526
return <Original {...props} element={<WrappedAutoSave element={props.element} />} />;

packages/app-website-builder-workflows/src/Components/PageEditor/PageEditorConfig.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import { PageEditorConfig as BaseConfig } from "@webiny/app-website-builder";
33
import { PageEditorAutoSave } from "./PageEditorAutoSave.js";
4+
import { PageEditorSettings } from "./PageEditorSettings.js";
45
import { PageFormWorkflowStateTooltip } from "./PageFormWorkflowStateTooltip.js";
56
import { PageFormWorkflowStatePublishButton } from "./PageFormWorkflowStatePublishButton.js";
67
import { PageEditorLayout } from "./PageEditorLayout.js";
@@ -12,6 +13,8 @@ export const PageEditorConfig = () => {
1213
<BaseConfig>
1314
{/* Should remove autosave feature */}
1415
<PageEditorAutoSave />
16+
{/* Should remove settings button */}
17+
<PageEditorSettings />
1518
{/* Should add a button with list of steps and their states + comment button in each row */}
1619
<PageFormWorkflowStateTooltip />
1720
{/* should remove publish button from the form */}

0 commit comments

Comments
 (0)