⚡️⚡️⚡️ 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
better looking view
daniel31x13c2a660fd5028
diff --git a/apps/web/components/DashboardLinks.tsx b/apps/web/components/DashboardLinks.tsxindex ee3966a0..ab8baef4 100644--- a/apps/web/components/DashboardLinks.tsx+++ b/apps/web/components/DashboardLinks.tsx@@ -37,7 +37,9 @@ export function DashboardLinks({isLoading?: boolean;}) {return (- <div className={`flex gap-5 overflow-x-auto hide-scrollbar w-full`}>+ <div+ className={`flex gap-5 overflow-x-auto overflow-y-hidden hide-scrollbar w-full min-h-72`}+ >{links?.map((e, i) => {return <Card key={i} link={e} />;})}@@ -162,7 +164,7 @@ export function Card({ link, editMode }: Props) {return (<divref={ref}- className={`${selectedStyle} w-60 border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-xl relative group`}+ className={`${selectedStyle} w-60 border border-solid border-neutral-content bg-base-200 duration-100 rounded-xl relative group`}onClick={() =>selectable? handleCheckboxClick(link)diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsxindex 7ac0bdd7..561add73 100644--- a/apps/web/pages/dashboard.tsx+++ b/apps/web/pages/dashboard.tsx@@ -24,6 +24,7 @@ import { DashboardLinks } from "@/components/DashboardLinks";import { ViewMode } from "@linkwarden/types";import ViewDropdown from "@/components/ViewDropdown";import clsx from "clsx";+import Icon from "@/components/Icon";export default function Dashboard() {const { t } = useTranslation();@@ -124,197 +125,9 @@ export default function Dashboard() {);};- const renderStatsSection = () => (- <div className="xl:flex flex flex-col sm:grid grid-cols-2 gap-4 xl:flex-row xl:justify-evenly xl:w-full">- <DashboardItem- name={numberOfLinks === 1 ? t("link") : t("links")}- value={numberOfLinks}- icon={"bi-link-45deg"}- />-- <DashboardItem- name={collections.length === 1 ? t("collection") : t("collections")}- value={collections.length}- icon={"bi-folder"}- />-- <DashboardItem- name={tags.length === 1 ? t("tag") : t("tags")}- value={tags.length}- icon={"bi-hash"}- />-- <DashboardItem- name={t("pinned")}- value={numberOfPinnedLinks}- icon={"bi-pin-angle"}- />- </div>- );-- const renderRecentLinksSection = () => (- <>- <div className="flex justify-between items-center mb-4">- <div className="flex gap-2 items-center">- <PageHeader icon={"bi-clock-history"} title={t("recent_links")} />- </div>- <Link- href="/links"- className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"- >- {t("view_all")}- <i className="bi-chevron-right text-sm"></i>- </Link>- </div>-- <div- style={{- flex: links || dashboardData.isLoading ? "0 1 auto" : "1 1 auto",- }}- className="flex flex-col 2xl:flex-row items-start 2xl:gap-2"- >- {dashboardData.isLoading ||- (links && links[0] && !dashboardData.isLoading) ? (- <DashboardLinks links={links} isLoading={dashboardData.isLoading} />- ) : (- <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")}- </p>-- <div className="text-center w-full mt-4 flex flex-wrap gap-4 justify-center">- <Button- onClick={() => {- setNewLinkModal(true);- }}- variant="accent"- >- <i className="bi-plus-lg text-xl"></i>- {t("add_link")}- </Button>-- <ImportDropdown />- </div>- </div>- )}- </div>- </>- );-- const renderPinnedLinksSection = () => (- <>- <div className="flex justify-between items-center mb-4">- <div className="flex gap-2 items-center">- <PageHeader icon={"bi-pin-angle"} title={t("pinned_links")} />- </div>- <Link- href="/links/pinned"- className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"- >- {t("view_all")}- <i className="bi-chevron-right text-sm "></i>- </Link>- </div>-- <div- style={{ flex: "1 1 auto" }}- className="flex flex-col 2xl:flex-row items-start 2xl:gap-2"- >- {dashboardData.isLoading ||- links?.some((e: any) => e.pinnedBy && e.pinnedBy[0]) ? (- <DashboardLinks- links={links.filter((e: any) => e.pinnedBy && e.pinnedBy[0])}- isLoading={dashboardData.isLoading}- />- ) : (- <div- style={{ flex: "1 1 auto" }}- 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-pin mx-auto text-6xl text-primary"></i>- <p className="text-center text-xl">- {t("pin_favorite_links_here")}- </p>- <p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm">- {t("pin_favorite_links_here_desc")}- </p>- </div>- )}- </div>- </>- );-- const renderCollectionSection = (section: DashboardSection) => {- const collection = collections.find((c) => c.id === section.collectionId);- if (!collection) return null;-- return (- <>- <div className="flex justify-between items-center mb-4">- <div className="flex gap-2 items-center">- <div className={clsx("flex items-center gap-3")}>- <i- className={`bi-folder-fill text-primary text-2xl drop-shadow`}- style={{ color: collection.color || "#0ea5e9" }}- ></i>- <div>- <p className="text-2xl capitalize font-thin">- {collection.name}- </p>- </div>- </div>- </div>- <Link- href={`/collections/${collection.id}`}- className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer whitespace-nowrap"- >- {t("view_all")}- <i className="bi-chevron-right text-sm"></i>- </Link>- </div>-- <div className="flex flex-col 2xl:flex-row items-start 2xl:gap-2">- {dashboardData.isLoading ||- links?.filter((link: any) => link.collection.id === collection.id)- .length > 0 ? (- <DashboardLinks- links={links.filter(- (link: any) => link.collection.id === collection.id- )}- isLoading={dashboardData.isLoading}- />- ) : (- <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_link_in_collection")}- </p>- </div>- )}- </div>- </>- );- };-- const renderSection = (section: DashboardSection) => {- switch (section.type) {- case DashboardSectionType.STATS:- return renderStatsSection();- case DashboardSectionType.RECENT_LINKS:- return renderRecentLinksSection();- case DashboardSectionType.PINNED_LINKS:- return renderPinnedLinksSection();- case DashboardSectionType.COLLECTION:- return renderCollectionSection(section);- default:- return null;- }- };-return (<MainLayout>- <div style={{ flex: "1 1 auto" }} className="p-5 flex flex-col gap-4">+ <div className="p-5 flex flex-col gap-4 h-full"><div className="flex items-center justify-between"><div className="flex items-center gap-2"><i className="bi-house-fill text-primary" />@@ -329,14 +142,21 @@ export default function Dashboard() {/></div></div>- {orderedSections?.map((section) => (- <div key={`${section.type}-${section.collectionId || "default"}`}>- {renderSection(section)}- </div>+ {orderedSections?.map((section, i) => (+ <Section+ key={i}+ sectionData={section}+ t={t}+ collection={collections.find((c) => c.id === section.collectionId)}+ links={links}+ tags={tags}+ numberOfLinks={numberOfLinks}+ collectionsLength={collections.length}+ numberOfPinnedLinks={numberOfPinnedLinks}+ dashboardData={dashboardData}+ setNewLinkModal={setNewLinkModal}+ />))}- {/* <div className="mx-auto w-fit">- <DashboardLayoutDropdown />- </div> */}</div>{showSurveyModal && (@@ -353,3 +173,195 @@ export default function Dashboard() {}export { getServerSideProps };++type SectionProps = {+ sectionData: DashboardSection;+ t: (key: string) => string;+ collection: any;+ collectionsLength: number;+ links: any[];+ tags: any[];+ numberOfLinks: number;+ numberOfPinnedLinks: number;+ dashboardData: any;+ setNewLinkModal: (value: boolean) => void;+};++const Section = ({+ sectionData,+ t,+ collection,+ links,+ tags,+ numberOfLinks,+ collectionsLength,+ numberOfPinnedLinks,+ dashboardData,+ setNewLinkModal,+}: SectionProps) => {+ switch (sectionData.type) {+ case DashboardSectionType.STATS:+ return (+ <div className="xl:flex flex flex-col sm:grid grid-cols-2 gap-4 xl:flex-row xl:justify-evenly xl:w-full">+ <DashboardItem+ name={numberOfLinks === 1 ? t("link") : t("links")}+ value={numberOfLinks}+ icon={"bi-link-45deg"}+ />++ <DashboardItem+ name={collectionsLength === 1 ? t("collection") : t("collections")}+ value={collectionsLength}+ icon={"bi-folder"}+ />++ <DashboardItem+ name={tags.length === 1 ? t("tag") : t("tags")}+ value={tags.length}+ icon={"bi-hash"}+ />++ <DashboardItem+ name={t("pinned")}+ value={numberOfPinnedLinks}+ icon={"bi-pin-angle"}+ />+ </div>+ );+ case DashboardSectionType.RECENT_LINKS:+ return (+ <>+ <div className="flex justify-between items-center">+ <div className="flex gap-2 items-center">+ <PageHeader icon={"bi-clock-history"} title={t("recent_links")} />+ </div>+ <Link+ href="/links"+ className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"+ >+ {t("view_all")}+ <i className="bi-chevron-right text-sm"></i>+ </Link>+ </div>++ {dashboardData.isLoading ||+ (links && links[0] && !dashboardData.isLoading) ? (+ <DashboardLinks links={links} isLoading={dashboardData.isLoading} />+ ) : (+ <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")}+ </p>++ <div className="text-center w-full mt-4 flex flex-wrap gap-4 justify-center">+ <Button+ onClick={() => {+ setNewLinkModal(true);+ }}+ variant="accent"+ >+ <i className="bi-plus-lg text-xl"></i>+ {t("add_link")}+ </Button>++ <ImportDropdown />+ </div>+ </div>+ )}+ </>+ );+ case DashboardSectionType.PINNED_LINKS:+ return (+ <>+ <div className="flex justify-between items-center">+ <div className="flex gap-2 items-center">+ <PageHeader icon={"bi-pin-angle"} title={t("pinned_links")} />+ </div>+ <Link+ href="/links/pinned"+ className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer"+ >+ {t("view_all")}+ <i className="bi-chevron-right text-sm "></i>+ </Link>+ </div>++ {dashboardData.isLoading ||+ links?.some((e: any) => e.pinnedBy && e.pinnedBy[0]) ? (+ <DashboardLinks+ links={links.filter((e: any) => e.pinnedBy && e.pinnedBy[0])}+ isLoading={dashboardData.isLoading}+ />+ ) : (+ <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-pin mx-auto text-6xl text-primary"></i>+ <p className="text-center text-xl">+ {t("pin_favorite_links_here")}+ </p>+ <p className="text-center mx-auto max-w-96 w-fit text-neutral text-sm">+ {t("pin_favorite_links_here_desc")}+ </p>+ </div>+ )}+ </>+ );+ case DashboardSectionType.COLLECTION:+ return (+ <>+ <div className="flex justify-between items-center">+ <div className="flex gap-2 items-center">+ <div className={clsx("flex items-center gap-3")}>+ {collection.icon ? (+ <Icon+ icon={collection.icon}+ color={collection.color || "#0ea5e9"}+ className="text-2xl"+ />+ ) : (+ <i+ className={`bi-folder-fill text-primary text-2xl drop-shadow`}+ style={{ color: collection.color || "#0ea5e9" }}+ ></i>+ )}+ <div>+ <p className="text-2xl capitalize font-thin">+ {collection.name}+ </p>+ </div>+ </div>+ </div>+ <Link+ href={`/collections/${collection.id}`}+ className="flex items-center text-sm text-black/75 dark:text-white/75 gap-2 cursor-pointer whitespace-nowrap"+ >+ {t("view_all")}+ <i className="bi-chevron-right text-sm"></i>+ </Link>+ </div>++ {dashboardData.isLoading ||+ links?.filter((link: any) => link.collection.id === collection.id)+ .length > 0 ? (+ <DashboardLinks+ links={links.filter(+ (link: any) => link.collection.id === collection.id+ )}+ isLoading={dashboardData.isLoading}+ />+ ) : (+ <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_link_in_collection")}+ </p>+ </div>+ )}+ </>+ );+ default:+ return null;+ }+};diff --git a/apps/web/public/locales/en/common.json b/apps/web/public/locales/en/common.jsonindex 8cc28407..c5e35555 100644--- a/apps/web/public/locales/en/common.json+++ b/apps/web/public/locales/en/common.json@@ -478,7 +478,7 @@"display_on_dashboard": "Display on Dashboard","dashboard_stats": "Dashboard Stats","no_results_found": "No results found.",- "no_link_in_collection": "No Link in this Collection.",+ "no_link_in_collection": "No Link in this Collection","theme": "Theme","font_family": "Font Family","font_size": "Font Size",