From 3dfbccaf23fc8eaa12613557cb0a6fa39cc1fed4 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Thu, 9 Nov 2023 11:44:49 -0500 Subject: [PATCH 1/2] better looking dashboard --- components/DashboardItem.tsx | 29 ++++++++++++++ components/SettingsSidebar.tsx | 9 +++++ layouts/MainLayout.tsx | 6 +-- package.json | 2 +- pages/collections/index.tsx | 4 +- pages/dashboard.tsx | 69 +++++++++++++++++++--------------- pages/links/index.tsx | 2 +- styles/globals.css | 4 -- 8 files changed, 83 insertions(+), 42 deletions(-) create mode 100644 components/DashboardItem.tsx diff --git a/components/DashboardItem.tsx b/components/DashboardItem.tsx new file mode 100644 index 0000000..38d6c16 --- /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/SettingsSidebar.tsx b/components/SettingsSidebar.tsx index ac9a7b7..787217c 100644 --- a/components/SettingsSidebar.tsx +++ b/components/SettingsSidebar.tsx @@ -20,6 +20,8 @@ import { } from "@fortawesome/free-brands-svg-icons"; export default function SettingsSidebar({ className }: { className?: string }) { + const LINKWARDEN_VERSION = "v2.1.0"; + const { collections } = useCollectionStore(); const router = useRouter(); @@ -136,6 +138,13 @@ export default function SettingsSidebar({ className }: { className?: string }) {
+ + Linkwarden {LINKWARDEN_VERSION} +
{children} 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/styles/globals.css b/styles/globals.css index 82b1178..5769211 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -176,10 +176,6 @@ body { padding: 0; } -.sky-shadow { - box-shadow: 0px 0px 3px #0ea5e9; -} - .primary-btn-gradient { box-shadow: inset 0px -10px 10px #0071b7; } From e3b32fd791cac6e1bcceca1e3da3ce99179eea43 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Fri, 10 Nov 2023 22:32:56 -0500 Subject: [PATCH 2/2] improved dashboard design + blurred icons based on personal preferences --- components/DashboardItem.tsx | 6 +- components/LinkCard.tsx | 4 +- .../users/userId/updateUserById.ts | 1 + pages/settings/account.tsx | 5 +- pages/settings/appearance.tsx | 126 +++++++++++++++--- pages/settings/billing.tsx | 2 +- pages/settings/delete.tsx | 2 +- .../migration.sql | 2 + prisma/schema.prisma | 2 + 9 files changed, 117 insertions(+), 33 deletions(-) create mode 100644 prisma/migrations/20231110154938_add_blurred_favicons_field/migration.sql diff --git a/components/DashboardItem.tsx b/components/DashboardItem.tsx index 38d6c16..d891398 100644 --- a/components/DashboardItem.tsx +++ b/components/DashboardItem.tsx @@ -9,8 +9,8 @@ type Props = { 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" > -
+
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{" "}