diff options
| author | MohamedBassem <me@mbassem.com> | 2024-10-05 20:08:50 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-10-05 20:09:54 +0000 |
| commit | 8a1309536b76ba86872ca2e78aa695d9fd80c8cc (patch) | |
| tree | 23d67611b16ab85f45e917b46297831560447038 /apps/web/components/dashboard/preview/AttachmentBox.tsx | |
| parent | 99c6232fde898932d77bab166934f59d3c56d7d1 (diff) | |
| download | karakeep-8a1309536b76ba86872ca2e78aa695d9fd80c8cc.tar.zst | |
feature: Allow attaching custom banners to notes. Fixes: #106
Diffstat (limited to 'apps/web/components/dashboard/preview/AttachmentBox.tsx')
| -rw-r--r-- | apps/web/components/dashboard/preview/AttachmentBox.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/web/components/dashboard/preview/AttachmentBox.tsx b/apps/web/components/dashboard/preview/AttachmentBox.tsx index b2460165..a8eaf0f4 100644 --- a/apps/web/components/dashboard/preview/AttachmentBox.tsx +++ b/apps/web/components/dashboard/preview/AttachmentBox.tsx @@ -27,7 +27,11 @@ import { useReplaceBookmarkAsset, } from "@hoarder/shared-react/hooks/bookmarks"; import { getAssetUrl } from "@hoarder/shared-react/utils/assetUtils"; -import { ZAssetType, ZBookmark } from "@hoarder/shared/types/bookmarks"; +import { + BookmarkTypes, + ZAssetType, + ZBookmark, +} from "@hoarder/shared/types/bookmarks"; import { humanFriendlyNameForAssertType, isAllowedToAttachAsset, @@ -94,10 +98,12 @@ export default function AttachmentBox({ bookmark }: { bookmark: ZBookmark }) { }, }); - if (!bookmark.assets.length) { + bookmark.assets.sort((a, b) => a.assetType.localeCompare(b.assetType)); + + if (bookmark.content.type == BookmarkTypes.ASSET) { + // Currently, we don't allow attaching assets to assets types. return null; } - bookmark.assets.sort((a, b) => a.assetType.localeCompare(b.assetType)); return ( <Collapsible> |
