Skip to content

Commit a2de997

Browse files
committed
hide collection share buttons when collection is private
1 parent b233321 commit a2de997

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

frontend/src/features/collections/share-collection.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { collectionShareLink } from "./helpers/share-link";
77

88
import { BtrixElement } from "@/classes/BtrixElement";
99
import { ClipboardController } from "@/controllers/clipboard";
10-
import { type EditCollectionDetail } from "@/pages/org/collection-detail";
1110
import { AnalyticsTrackEvent } from "@/trackEvents";
1211
import {
1312
CollectionAccess,
@@ -18,7 +17,6 @@ import { track } from "@/utils/analytics";
1817

1918
/**
2019
* @fires btrix-change
21-
* @fires btrix-edit-collection {EditCollectionDetail}
2220
*/
2321
@localized()
2422
@customElement("btrix-share-collection")
@@ -64,33 +62,9 @@ export class ShareCollection extends BtrixElement {
6462
}
6563

6664
private renderButton() {
67-
if (!this.collection) {
68-
return html`
69-
<sl-skeleton
70-
effect="pulse"
71-
class="h-[var(--sl-input-height-small)] w-20 [--border-radius:var(--sl-input-border-radius-small)]"
72-
></sl-skeleton>
73-
`;
74-
}
65+
if (!this.collection) return;
7566

76-
if (this.collection.access === CollectionAccess.Private) {
77-
return html`
78-
<sl-button
79-
variant=${this.collection.crawlCount ? "primary" : "default"}
80-
size="small"
81-
@click=${() => {
82-
this.dispatchEvent(
83-
new CustomEvent<EditCollectionDetail>("btrix-edit-collection", {
84-
detail: { tab: "sharing" },
85-
}),
86-
);
87-
}}
88-
>
89-
<sl-icon name="box-arrow-up" slot="prefix"></sl-icon>
90-
${msg("Share")}
91-
</sl-button>
92-
`;
93-
}
67+
if (this.collection.access === CollectionAccess.Private) return;
9468

9569
return html`
9670
<div class="flex items-center gap-2">

frontend/src/pages/org/collection-detail.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ import { tw } from "@/utils/tailwind";
4242
const ABORT_REASON_THROTTLE = "throttled";
4343
const INITIAL_ITEMS_PAGE_SIZE = 20;
4444

45-
export type EditCollectionDetail = {
46-
tab?: EditDialogTab;
47-
};
48-
4945
export enum Tab {
5046
Replay = "replay",
5147
About = "about",
@@ -219,13 +215,6 @@ export class CollectionDetail extends BtrixElement {
219215
e.stopPropagation();
220216
void this.fetchCollection();
221217
}}
222-
@btrix-edit-collection=${async (
223-
e: CustomEvent<EditCollectionDetail>,
224-
) => {
225-
this.editTab = e.detail.tab;
226-
await this.updateComplete;
227-
this.openDialogName = "edit";
228-
}}
229218
></btrix-share-collection>
230219
${when(this.isCrawler, this.renderActions)}
231220
</div>

0 commit comments

Comments
 (0)