Skip to content
Closed
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
107 changes: 107 additions & 0 deletions apps/uikit-playground/src/Context/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,110 @@ const reducer = (state: initialStateType, action: IAction) => {
state.screens[activeScreen].payload.surface = action.payload;
state.screens[activeScreen].changedByEditor = false;


return { ...state };
}
case ActionTypes.UpdatePayload: {
state.screens[activeScreen].payload.blocks = action?.payload?.blocks;
if (action?.payload?.surface)
state.screens[activeScreen].payload.surface = action?.payload?.surface;
state.screens[activeScreen].changedByEditor =
action?.payload?.changedByEditor === undefined;
state.projects[activeProject].flowEdges = filterEdges(
state.projects[activeProject].flowEdges,
action?.payload?.blocks.map((node) => node.actionId),
activeScreen
);
return { ...state };
}
case ActionTypes.ActionPreview: {
state.screens[activeScreen].actionPreview = action.payload;
return { ...state };
}
case ActionTypes.User:
return { ...state, user: action.payload };
case ActionTypes.OpenCreateNewScreen:
return { ...state, openCreateNewScreen: action.payload };
case ActionTypes.ActiveScreen:
return {
...state,
openCreateNewScreen: false,
activeScreen: action.payload,
};
case ActionTypes.CreateNewScreen: {
const id = getUniqueId();
return {
...state,
screens: {
...state.screens,
[id]: {
id,
name: action?.payload || 'Untitled Screen',
payload: {
surface: SurfaceOptions.Message,
blocks: [],
},
date: getDate(),
actionPreview: {},
},
},
projects: {
...state.projects,
[activeProject]: {
...state.projects[activeProject],
screens: [...state.projects[activeProject].screens, id],
},
},
openCreateNewScreen: false,
activeScreen: id,
};
}
case ActionTypes.DuplicateScreen: {
const id = getUniqueId();
const screens = state.projects[activeProject].screens;
screens.splice(screens.indexOf(action.payload.id), 0, id);
return {
...state,
screens: {
...state.screens,
[id]: {
...state.screens[action.payload.id],
id,
date: getDate(),
actionPreview: {},
name: action?.payload.name || 'Untitled Screen',
payload: state.screens[action.payload.id].payload,
},
},
projects: {
...state.projects,
[activeProject]: {
...state.projects[activeProject],
screens,
},
},
openCreateNewScreen: false,
activeScreen: id,
};
}
case ActionTypes.RenameScreen: {
state.screens[action?.payload?.id].name = action.payload.name;
return { ...state };
}
case ActionTypes.DeleteScreen: {
delete state.screens[action.payload];
state.projects[activeProject].screens = [
...state.projects[activeProject].screens.filter(
(id) => id !== action.payload
),
];
state.projects[activeProject].flowEdges = state.projects[
activeProject
].flowEdges.filter(
(edge) =>
edge.source !== action.payload && edge.target !== action.payload
);
=======
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove unresolved merge-conflict markers before merge.

======= at Line 212 and Line 321 makes the reducer invalid TypeScript and blocks build/runtime parsing.

Suggested cleanup
-=======
...
-=======

Also applies to: 321-321

🧰 Tools
🪛 Biome (2.4.4)

[error] 212-212: Expected a statement but instead found '======='.

(parse)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/uikit-playground/src/Context/reducer.ts` at line 212, Remove the
unresolved merge markers ("=======") left in
apps/uikit-playground/src/Context/reducer.ts (they appear around the reducer
implementation) — open the reducer file, delete the conflict marker lines at the
locations shown (around line 212 and 321), and reconcile any surrounding
duplicate/conflicting blocks so the reducer function (the reducer export/handle
switch) contains a single valid TypeScript implementation and the file compiles.

return { ...state };
}
case ActionTypes.UpdatePayload: {
Expand Down Expand Up @@ -210,8 +314,11 @@ const reducer = (state: initialStateType, action: IAction) => {
(edge) => edge.source !== action.payload && edge.target !== action.payload,
);


state.projects[activeProject].flowNodes = state.projects[activeProject].flowNodes.filter((node) => node.id !== action.payload);


=======
return { ...state };
}

Expand Down