Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Add RSS Feed button

Isaac Wisee04997c8c47e
diff --git a/components/LinkListOptions.tsx b/components/LinkListOptions.tsx
index 8a2c0fb2..279917c5 100644
--- a/components/LinkListOptions.tsx
+++ b/components/LinkListOptions.tsx
@@ -113,11 +113,10 @@ const LinkListOptions = ({
setEditMode(!editMode);
setSelectedLinks([]);
}}
- className={`btn btn-square btn-sm btn-ghost ${
- editMode
+ className={`btn btn-square btn-sm btn-ghost ${editMode
? "bg-primary/20 hover:bg-primary/20"
: "hover:bg-neutral/20"
- }`}
+ }`}
>
<i className="bi-pencil-fill text-neutral text-xl"></i>
</div>
diff --git a/pages/public/collections/[id]/index.tsx b/pages/public/collections/[id]/index.tsx
index e07ec8dd..5d2c994b 100644
--- a/pages/public/collections/[id]/index.tsx
+++ b/pages/public/collections/[id]/index.tsx
@@ -23,6 +23,7 @@ import LinkListOptions from "@/components/LinkListOptions";
import { usePublicLinks } from "@/hooks/store/publicLinks";
import Links from "@/components/LinkViews/Links";
import { usePublicTags } from "@/hooks/store/publicTags";
+import clsx from "clsx";
export default function PublicCollections() {
const { t } = useTranslation();
@@ -39,22 +40,22 @@ export default function PublicCollections() {
if (tag) {
Object.keys(searchFilter).forEach(
(v) =>
- (searchFilter[
- v as keyof {
- name: boolean;
- url: boolean;
- description: boolean;
- tags: boolean;
- textContent: boolean;
- }
- ] = false)
+ (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);
@@ -121,9 +122,8 @@ export default function PublicCollections() {
<div
className="h-96"
style={{
- backgroundImage: `linear-gradient(${collection?.color}30 10%, ${
- settings.theme === "dark" ? "#262626" : "#f3f4f6"
- } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
+ backgroundImage: `linear-gradient(${collection?.color}30 10%, ${settings.theme === "dark" ? "#262626" : "#f3f4f6"
+ } 13rem, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}}
>
{collection && (
@@ -142,6 +142,12 @@ export default function PublicCollections() {
{collection.name}
</p>
<div className="flex gap-2 items-center mt-8 min-w-fit">
+ <div className="tooltip tooltip-bottom" data-tip={t("rss_feed")}>
+ <Link href={`/public/collections/${collection.id}/rss`} target="_blank" className="text-neutral btn btn-ghost btn-sm size-8">
+ <i className="bi bi-rss text-xl"></i>
+ </Link>
+ </div>
+
<ToggleDarkMode />
<Link href="https://linkwarden.app/" target="_blank">
@@ -194,20 +200,20 @@ export default function PublicCollections() {
<p className="text-neutral text-sm">
{collection.members.length > 0 &&
- collection.members.length === 1
+ collection.members.length === 1
? 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,
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", {
- author: collectionOwner.name,
- })}
+ author: collectionOwner.name,
+ })}
</p>
</div>
</div>
@@ -231,11 +237,11 @@ export default function PublicCollections() {
placeholder={
collection._count?.links === 1
? t("search_count_link", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
: t("search_count_links", {
- count: collection._count?.links,
- })
+ count: collection._count?.links,
+ })
}
/>
</LinkListOptions>
@@ -246,11 +252,10 @@ export default function PublicCollections() {
onClick={() => handleTagSelection(undefined)}
>
<div
- className={`${
- !router.query.q
- ? "bg-primary/20"
- : "bg-neutral-content/20 hover:bg-neutral/20"
- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
+ className={`${!router.query.q
+ ? "bg-primary/20"
+ : "bg-neutral-content/20 hover:bg-neutral/20"
+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
>
<p className="truncate px-3">{t("all_links")}</p>
</div>
@@ -268,11 +273,10 @@ export default function PublicCollections() {
onClick={() => handleTagSelection(e)}
>
<div
- className={`${
- active
- ? "bg-primary/20"
- : "bg-neutral-content/20 hover:bg-neutral/20"
- } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
+ className={`${active
+ ? "bg-primary/20"
+ : "bg-neutral-content/20 hover:bg-neutral/20"
+ } duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 rounded-md h-8`}
>
<i className="bi-hash text-2xl text-primary drop-shadow"></i>
<p className="truncate pr-3">{e}</p>
diff --git a/pages/public/collections/[id]/rss.tsx b/pages/public/collections/[id]/rss.tsx
index 1cc793e4..c6592bee 100644
--- a/pages/public/collections/[id]/rss.tsx
+++ b/pages/public/collections/[id]/rss.tsx
@@ -21,8 +21,13 @@ export const getServerSideProps: GetServerSideProps = async ({ params, res, req
isPublic: true,
},
include: {
- links: true,
- }
+ links: {
+ orderBy: {
+ createdAt: 'desc',
+ },
+ take: 20,
+ }
+ },
})
if (!data) {
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 80f69c03..c2143a2f 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -444,5 +444,6 @@
"rss_deletion_confirmation": "Are you sure you want to delete this RSS Subscription?",
"new_rss_subscription": "New RSS Subscription",
"rss_subscription_deleted": "RSS Subscription deleted!",
- "create_rss_subscription": "Create RSS Subscription"
+ "create_rss_subscription": "Create RSS Subscription",
+ "rss_feed": "RSS Feed"
}
\ No newline at end of file