Skip to content

Commit c5b3fe1

Browse files
authored
feat: remove trash button from shared blueprints - AB-851 (#1258)
1 parent 528440d commit c5b3fe1

File tree

1 file changed

+8
-95
lines changed

1 file changed

+8
-95
lines changed

src/ui/src/builder/sidebar/BuilderSidebarToolkit.vue

Lines changed: 8 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@
3939
v-for="tool in tools"
4040
:key="tool.type"
4141
class="tool"
42-
:class="{
43-
'tool--shared':
44-
categoryId === 'Shared Blueprints' &&
45-
isSharedBlueprintsEnabled,
46-
}"
4742
:data-writer-tooltip="tool.description"
4843
data-writer-tooltip-placement="right"
4944
data-writer-tooltip-gap="8"
@@ -66,24 +61,6 @@
6661
:loader-max-height-px="18"
6762
/>
6863
<div class="name">{{ tool.name }}</div>
69-
<button
70-
v-if="
71-
categoryId === 'Shared Blueprints' &&
72-
isSharedBlueprintsEnabled &&
73-
tool.sourceBlueprintId
74-
"
75-
class="tool__delete"
76-
:data-writer-tooltip="`Delete ${tool.name}`"
77-
data-writer-tooltip-placement="right"
78-
@click.stop="
79-
handleDeleteSharedBlueprint(
80-
tool.sourceBlueprintId,
81-
tool.name,
82-
)
83-
"
84-
>
85-
<WdsIcon name="trash" />
86-
</button>
8764
</div>
8865
</div>
8966
</div>
@@ -122,18 +99,13 @@ import { useDragDropComponent } from "../useDragDropComponent";
12299
import { Component } from "@/writerTypes";
123100
import SharedImgWithFallback from "@/components/shared/SharedImgWithFallback.vue";
124101
import { convertAbsolutePathtoFullURL } from "@/utils/url";
125-
import { useToasts } from "../useToast";
126-
import { useComponentActions } from "../useComponentActions";
127-
import { useWriterTracking } from "@/composables/useWriterTracking";
128102
import { isSharedBlueprint } from "@/utils/sharedBlueprint";
129103
import { defineAsyncComponentWithLoader } from "@/utils/defineAsyncComponentWithLoader";
130104
131105
const BuilderBlueprintLibraryPanel = defineAsyncComponentWithLoader({
132106
loader: () => import("../panels/BuilderBlueprintLibraryPanel.vue"),
133107
});
134108
135-
const { pushToast } = useToasts();
136-
137109
const isAutogenModalShown = inject(
138110
injectionKeys.isAutogenModalShown,
139111
ref(false),
@@ -149,8 +121,6 @@ function showBlueprintLibrary() {
149121
150122
const wf = inject(injectionKeys.core);
151123
const wfbm = inject(injectionKeys.builderManager);
152-
const tracking = useWriterTracking(wf);
153-
const { removeComponentsSubtree } = useComponentActions(wf, wfbm, tracking);
154124
const { removeInsertionCandidacy } = useDragDropComponent(wf);
155125
const query = ref("");
156126
@@ -298,7 +268,13 @@ function getRelevantToolsInCategory(categoryId: string) {
298268
});
299269
const enriched = typeList.map((type) => {
300270
const { name, description, category } = getComponentDefinition(type);
301-
return { type, name, description, category: category ?? "Other" };
271+
return {
272+
type,
273+
name,
274+
description,
275+
category: category ?? "Other",
276+
sourceBlueprintId: undefined as string | undefined,
277+
};
302278
});
303279
const q = query.value.toLocaleLowerCase();
304280
const queryApplied = enriched
@@ -340,33 +316,6 @@ function getToolIcons(tool: ReturnType<typeof getRelevantToolsInCategory>[0]) {
340316
].map((p) => convertAbsolutePathtoFullURL(p));
341317
}
342318
343-
function handleDeleteSharedBlueprint(
344-
blueprintId: string,
345-
blueprintName: string,
346-
) {
347-
if (
348-
!confirm(
349-
`Are you sure you want to delete the shared blueprint "${blueprintName}"?`,
350-
)
351-
) {
352-
return;
353-
}
354-
355-
try {
356-
// Use removeComponentsSubtree for proper cleanup of dependencies and connections
357-
removeComponentsSubtree(blueprintId);
358-
pushToast({
359-
type: "success",
360-
message: `Shared blueprint '${blueprintName}' deleted.`,
361-
});
362-
} catch (error) {
363-
pushToast({
364-
type: "error",
365-
message: `Failed to delete shared blueprint: ${error instanceof Error ? error.message : String(error)}`,
366-
});
367-
}
368-
}
369-
370319
watch(activeToolkit, () => {
371320
query.value = "";
372321
});
@@ -440,7 +389,7 @@ watch(activeToolkit, () => {
440389
441390
.tool {
442391
display: grid;
443-
grid-template-columns: 18px 1fr auto;
392+
grid-template-columns: 18px 1fr;
444393
grid-template-rows: 1fr;
445394
column-gap: 8px;
446395
padding: 8px;
@@ -449,10 +398,6 @@ watch(activeToolkit, () => {
449398
position: relative;
450399
}
451400
452-
.tool--shared {
453-
grid-template-columns: 18px 1fr auto;
454-
}
455-
456401
.tool img {
457402
max-width: 18px;
458403
max-height: 18px;
@@ -463,38 +408,6 @@ watch(activeToolkit, () => {
463408
background: var(--builderSubtleSeparatorColor);
464409
}
465410
466-
.tool__delete {
467-
display: none;
468-
align-items: center;
469-
justify-content: center;
470-
width: 20px;
471-
height: 20px;
472-
padding: 0;
473-
border: none;
474-
background: transparent;
475-
cursor: pointer;
476-
color: var(--builderSecondaryTextColor);
477-
border-radius: 4px;
478-
opacity: 0.6;
479-
transition:
480-
opacity 0.2s,
481-
background 0.2s;
482-
}
483-
484-
.tool--shared:hover .tool__delete {
485-
display: flex;
486-
}
487-
488-
.tool__delete:hover {
489-
opacity: 1;
490-
background: var(--builderSubtleSeparatorColor);
491-
color: var(--builderErrorColor);
492-
}
493-
494-
.tool__delete:active {
495-
opacity: 0.8;
496-
}
497-
498411
.BuilderSidebarPanel__footer__actions {
499412
flex: 0 0 var(--builderPanelSwitcherHeight);
500413
bottom: 0;

0 commit comments

Comments
 (0)