sample-ui-component-library 0.0.8-dev → 0.0.9-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sample-ui-component-library",
3
- "version": "0.0.8-dev",
3
+ "version": "0.0.9-dev",
4
4
  "description": "A library which contains sample UI elements that can be used for populating layouts.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -9,6 +9,15 @@ export const editorReducer = (state, action) => {
9
9
 
10
10
  case "ADD_TAB": {
11
11
  // TODO: Add some validation for the payload here.
12
+ const tab = state.tabs.find(obj => obj.uid === action.payload.uid);
13
+ if (tab) {
14
+ console.warn(`Tab with id ${action.payload.uid} already exists`);
15
+ return {
16
+ ...state,
17
+ activeTab: tab
18
+ };
19
+ }
20
+
12
21
  return {
13
22
  ...state,
14
23
  tabs: [...state.tabs, action.payload],
@@ -13,7 +13,7 @@ export const Gutter = ({ id, index, parentId }) => {
13
13
  const { setNodeRef, isOver } = useDroppable({
14
14
  id,
15
15
  data: {
16
- type: "tab-gutter",
16
+ type: "EditorTabGutter",
17
17
  parentId: parentId,
18
18
  index: index,
19
19
  },
@@ -28,7 +28,7 @@ export const Tab = ({ id, parentId, node }) => {
28
28
  const { attributes, listeners, setNodeRef, transform } = useDraggable({
29
29
  id,
30
30
  data: {
31
- type: "tab-draggable",
31
+ type: "EditorTab",
32
32
  parentId: parentId,
33
33
  node: node
34
34
  },
@@ -22,6 +22,7 @@ export const TreeNode = ({ id, node }) => {
22
22
  {
23
23
  id,
24
24
  data: {
25
+ type: "FileTreeNode",
25
26
  node: node
26
27
  }
27
28
  }
@@ -71,7 +71,7 @@ const Template = (args) => {
71
71
  return;
72
72
  }
73
73
 
74
- if (active.data.current.type === "tab-draggable" && over.data.current.type === "tab-gutter") {
74
+ if (active.data.current.type === "EditorTab" && over.data.current.type === "EditorTabGutter") {
75
75
  editorRef.current.moveTab(active.data.current.node.uid, over.data.current.index);
76
76
  }
77
77
  }