⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
Bug fixes
Isaaccefe5e9e1bd1
diff --git a/apps/web/components/DashboardLayoutDropdown.tsx b/apps/web/components/DashboardLayoutDropdown.tsxindex 32bee2f7..3c67b63e 100644--- a/apps/web/components/DashboardLayoutDropdown.tsx+++ b/apps/web/components/DashboardLayoutDropdown.tsx@@ -21,7 +21,6 @@ import {} from "@atlaskit/pragmatic-drag-and-drop/element/adapter";import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";import { reorder } from "@atlaskit/pragmatic-drag-and-drop/reorder";-import { triggerPostMoveFlash } from "@atlaskit/pragmatic-drag-and-drop-flourish/trigger-post-move-flash";interface DashboardSectionOption {type: DashboardSectionType;@@ -140,8 +139,7 @@ export default function DashboardLayoutDropdown() {return [...enabledSections, ...disabledSections];}, [allSections, searchTerm]);- const getSectionId = (section: DashboardSectionOption) =>- `${section.type}-${section.collectionId || "default"}`;+ const getSectionId = (section: DashboardSectionOption) => `${section.type}-${section.collectionId || "default"}`;// Set up drag and dropuseEffect(() => {@@ -184,7 +182,7 @@ export default function DashboardLayoutDropdown() {return section;});- console.log("Reordered sections:", updatedSections);+ console.log(updatedSections);updateDashboardLayout.mutateAsync(updatedSections);},@@ -192,16 +190,24 @@ export default function DashboardLayoutDropdown() {}, [filteredSections, updateDashboardLayout]);const handleCheckboxChange = (section: DashboardSectionOption) => {+ const enabledSections = allSections.filter(s => s.enabled);+ const highestOrder = enabledSections.length > 0+ ? Math.max(...enabledSections.map(s => s.order || 0))+ : -1;+const updatedSections = allSections.map((s) => {if (s.type === section.type && s.collectionId === section.collectionId) {return {...s,enabled: !s.enabled,+ order: !s.enabled ? highestOrder + 1 : s.order,};}return s;});+ console.log(updatedSections);+updateDashboardLayout.mutateAsync(updatedSections);};@@ -230,7 +236,6 @@ export default function DashboardLayoutDropdown() {key={getSectionId(section)}section={section}onCheckboxChange={handleCheckboxChange}- isDraggedOver={isDraggedOver === getSectionId(section)}isDragged={draggedItem === getSectionId(section)}setIsDraggedOver={setIsDraggedOver}setDraggedItem={setDraggedItem}@@ -252,7 +257,6 @@ export default function DashboardLayoutDropdown() {interface DraggableListItemProps {section: DashboardSectionOption;onCheckboxChange: (section: DashboardSectionOption) => void;- isDraggedOver: boolean;isDragged: boolean;setIsDraggedOver: (id: string | null) => void;setDraggedItem: (id: string | null) => void;@@ -261,7 +265,6 @@ interface DraggableListItemProps {function DraggableListItem({section,onCheckboxChange,- isDraggedOver,isDragged,setIsDraggedOver,setDraggedItem,@@ -309,19 +312,15 @@ function DraggableListItem({onChange={() => onCheckboxChange(section)}/><label- htmlFor={`section-${section.type}-${- section.collectionId || "default"- }`}- className="text-sm cursor-pointer"+ htmlFor={`section-${section.type}-${section.collectionId || "default"}`}+ className="text-sm select-none">{section.name}</label></div><i- className={`bi-grip-vertical text-neutral ${- section.enabled ? "cursor-grab" : "opacity-50"- }`}+ className={`bi-grip-vertical text-neutral ${section.enabled ? "cursor-grab" : "opacity-50"}`}/></li>);diff --git a/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts b/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.tsindex 8e0cbb17..2a917ab8 100644--- a/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts+++ b/apps/web/lib/api/controllers/dashboard/getDashboardDataV2.ts@@ -133,26 +133,9 @@ export default async function getDashboardData((link, index, self) => index === self.findIndex((t) => t.id === link.id));- const pinnedCollections = await prisma.dashboardSection.findMany({- where: {- userId,- type: "COLLECTION",- },- include: {- collection: {- include: {- links: {- take: 16,- },- },- },- },- });-return {data: {links: uniqueLinks,- pinnedCollections,numberOfPinnedLinks,},message: "Dashboard data fetched successfully.",diff --git a/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.ts b/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.tsindex ab8af240..073ed7f9 100644--- a/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.ts+++ b/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.ts@@ -13,9 +13,8 @@ export default async function updateDashboardLayout(if (!dataValidation.success) {console.log(dataValidation.error.issues[0].message);return {- response: `Error: ${- dataValidation.error.issues[0].message- } [${dataValidation.error.issues[0].path.join(", ")}]`,+ response: `Error: ${dataValidation.error.issues[0].message+ } [${dataValidation.error.issues[0].path.join(", ")}]`,status: 400,};}diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsxindex 698aca49..f6de3268 100644--- a/apps/web/pages/dashboard.tsx+++ b/apps/web/pages/dashboard.tsx@@ -57,7 +57,7 @@ export default function Dashboard() {user.referredBy === null &&// if user is using Linkwarden for more than 3 daysnew Date().getTime() - new Date(user.createdAt).getTime() >- 3 * 24 * 60 * 60 * 1000+ 3 * 24 * 60 * 60 * 1000) {setTimeout(() => {setShowsSurveyModal(true);@@ -145,7 +145,6 @@ export default function Dashboard() {);};- // Component renderers for each section typeconst renderStatsSection = () => (<div className="xl:flex flex flex-col sm:grid grid-cols-2 gap-3 xl:flex-row xl:justify-evenly xl:w-full"><DashboardItem@@ -176,7 +175,7 @@ export default function Dashboard() {const renderRecentLinksSection = () => (<>- <div className="flex justify-between items-center">+ <div className="flex justify-between items-center mb-4"><div className="flex gap-2 items-center"><PageHeadericon={"bi-clock-history"}@@ -220,7 +219,7 @@ export default function Dashboard() {/></div>) : (- <div className="flex flex-col justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200">+ <div className="flex flex-col gap-2 justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200"><p className="text-center text-xl">{t("view_added_links_here")}</p><p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm mt-2">{t("view_added_links_here_desc")}@@ -247,7 +246,7 @@ export default function Dashboard() {const renderPinnedLinksSection = () => (<>- <div className="flex justify-between items-center">+ <div className="flex justify-between items-center mb-4"><div className="flex gap-2 items-center"><PageHeadericon={"bi-pin-angle"}@@ -314,7 +313,7 @@ export default function Dashboard() {return (<>- <div className="flex justify-between items-center">+ <div className="flex justify-between items-center mb-4"><div className="flex gap-2 items-center"><PageHeadericon={"bi-folder"}@@ -341,7 +340,7 @@ export default function Dashboard() {/></div>) : links?.filter((link: any) => link.collection.id === collection.id)- .length > 0 ? (+ .length > 0 ? (<div className="w-full"><Linkslinks={links@@ -351,14 +350,11 @@ export default function Dashboard() {/></div>) : (- <div className="flex flex-col justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200">+ <div className="flex flex-col gap-2 justify-center h-full border border-solid border-neutral-content w-full mx-auto p-10 rounded-xl bg-base-200 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200"><i className="bi-folder mx-auto text-6xl text-primary"></i><p className="text-center text-xl">{t("no_links_in_collection")}</p>- <p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm">- {collection.name} {t("collection_is_empty")}- </p></div>)}</div>@@ -383,7 +379,7 @@ export default function Dashboard() {return (<MainLayout>- <div style={{ flex: "1 1 auto" }} className="p-5 flex flex-col gap-5">+ <div style={{ flex: "1 1 auto" }} className="p-5 flex flex-col gap-4"><div className="flex items-center justify-between"><PageHeadericon={"bi-house "}@@ -396,13 +392,8 @@ export default function Dashboard() {</div></div>- {/* Render sections in their specified order */}- {orderedSections.map((section, index) => (- <div- key={`${section.type}-${- section.collectionId || "default"- }-${index}`}- >+ {orderedSections.map((section) => (+ <div key={`${section.type}-${section.collectionId || "default"}`}>{renderSection(section)}</div>))}diff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.jsonindex 0f851246..c914a939 100644--- a/apps/web/public/locales/en/common.json+++ b/apps/web/public/locales/en/common.json@@ -476,5 +476,6 @@"links_being_archived": "Links are being archived...","display_on_dashboard": "Display on Dashboard","dashboard_stats": "Dashboard Stats",- "no_results_found": "No results found."-}+ "no_results_found": "No results found.",+ "no_links_in_collection": "No Links in this Collection."+}\ No newline at end of filediff --git a/packages/router/dashboardData.tsx b/packages/router/dashboardData.tsxindex 7e348f1b..b244ebba 100644--- a/packages/router/dashboardData.tsx+++ b/packages/router/dashboardData.tsx@@ -38,7 +38,6 @@ const useUpdateDashboardLayout = () => {},onSuccess: async () => {await queryClient.invalidateQueries({ queryKey: ["user"] });- await queryClient.invalidateQueries({ queryKey: ["dashboardData"] });},});};