Skip to content

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

improvements

daniel31x13c9c394168810
diff --git a/apps/web/components/DashboardItem.tsx b/apps/web/components/DashboardItem.tsx
index 3d818996..646404ef 100644
--- a/apps/web/components/DashboardItem.tsx
+++ b/apps/web/components/DashboardItem.tsx
@@ -8,8 +8,8 @@ export default function dashboardItem({
icon: string;
}) {
return (
- <div className="flex items-center justify-between w-full rounded-xl border border-neutral-content p-3 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200">
- <div className="w-14 aspect-square flex justify-center items-center bg-primary/20 rounded-xl select-none">
+ <div className="flex items-center justify-between w-full rounded-xl border border-neutral-content p-2 bg-gradient-to-tr from-neutral-content/70 to-50% to-base-200">
+ <div className="w-12 aspect-square flex justify-center items-center bg-primary/20 rounded-xl select-none">
<i className={`${icon} text-primary text-3xl drop-shadow`}></i>
</div>
<div className="ml-4 flex flex-col justify-center">
diff --git a/apps/web/components/DashboardLinks.tsx b/apps/web/components/DashboardLinks.tsx
index 6dbd06ad..d9201413 100644
--- a/apps/web/components/DashboardLinks.tsx
+++ b/apps/web/components/DashboardLinks.tsx
@@ -162,7 +162,7 @@ export function Card({ link, editMode }: Props) {
return (
<div
ref={ref}
- className={`${selectedStyle} w-52 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 shadow-md hover:shadow-none duration-100 rounded-xl relative group`}
onClick={() =>
selectable
? handleCheckboxClick(link)
@@ -172,7 +172,7 @@ export function Card({ link, editMode }: Props) {
}
>
<div
- className="rounded-xl cursor-pointer h-full w-52 flex flex-col justify-between"
+ className="rounded-xl cursor-pointer h-full w-60 flex flex-col justify-between"
onClick={() =>
!editMode && openLink(link, user, () => setLinkModal(true))
}
@@ -239,6 +239,7 @@ export function Card({ link, editMode }: Props) {
<LinkCollection link={link} collection={collection} />
</div>
)}
+ {show.date && <LinkDate link={link} />}
</div>
</div>
)}
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx b/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx
index dabc3a19..355af99d 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkCard.tsx
@@ -228,7 +228,7 @@ export default function LinkCard({ link, columns, editMode }: Props) {
{(show.collection || show.date) && (
<div>
- <hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
+ <hr className="divider mt-0 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
<div className="flex justify-between items-center text-xs text-neutral px-3 pb-1 gap-2">
{show.collection && !isPublicRoute && (
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkDate.tsx b/apps/web/components/LinkViews/LinkComponents/LinkDate.tsx
index b79146d5..5bce1de0 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkDate.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkDate.tsx
@@ -16,7 +16,7 @@ export default function LinkDate({
return (
<div className="flex items-center gap-1 text-neutral min-w-fit">
- <i className="bi-calendar3 text-lg"></i>
+ <i className="bi-calendar3 text-"></i>
<p>{formattedDate}</p>
</div>
);
diff --git a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
index 6a19c29d..f52a6977 100644
--- a/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
+++ b/apps/web/components/LinkViews/LinkComponents/LinkMasonry.tsx
@@ -247,7 +247,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
{(show.collection || show.date) && (
<div>
- <hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
+ <hr className="divider mt-0 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
<div className="flex flex-wrap justify-between items-center text-xs text-neutral px-3 pb-1 w-full gap-x-2">
{!isPublicRoute && show.collection && (
diff --git a/apps/web/components/PageHeader.tsx b/apps/web/components/PageHeader.tsx
index 50e8c135..1429dad4 100644
--- a/apps/web/components/PageHeader.tsx
+++ b/apps/web/components/PageHeader.tsx
@@ -14,9 +14,9 @@ export default function PageHeader({
}) {
return (
<div className={clsx("flex items-center gap-3", className)}>
- <i className={`${icon} text-primary sm:text-3xl text-xl drop-shadow`}></i>
+ <i className={`${icon} text-primary text-2xl drop-shadow`}></i>
<div>
- <p className="text-3xl capitalize font-thin">{title}</p>
+ <p className="text-2xl capitalize font-thin">{title}</p>
<p className="text-xs sm:text-sm">{description}</p>
</div>
</div>
diff --git a/apps/web/components/ViewDropdown.tsx b/apps/web/components/ViewDropdown.tsx
index bb780d75..c60e3ce2 100644
--- a/apps/web/components/ViewDropdown.tsx
+++ b/apps/web/components/ViewDropdown.tsx
@@ -1,4 +1,3 @@
-import * as React from "react";
import {
DropdownMenu,
DropdownMenuTrigger,
@@ -10,17 +9,23 @@ import useLocalSettingsStore from "@/store/localSettings";
import { ViewMode } from "@linkwarden/types";
import { useTranslation } from "next-i18next";
import { Button } from "@/components/ui/button";
+import { useEffect } from "react";
type Props = {
viewMode: ViewMode;
setViewMode: React.Dispatch<React.SetStateAction<ViewMode>>;
+ dashboard?: boolean;
};
-export default function ViewDropdown({ viewMode, setViewMode }: Props) {
+export default function ViewDropdown({
+ viewMode,
+ setViewMode,
+ dashboard,
+}: Props) {
const { settings, updateSettings } = useLocalSettingsStore((s) => s);
const { t } = useTranslation();
- React.useEffect(() => {
+ useEffect(() => {
updateSettings({ viewMode });
}, [viewMode, updateSettings]);
@@ -42,9 +47,9 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
const visibleShows = (
Object.keys(settings.show) as (keyof typeof settings.show)[]
).filter((key) => {
- if (settings.viewMode === ViewMode.List)
+ if (!dashboard && settings.viewMode === ViewMode.List)
return key !== "tags" && key !== "image" && key !== "description";
- if (settings.viewMode === ViewMode.Card)
+ if (dashboard || settings.viewMode === ViewMode.Card)
return key !== "tags" && key !== "description";
return true;
});
@@ -53,7 +58,7 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon">
- {viewMode === ViewMode.Card ? (
+ {dashboard || viewMode === ViewMode.Card ? (
<i className="bi-grid text-neutral"></i>
) : viewMode === ViewMode.Masonry ? (
<i className="bi-columns-gap text-neutral"></i>
@@ -64,42 +69,48 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
</DropdownMenuTrigger>
<DropdownMenuContent sideOffset={4} align="end">
- <div className="px-1">
- <p className="text-sm text-neutral">{t("view")}</p>
- <div className="flex gap-1 border-border">
- {[ViewMode.Card, ViewMode.Masonry, ViewMode.List].map((mode) => {
- const Icon =
- mode === ViewMode.Card
- ? () => <i className="bi-grid w-4 h-4 text-neutral" />
- : mode === ViewMode.Masonry
- ? () => (
- <i className="bi-columns-gap w-4 h-4 text-neutral" />
- )
- : () => (
- <i className="bi-view-stacked w-4 h-4 text-neutral" />
- );
+ {!dashboard && (
+ <>
+ <div className="px-1">
+ <p className="text-sm text-neutral">{t("view")}</p>
+ <div className="flex gap-1 border-border">
+ {[ViewMode.Card, ViewMode.Masonry, ViewMode.List].map(
+ (mode) => {
+ const Icon =
+ mode === ViewMode.Card
+ ? () => <i className="bi-grid w-4 h-4 text-neutral" />
+ : mode === ViewMode.Masonry
+ ? () => (
+ <i className="bi-columns-gap w-4 h-4 text-neutral" />
+ )
+ : () => (
+ <i className="bi-view-stacked w-4 h-4 text-neutral" />
+ );
- return (
- <Button
- key={mode}
- variant="ghost"
- size="sm"
- onClick={() => onChangeViewMode(mode)}
- className={
- `flex-1 ` +
- (viewMode === mode
- ? "bg-primary/20 hover:bg-primary/20"
- : "hover:bg-neutral/20")
+ return (
+ <Button
+ key={mode}
+ variant="ghost"
+ size="sm"
+ onClick={() => onChangeViewMode(mode)}
+ className={
+ `flex-1 ` +
+ (viewMode === mode
+ ? "bg-primary/20 hover:bg-primary/20"
+ : "hover:bg-neutral/20")
+ }
+ >
+ <Icon />
+ </Button>
+ );
}
- >
- <Icon />
- </Button>
- );
- })}
- </div>
- </div>
+ )}
+ </div>
+ </div>
- <DropdownMenuSeparator />
+ <DropdownMenuSeparator />
+ </>
+ )}
<p className="text-sm text-neutral px-1">{t("show")}</p>
{visibleShows.map((key) => (
@@ -115,7 +126,7 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
</DropdownMenuCheckboxItem>
))}
- {settings.viewMode !== ViewMode.List && (
+ {!dashboard && settings.viewMode !== ViewMode.List && (
<>
<DropdownMenuSeparator />
diff --git a/apps/web/package.json b/apps/web/package.json
index da32b4d7..42a371c4 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,6 +1,6 @@
{
"name": "@linkwarden/web",
- "version": "v2.10.3",
+ "version": "v2.11.0",
"main": "index.js",
"repository": "https://github.com/linkwarden/linkwarden.git",
"author": "Daniel31X13 <[email protected]>",
diff --git a/apps/web/pages/dashboard.tsx b/apps/web/pages/dashboard.tsx
index b66b1546..c7f61ac7 100644
--- a/apps/web/pages/dashboard.tsx
+++ b/apps/web/pages/dashboard.tsx
@@ -11,7 +11,6 @@ import { useTranslation } from "next-i18next";
import { useCollections } from "@linkwarden/router/collections";
import { useTags } from "@linkwarden/router/tags";
import { useDashboardData } from "@linkwarden/router/dashboardData";
-import useLocalSettingsStore from "@/store/localSettings";
import { useUpdateUser, useUser } from "@linkwarden/router/user";
import SurveyModal from "@/components/ModalContent/SurveyModal";
import ImportDropdown from "@/components/ImportDropdown";
@@ -22,6 +21,9 @@ import {
DashboardSectionType,
} from "@linkwarden/prisma/client";
import { DashboardLinks } from "@/components/DashboardLinks";
+import { ViewMode } from "@linkwarden/types";
+import ViewDropdown from "@/components/ViewDropdown";
+import clsx from "clsx";
export default function Dashboard() {
const { t } = useTranslation();
@@ -34,8 +36,6 @@ export default function Dashboard() {
const { data: user } = useUser();
const [numberOfLinks, setNumberOfLinks] = useState(0);
- const [showRecentLinks, setShowRecentLinks] = useState(false);
- const [showPinnedLinks, setShowPinnedLinks] = useState(false);
const [dashboardSections, setDashboardSections] = useState<
DashboardSection[]
@@ -45,7 +45,9 @@ export default function Dashboard() {
setDashboardSections(user?.dashboardSections || []);
}, [user?.dashboardSections]);
- const { settings } = useLocalSettingsStore();
+ const [viewMode, setViewMode] = useState<ViewMode>(
+ (localStorage.getItem("viewMode") as ViewMode) || ViewMode.Card
+ );
useEffect(() => {
setNumberOfLinks(
@@ -85,18 +87,6 @@ export default function Dashboard() {
});
}, [dashboardSections]);
- useEffect(() => {
- const recentLinks = dashboardSections.some(
- (section) => section.type === "RECENT_LINKS"
- );
- const pinnedLinks = dashboardSections.some(
- (section) => section.type === "PINNED_LINKS"
- );
-
- setShowRecentLinks(recentLinks || false);
- setShowPinnedLinks(pinnedLinks || false);
- }, [dashboardSections]);
-
const [newLinkModal, setNewLinkModal] = useState(false);
const [showSurveyModal, setShowsSurveyModal] = useState(false);
@@ -135,7 +125,7 @@ export default function Dashboard() {
};
const renderStatsSection = () => (
- <div className="xl:flex flex flex-col sm:grid grid-cols-2 gap-3 xl:flex-row xl:justify-evenly xl:w-full">
+ <div className="flex gap-3 w-fit">
<DashboardItem
name={numberOfLinks === 1 ? t("link") : t("links")}
value={numberOfLinks}
@@ -166,11 +156,7 @@ export default function Dashboard() {
<>
<div className="flex justify-between items-center mb-4">
<div className="flex gap-2 items-center">
- <PageHeader
- icon={"bi-clock-history"}
- title={t("recent")}
- description={t("recent_links_desc")}
- />
+ <PageHeader icon={"bi-clock-history"} title={t("recent_links")} />
</div>
<Link
href="/links"
@@ -220,11 +206,7 @@ export default function Dashboard() {
<>
<div className="flex justify-between items-center mb-4">
<div className="flex gap-2 items-center">
- <PageHeader
- icon={"bi-pin-angle"}
- title={t("pinned")}
- description={t("pinned_links_desc")}
- />
+ <PageHeader icon={"bi-pin-angle"} title={t("pinned_links")} />
</div>
<Link
href="/links/pinned"
@@ -271,15 +253,21 @@ export default function Dashboard() {
<>
<div className="flex justify-between items-center mb-4">
<div className="flex gap-2 items-center">
- <PageHeader
- icon={"bi-folder"}
- title={collection.name}
- description={`${collection._count?.links || 0} ${t("links")}`}
- />
+ <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"
+ 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>
@@ -335,6 +323,11 @@ export default function Dashboard() {
/>
<div className="flex items-center gap-3">
<DashboardLayoutDropdown />
+ <ViewDropdown
+ viewMode={viewMode}
+ setViewMode={setViewMode}
+ dashboard
+ />
</div>
</div>
diff --git a/apps/web/pages/links/index.tsx b/apps/web/pages/links/index.tsx
index 195e16dd..664c7897 100644
--- a/apps/web/pages/links/index.tsx
+++ b/apps/web/pages/links/index.tsx
@@ -9,6 +9,7 @@ import LinkListOptions from "@/components/LinkListOptions";
import getServerSideProps from "@/lib/client/getServerSideProps";
import { useTranslation } from "next-i18next";
import Links from "@/components/LinkViews/Links";
+import clsx from "clsx";
export default function Index() {
const { t } = useTranslation();
@@ -45,11 +46,15 @@ export default function Index() {
setEditMode={setEditMode}
links={links}
>
- <PageHeader
- icon={"bi-link-45deg"}
- title={t("all_links")}
- description={t("all_links_desc")}
- />
+ <div className={clsx("flex items-center gap-3")}>
+ <i
+ className={`bi-link-45deg text-primary text-3xl drop-shadow`}
+ ></i>
+ <div>
+ <p className="text-2xl capitalize font-thin">{t("all_links")}</p>
+ <p className="text-xs sm:text-sm">{t("all_links_desc")}</p>
+ </div>
+ </div>
</LinkListOptions>
{!data.isLoading && links && !links[0] && (