format
This commit is contained in:
parent
614653bf29
commit
7d43ed52a4
|
@ -63,7 +63,8 @@ async function processBookmarks(
|
||||||
) as Element;
|
) as Element;
|
||||||
|
|
||||||
if (collectionName) {
|
if (collectionName) {
|
||||||
const collectionNameContent = (collectionName.children[0] as TextNode)?.content;
|
const collectionNameContent = (collectionName.children[0] as TextNode)
|
||||||
|
?.content;
|
||||||
if (collectionNameContent) {
|
if (collectionNameContent) {
|
||||||
collectionId = await createCollection(
|
collectionId = await createCollection(
|
||||||
userId,
|
userId,
|
||||||
|
@ -274,4 +275,3 @@ function processNodes(nodes: Node[]) {
|
||||||
nodes.forEach(findAndProcessDL);
|
nodes.forEach(findAndProcessDL);
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ const getPublicCollectionData = async (
|
||||||
) => {
|
) => {
|
||||||
const res = await fetch("/api/v1/public/collections/" + collectionId);
|
const res = await fetch("/api/v1/public/collections/" + collectionId);
|
||||||
|
|
||||||
if (res.status === 400) return { response: "Collection not found.", status: 400 };
|
if (res.status === 400)
|
||||||
|
return { response: "Collection not found.", status: 400 };
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
locales: ["en","it"],
|
locales: ["en", "it"],
|
||||||
},
|
},
|
||||||
reloadOnPrerender: process.env.NODE_ENV === "development",
|
reloadOnPrerender: process.env.NODE_ENV === "development",
|
||||||
};
|
};
|
||||||
|
|
|
@ -68,15 +68,18 @@ export default function PublicCollections() {
|
||||||
searchByTags: searchFilter.tags,
|
searchByTags: searchFilter.tags,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [collection, setCollection] = useState<CollectionIncludingMembersAndLinkCount>();
|
const [collection, setCollection] =
|
||||||
|
useState<CollectionIncludingMembersAndLinkCount>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (router.query.id) {
|
if (router.query.id) {
|
||||||
getPublicCollectionData(Number(router.query.id), setCollection).then((res) => {
|
getPublicCollectionData(Number(router.query.id), setCollection).then(
|
||||||
if (res.status === 400) {
|
(res) => {
|
||||||
router.push("/dashboard");
|
if (res.status === 400) {
|
||||||
|
router.push("/dashboard");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
}
|
}
|
||||||
}, [collections]);
|
}, [collections]);
|
||||||
|
|
||||||
|
@ -111,8 +114,9 @@ export default function PublicCollections() {
|
||||||
<div
|
<div
|
||||||
className="h-96"
|
className="h-96"
|
||||||
style={{
|
style={{
|
||||||
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
|
||||||
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
|
settings.theme === "dark" ? "#262626" : "#f3f4f6"
|
||||||
|
} 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{collection ? (
|
{collection ? (
|
||||||
|
@ -183,20 +187,20 @@ export default function PublicCollections() {
|
||||||
|
|
||||||
<p className="text-neutral text-sm">
|
<p className="text-neutral text-sm">
|
||||||
{collection.members.length > 0 &&
|
{collection.members.length > 0 &&
|
||||||
collection.members.length === 1
|
collection.members.length === 1
|
||||||
? t("by_author_and_other", {
|
? t("by_author_and_other", {
|
||||||
author: collectionOwner.name,
|
|
||||||
count: collection.members.length,
|
|
||||||
})
|
|
||||||
: collection.members.length > 0 &&
|
|
||||||
collection.members.length !== 1
|
|
||||||
? t("by_author_and_others", {
|
|
||||||
author: collectionOwner.name,
|
author: collectionOwner.name,
|
||||||
count: collection.members.length,
|
count: collection.members.length,
|
||||||
})
|
})
|
||||||
|
: collection.members.length > 0 &&
|
||||||
|
collection.members.length !== 1
|
||||||
|
? t("by_author_and_others", {
|
||||||
|
author: collectionOwner.name,
|
||||||
|
count: collection.members.length,
|
||||||
|
})
|
||||||
: t("by_author", {
|
: t("by_author", {
|
||||||
author: collectionOwner.name,
|
author: collectionOwner.name,
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -220,11 +224,11 @@ export default function PublicCollections() {
|
||||||
placeholder={
|
placeholder={
|
||||||
collection._count?.links === 1
|
collection._count?.links === 1
|
||||||
? t("search_count_link", {
|
? t("search_count_link", {
|
||||||
count: collection._count?.links,
|
count: collection._count?.links,
|
||||||
})
|
})
|
||||||
: t("search_count_links", {
|
: t("search_count_links", {
|
||||||
count: collection._count?.links,
|
count: collection._count?.links,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</LinkListOptions>
|
</LinkListOptions>
|
||||||
|
|
Ŝarĝante…
Reference in New Issue