⚡️⚡️⚡️ 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
format
Isaac4423a30a72e6
diff --git a/apps/web/components/DashboardLayoutDropdown.tsx b/apps/web/components/DashboardLayoutDropdown.tsxindex 3c67b63e..25799a5e 100644--- a/apps/web/components/DashboardLayoutDropdown.tsx+++ b/apps/web/components/DashboardLayoutDropdown.tsx@@ -36,7 +36,6 @@ export default function DashboardLayoutDropdown() {const { data: collections = [] } = useCollections();const updateDashboardLayout = useUpdateDashboardLayout();const [searchTerm, setSearchTerm] = useState("");- const [isDraggedOver, setIsDraggedOver] = useState<string | null>(null);const [draggedItem, setDraggedItem] = useState<string | null>(null);const dashboardSections: DashboardSection[] = user?.dashboardSections || [];@@ -115,14 +114,12 @@ export default function DashboardLayoutDropdown() {const filteredSections = useMemo(() => {let sections = allSections;- // Filter by search termif (searchTerm.trim()) {sections = sections.filter((section) =>section.name.toLowerCase().includes(searchTerm.toLowerCase()));}- // Separate and sort sectionsconst enabledSections = sections.filter((section) => section.enabled).sort((a, b) => {@@ -139,9 +136,11 @@ 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 drop+ // Improve this visuallyuseEffect(() => {return monitorForElements({onDrop({ source, location }) {@@ -182,18 +181,17 @@ export default function DashboardLayoutDropdown() {return section;});- console.log(updatedSections);-updateDashboardLayout.mutateAsync(updatedSections);},});}, [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 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) {@@ -206,8 +204,6 @@ export default function DashboardLayoutDropdown() {return s;});- console.log(updatedSections);-updateDashboardLayout.mutateAsync(updatedSections);};@@ -237,7 +233,6 @@ export default function DashboardLayoutDropdown() {section={section}onCheckboxChange={handleCheckboxChange}isDragged={draggedItem === getSectionId(section)}- setIsDraggedOver={setIsDraggedOver}setDraggedItem={setDraggedItem}/>))}@@ -258,7 +253,6 @@ interface DraggableListItemProps {section: DashboardSectionOption;onCheckboxChange: (section: DashboardSectionOption) => void;isDragged: boolean;- setIsDraggedOver: (id: string | null) => void;setDraggedItem: (id: string | null) => void;}@@ -266,7 +260,6 @@ function DraggableListItem({section,onCheckboxChange,isDragged,- setIsDraggedOver,setDraggedItem,}: DraggableListItemProps) {const [element, setElement] = useState<HTMLElement | null>(null);@@ -286,12 +279,9 @@ function DraggableListItem({dropTargetForElements({element: el,getData: () => ({ sectionId }),- onDragEnter: () => setIsDraggedOver(sectionId),- onDragLeave: () => setIsDraggedOver(null),- onDrop: () => setIsDraggedOver(null),}));- }, [element, section.enabled, sectionId, setDraggedItem, setIsDraggedOver]);+ }, [element, section.enabled, sectionId, setDraggedItem]);return (<li@@ -312,7 +302,9 @@ function DraggableListItem({onChange={() => onCheckboxChange(section)}/><label- htmlFor={`section-${section.type}-${section.collectionId || "default"}`}+ htmlFor={`section-${section.type}-${+ section.collectionId || "default"+ }`}className="text-sm select-none">{section.name}@@ -320,7 +312,9 @@ function DraggableListItem({</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/updateDashboardLayout.ts b/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.tsindex 073ed7f9..ab8af240 100644--- a/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.ts+++ b/apps/web/lib/api/controllers/dashboard/updateDashboardLayout.ts@@ -13,8 +13,9 @@ 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 f6de3268..5f1b8907 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);@@ -340,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={linksdiff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.jsonindex c914a939..ca3ca855 100644--- a/apps/web/public/locales/en/common.json+++ b/apps/web/public/locales/en/common.json@@ -478,4 +478,4 @@"dashboard_stats": "Dashboard Stats","no_results_found": "No results found.","no_links_in_collection": "No Links in this Collection."-}\ No newline at end of file+}