diff --git a/components/DashboardItem.tsx b/components/DashboardItem.tsx new file mode 100644 index 0000000..d891398 --- /dev/null +++ b/components/DashboardItem.tsx @@ -0,0 +1,29 @@ +import { IconProp } from "@fortawesome/fontawesome-svg-core"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +type Props = { + name: string; + value: number; + icon: IconProp; +}; + +export default function dashboardItem({ name, value, icon }: Props) { + return ( +
+
+ +
+
+

+ {name} +

+

+ {value} +

+
+
+ ); +} diff --git a/components/LinkCard.tsx b/components/LinkCard.tsx index 55b5d1b..5cc8a1b 100644 --- a/components/LinkCard.tsx +++ b/components/LinkCard.tsx @@ -165,7 +165,7 @@ export default function LinkCard({ link, count, className }: Props) { onClick={() => router.push("/links/" + link.id)} className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-5" > - {url && ( + {url && account.blurredFavicons && ( { e.stopPropagation(); }} - className="flex items-center gap-1 max-w-full w-fit my-3 hover:opacity-70 duration-100" + className="flex items-center gap-1 max-w-full w-fit my-1 hover:opacity-70 duration-100" >
+ + Linkwarden {LINKWARDEN_VERSION} +
{children} diff --git a/lib/api/controllers/users/userId/updateUserById.ts b/lib/api/controllers/users/userId/updateUserById.ts index 0043c8b..b8af062 100644 --- a/lib/api/controllers/users/userId/updateUserById.ts +++ b/lib/api/controllers/users/userId/updateUserById.ts @@ -132,6 +132,7 @@ export default async function updateUserById( archiveAsScreenshot: data.archiveAsScreenshot, archiveAsPDF: data.archiveAsPDF, archiveAsWaybackMachine: data.archiveAsWaybackMachine, + blurredFavicons: data.blurredFavicons, password: data.newPassword && data.newPassword !== "" ? newHashedPassword diff --git a/package.json b/package.json index 5f53bc2..a77e211 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "linkwarden", - "version": "1.0.0", + "version": "2.1.0", "main": "index.js", "repository": "https://github.com/Daniel31x13/link-warden.git", "author": "Daniel31X13 ", diff --git a/pages/collections/index.tsx b/pages/collections/index.tsx index a06ad6c..32459c6 100644 --- a/pages/collections/index.tsx +++ b/pages/collections/index.tsx @@ -44,7 +44,7 @@ export default function Collections() { Your Collections

-

+

Collections you own

@@ -150,7 +150,7 @@ export default function Collections() { Other Collections

-

+

Shared collections you're a member of

diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index 8729cc8..67823c0 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -5,6 +5,9 @@ import { faChevronRight, faClockRotateLeft, faFileImport, + faFolder, + faHashtag, + faLink, faThumbTack, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -22,6 +25,7 @@ import useModalStore from "@/store/modals"; import { toast } from "react-hot-toast"; import { MigrationFormat, MigrationRequest } from "@/types/global"; import ClickAwayHandler from "@/components/ClickAwayHandler"; +import DashboardItem from "@/components/DashboardItem"; export default function Dashboard() { const { collections } = useCollectionStore(); @@ -118,44 +122,47 @@ export default function Dashboard() { return (
-
-
- -

+

+ +
+

Dashboard

+ +

+ A brief overview of your data +

-
-
-

- {numberOfLinks} -

-

- {numberOfLinks === 1 ? "Link" : "Links"} -

-
+
+
+ -
-

- {collections.length} -

-

- {collections.length === 1 ? "Collection" : "Collections"} -

-
+
+
-
-

- {tags.length} -

-

- {tags.length === 1 ? "Tag" : "Tags"} -

+ + +
+
+ +
diff --git a/pages/links/index.tsx b/pages/links/index.tsx index 3fd46a1..5e57345 100644 --- a/pages/links/index.tsx +++ b/pages/links/index.tsx @@ -31,7 +31,7 @@ export default function Links() { All Links

-

+

Links from every Collections

diff --git a/pages/settings/account.tsx b/pages/settings/account.tsx index c9dbe65..525df84 100644 --- a/pages/settings/account.tsx +++ b/pages/settings/account.tsx @@ -9,7 +9,6 @@ import TextInput from "@/components/TextInput"; import { resizeImage } from "@/lib/client/resizeImage"; import ProfilePhoto from "@/components/ProfilePhoto"; import SubmitButton from "@/components/SubmitButton"; -import { useSession, signOut } from "next-auth/react"; import React from "react"; import { MigrationFormat, MigrationRequest } from "@/types/global"; import Link from "next/link"; @@ -17,8 +16,6 @@ import ClickAwayHandler from "@/components/ClickAwayHandler"; import Checkbox from "@/components/Checkbox"; export default function Account() { - const { update, data } = useSession(); - const emailEnabled = process.env.NEXT_PUBLIC_EMAIL_PROVIDER; const [submitLoader, setSubmitLoader] = useState(false); @@ -154,7 +151,7 @@ export default function Account() { return ( -
+
diff --git a/pages/settings/appearance.tsx b/pages/settings/appearance.tsx index 2ddde66..32d7473 100644 --- a/pages/settings/appearance.tsx +++ b/pages/settings/appearance.tsx @@ -2,37 +2,119 @@ import SettingsLayout from "@/layouts/SettingsLayout"; import { useTheme } from "next-themes"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faSun, faMoon } from "@fortawesome/free-solid-svg-icons"; +import { useState, useEffect } from "react"; +import { faClose } from "@fortawesome/free-solid-svg-icons"; +import useAccountStore from "@/store/account"; +import { AccountSettings } from "@/types/global"; +import { toast } from "react-hot-toast"; +import TextInput from "@/components/TextInput"; +import { resizeImage } from "@/lib/client/resizeImage"; +import ProfilePhoto from "@/components/ProfilePhoto"; +import SubmitButton from "@/components/SubmitButton"; +import React from "react"; +import Checkbox from "@/components/Checkbox"; export default function Appearance() { const { theme, setTheme } = useTheme(); + const submit = async () => { + setSubmitLoader(true); + + const load = toast.loading("Applying..."); + + const response = await updateAccount({ + ...user, + }); + + toast.dismiss(load); + + if (response.ok) { + toast.success("Settings Applied!"); + } else toast.error(response.data as string); + setSubmitLoader(false); + }; + + const [submitLoader, setSubmitLoader] = useState(false); + + const { account, updateAccount } = useAccountStore(); + + const [user, setUser] = useState( + !objectIsEmpty(account) + ? account + : ({ + // @ts-ignore + id: null, + name: "", + username: "", + email: "", + emailVerified: null, + blurredFavicons: null, + image: "", + isPrivate: true, + // @ts-ignore + createdAt: null, + whitelistedUsers: [], + } as unknown as AccountSettings) + ); + + function objectIsEmpty(obj: object) { + return Object.keys(obj).length === 0; + } + + useEffect(() => { + if (!objectIsEmpty(account)) setUser({ ...account }); + }, [account]); + return ( -

Select Theme

-
-
setTheme("dark")} - > - -

Dark Theme

+
+
+

Select Theme

+
+
setTheme("dark")} + > + +

Dark Theme

- {/*
*/} + {/*
*/} +
+
setTheme("light")} + > + +

Light Theme

+ {/*
*/} +
+
-
setTheme("light")} - > - -

Light Theme

- {/*
*/} + +
+ + setUser({ ...user, blurredFavicons: !user.blurredFavicons }) + } + />
+ +
); diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx index 953d1ee..75c0fd8 100644 --- a/pages/settings/billing.tsx +++ b/pages/settings/billing.tsx @@ -11,7 +11,7 @@ export default function Billing() { return ( -
+

To manage/cancel your subsciption, visit the{" "}