make tags visible on public collections
This commit is contained in:
parent
d86bbcd940
commit
2e1e94112f
|
@ -130,31 +130,6 @@ export default function EditCollectionSharingModal({
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{permissions === true && collection.isPublic && (
|
|
||||||
<div>
|
|
||||||
<p>Show tags in public collection</p>
|
|
||||||
|
|
||||||
<label className="label cursor-pointer justify-start gap-2">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={collection.tagsArePublic}
|
|
||||||
onChange={() =>
|
|
||||||
setCollection({
|
|
||||||
...collection,
|
|
||||||
tagsArePublic: !collection.tagsArePublic,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
className="checkbox checkbox-primary"
|
|
||||||
/>
|
|
||||||
<span className="label-text">Show tags in public collection</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<p className="text-neutral text-sm">
|
|
||||||
This will let <b>Anyone</b> view this collections tags and search
|
|
||||||
this collections links by them.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{collection.isPublic && (
|
{collection.isPublic && (
|
||||||
<div>
|
<div>
|
||||||
<p className="mb-2">{t("sharable_link")}</p>
|
<p className="mb-2">{t("sharable_link")}</p>
|
||||||
|
|
|
@ -84,7 +84,6 @@ export default async function updateCollection(
|
||||||
icon: data.icon,
|
icon: data.icon,
|
||||||
iconWeight: data.iconWeight,
|
iconWeight: data.iconWeight,
|
||||||
isPublic: data.isPublic,
|
isPublic: data.isPublic,
|
||||||
tagsArePublic: data.tagsArePublic,
|
|
||||||
parent:
|
parent:
|
||||||
data.parentId && data.parentId !== "root"
|
data.parentId && data.parentId !== "root"
|
||||||
? {
|
? {
|
||||||
|
|
|
@ -190,7 +190,6 @@ export const UpdateCollectionSchema = z.object({
|
||||||
isPublic: z.boolean().optional(),
|
isPublic: z.boolean().optional(),
|
||||||
icon: z.string().trim().max(50).nullish(),
|
icon: z.string().trim().max(50).nullish(),
|
||||||
iconWeight: 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(),
|
parentId: z.union([z.number(), z.literal("root")]).nullish(),
|
||||||
members: z.array(
|
members: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
|
|
|
@ -25,7 +25,6 @@ import { usePublicLinks } from "@/hooks/store/publicLinks";
|
||||||
import Links from "@/components/LinkViews/Links";
|
import Links from "@/components/LinkViews/Links";
|
||||||
import { Disclosure, Transition } from "@headlessui/react";
|
import { Disclosure, Transition } from "@headlessui/react";
|
||||||
|
|
||||||
|
|
||||||
export default function PublicCollections() {
|
export default function PublicCollections() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
@ -39,7 +38,18 @@ const { settings } = useLocalSettingsStore();
|
||||||
|
|
||||||
const handleTagSelection = (tag: string | undefined) => {
|
const handleTagSelection = (tag: string | undefined) => {
|
||||||
if (tag) {
|
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;
|
searchFilter.tags = true;
|
||||||
return router.push(
|
return router.push(
|
||||||
"/public/collections/" +
|
"/public/collections/" +
|
||||||
|
@ -48,11 +58,9 @@ const { settings } = useLocalSettingsStore();
|
||||||
encodeURIComponent(tag || "")
|
encodeURIComponent(tag || "")
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return router.push(
|
return router.push("/public/collections/" + router.query.id);
|
||||||
"/public/collections/" +
|
|
||||||
router.query.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const [searchFilter, setSearchFilter] = useState({
|
const [searchFilter, setSearchFilter] = useState({
|
||||||
name: true,
|
name: true,
|
||||||
|
@ -243,8 +251,7 @@ useEffect(() => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</LinkListOptions>
|
</LinkListOptions>
|
||||||
{collection.tagsArePublic &&
|
{linksForWholeCollection?.flatMap((l) => l.tags)[0] && (
|
||||||
linksForWholeCollection?.flatMap((l) => l.tags)[0] && (
|
|
||||||
<Disclosure defaultOpen={tagDisclosure}>
|
<Disclosure defaultOpen={tagDisclosure}>
|
||||||
<Disclosure.Button
|
<Disclosure.Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -287,9 +294,7 @@ useEffect(() => {
|
||||||
{linksForWholeCollection
|
{linksForWholeCollection
|
||||||
.flatMap((l) => l.tags)
|
.flatMap((l) => l.tags)
|
||||||
.map((t) => t.name)
|
.map((t) => t.name)
|
||||||
.filter(
|
.filter((item, pos, self) => self.indexOf(item) === pos)
|
||||||
(item, pos, self) => self.indexOf(item) === pos
|
|
||||||
)
|
|
||||||
.sort((a, b) => a.localeCompare(b))
|
.sort((a, b) => a.localeCompare(b))
|
||||||
.map((e, i) => {
|
.map((e, i) => {
|
||||||
const active = router.query.q === e;
|
const active = router.query.q === e;
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
-- AlterTable
|
|
||||||
ALTER TABLE "Collection" ADD COLUMN "tagsArePublic" BOOLEAN NOT NULL DEFAULT false;
|
|
|
@ -105,7 +105,6 @@ model Collection {
|
||||||
parent Collection? @relation("SubCollections", fields: [parentId], references: [id])
|
parent Collection? @relation("SubCollections", fields: [parentId], references: [id])
|
||||||
subCollections Collection[] @relation("SubCollections")
|
subCollections Collection[] @relation("SubCollections")
|
||||||
isPublic Boolean @default(false)
|
isPublic Boolean @default(false)
|
||||||
tagsArePublic Boolean @default(false)
|
|
||||||
owner User @relation(fields: [ownerId], references: [id])
|
owner User @relation(fields: [ownerId], references: [id])
|
||||||
ownerId Int
|
ownerId Int
|
||||||
members UsersAndCollections[]
|
members UsersAndCollections[]
|
||||||
|
|
Ŝarĝante…
Reference in New Issue