diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsx index d78abc2..ba7bfdd 100644 --- a/components/ModalContent/EditCollectionSharingModal.tsx +++ b/components/ModalContent/EditCollectionSharingModal.tsx @@ -130,31 +130,6 @@ export default function EditCollectionSharingModal({ )} - {permissions === true && collection.isPublic && ( -
-

Show tags in public collection

- - - -

- This will let Anyone view this collections tags and search - this collections links by them. -

-
- )} {collection.isPublic && (

{t("sharable_link")}

diff --git a/lib/api/controllers/collections/collectionId/updateCollectionById.ts b/lib/api/controllers/collections/collectionId/updateCollectionById.ts index c942eb0..2f78d1c 100644 --- a/lib/api/controllers/collections/collectionId/updateCollectionById.ts +++ b/lib/api/controllers/collections/collectionId/updateCollectionById.ts @@ -84,7 +84,6 @@ export default async function updateCollection( icon: data.icon, iconWeight: data.iconWeight, isPublic: data.isPublic, - tagsArePublic: data.tagsArePublic, parent: data.parentId && data.parentId !== "root" ? { diff --git a/lib/shared/schemaValidation.ts b/lib/shared/schemaValidation.ts index dbca56e..30398c0 100644 --- a/lib/shared/schemaValidation.ts +++ b/lib/shared/schemaValidation.ts @@ -190,7 +190,6 @@ export const UpdateCollectionSchema = z.object({ isPublic: z.boolean().optional(), icon: z.string().trim().max(50).nullish(), iconWeight: z.string().trim().max(50).nullish(), - tagsArePublic: z.boolean().optional(), parentId: z.union([z.number(), z.literal("root")]).nullish(), members: z.array( z.object({ diff --git a/pages/public/collections/[id].tsx b/pages/public/collections/[id].tsx index 7c882e6..7a7c02d 100644 --- a/pages/public/collections/[id].tsx +++ b/pages/public/collections/[id].tsx @@ -25,11 +25,10 @@ import { usePublicLinks } from "@/hooks/store/publicLinks"; import Links from "@/components/LinkViews/Links"; import { Disclosure, Transition } from "@headlessui/react"; - export default function PublicCollections() { const { t } = useTranslation(); -const { settings } = useLocalSettingsStore(); + const { settings } = useLocalSettingsStore(); const router = useRouter(); @@ -37,22 +36,31 @@ const { settings } = useLocalSettingsStore(); Partial >({}); - const handleTagSelection = (tag: string | undefined) => { + const handleTagSelection = (tag: string | undefined) => { if (tag) { - Object.keys(searchFilter).forEach((v) => searchFilter[(v as keyof {name: boolean, url: boolean, description: boolean, tags: boolean, textContent: boolean})] = false) + Object.keys(searchFilter).forEach( + (v) => + (searchFilter[ + v as keyof { + name: boolean; + url: boolean; + description: boolean; + tags: boolean; + textContent: boolean; + } + ] = false) + ); searchFilter.tags = true; return router.push( "/public/collections/" + - router.query.id + - "?q=" + - encodeURIComponent(tag || "") + router.query.id + + "?q=" + + encodeURIComponent(tag || "") ); } else { - return router.push( - "/public/collections/" + - router.query.id) + return router.push("/public/collections/" + router.query.id); } - } + }; const [searchFilter, setSearchFilter] = useState({ name: true, @@ -106,18 +114,18 @@ const { settings } = useLocalSettingsStore(); (localStorage.getItem("viewMode") as ViewMode) || ViewMode.Card ); -const [tagDisclosure, setTagDisclosure] = useState(() => { - const storedValue = localStorage.getItem( - "tagDisclosureForPublicCollection" + collection?.id - ); - return storedValue ? storedValue === "true" : true; -}); -useEffect(() => { - localStorage.setItem( - "tagDisclosureForPublicCollection" + collection?.id, - tagDisclosure ? "true" : "false" - ); -}, [tagDisclosure]); + const [tagDisclosure, setTagDisclosure] = useState(() => { + const storedValue = localStorage.getItem( + "tagDisclosureForPublicCollection" + collection?.id + ); + return storedValue ? storedValue === "true" : true; + }); + useEffect(() => { + localStorage.setItem( + "tagDisclosureForPublicCollection" + collection?.id, + tagDisclosure ? "true" : "false" + ); + }, [tagDisclosure]); if (!collection) return <>; else @@ -243,88 +251,85 @@ useEffect(() => { } /> - {collection.tagsArePublic && - linksForWholeCollection?.flatMap((l) => l.tags)[0] && ( - - { - setTagDisclosure(!tagDisclosure); - }} - className="flex items-center justify-between w-full text-left mb-2 pl-2 font-bold text-neutral mt-5" - > -

{t("browse_by_topic")}

- -
- - -
- - {linksForWholeCollection - .flatMap((l) => l.tags) - .map((t) => t.name) - .filter( - (item, pos, self) => self.indexOf(item) === pos - ) - .sort((a, b) => a.localeCompare(b)) - .map((e, i) => { - const active = router.query.q === e; - return ( - + {linksForWholeCollection + .flatMap((l) => l.tags) + .map((t) => t.name) + .filter((item, pos, self) => self.indexOf(item) === pos) + .sort((a, b) => a.localeCompare(b)) + .map((e, i) => { + const active = router.query.q === e; + return ( + - ); - })} -
-
-
-
- )} +
+ + ); + })} + + + + + )} { diff --git a/prisma/migrations/20241102220059_add_fields_to_collections/migration.sql b/prisma/migrations/20241102220059_add_fields_to_collections/migration.sql deleted file mode 100644 index d05cbfd..0000000 --- a/prisma/migrations/20241102220059_add_fields_to_collections/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Collection" ADD COLUMN "tagsArePublic" BOOLEAN NOT NULL DEFAULT false; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 92801dc..1341843 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -105,7 +105,6 @@ model Collection { parent Collection? @relation("SubCollections", fields: [parentId], references: [id]) subCollections Collection[] @relation("SubCollections") isPublic Boolean @default(false) - tagsArePublic Boolean @default(false) owner User @relation(fields: [ownerId], references: [id]) ownerId Int members UsersAndCollections[]