From a9d7303359d34be5bc4a28e22114f3aebaf648c4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 5 Jun 2023 13:24:43 +0330 Subject: [PATCH] many visual changes and improvements --- components/Dashboard/LinkItem.tsx | 2 +- components/Dropdown.tsx | 2 +- components/FilterSearchDropdown.tsx | 57 +++++++ components/LinkList.tsx | 12 +- components/Modal/ChangePassword.tsx | 8 +- .../Modal/Collection/CollectionInfo.tsx | 12 +- .../Modal/Collection/TeamManagement.tsx | 12 +- components/Modal/LinkModal.tsx | 8 +- components/Modal/UserSettings.tsx | 21 +-- components/PublicPage/LinkList.tsx | 2 +- components/{Sidebar/index.tsx => Sidebar.tsx} | 98 ++++++------ components/Sidebar/SidebarItem.tsx | 49 ------ components/SortLinkDropdown.tsx | 2 +- lib/api/controllers/tags/getTags.ts | 1 + lib/api/db.ts | 7 + pages/api/avatar/[id].ts | 1 - pages/collections/index.tsx | 4 +- pages/dashboard.tsx | 2 +- pages/links.tsx | 2 +- pages/{search.tsx => search/[query].tsx} | 51 +----- pages/search/index.tsx | 146 ++++++++++++++++++ pages/tags/[id].tsx | 2 +- .../migration.sql | 2 +- prisma/schema.prisma | 2 +- 24 files changed, 311 insertions(+), 194 deletions(-) create mode 100644 components/FilterSearchDropdown.tsx rename components/{Sidebar/index.tsx => Sidebar.tsx} (55%) delete mode 100644 components/Sidebar/SidebarItem.tsx rename pages/{search.tsx => search/[query].tsx} (70%) create mode 100644 pages/search/index.tsx rename prisma/migrations/{20230602115917_init => 20230605090235_init}/migration.sql (98%) diff --git a/components/Dashboard/LinkItem.tsx b/components/Dashboard/LinkItem.tsx index cab9461..b3ff801 100644 --- a/components/Dashboard/LinkItem.tsx +++ b/components/Dashboard/LinkItem.tsx @@ -85,7 +85,7 @@ export default function ({ link, count }: Props) {
- +

{link.collection.name}

diff --git a/components/Dropdown.tsx b/components/Dropdown.tsx index 7412b7c..58e71b7 100644 --- a/components/Dropdown.tsx +++ b/components/Dropdown.tsx @@ -24,7 +24,7 @@ export default function Dropdown({ onClickOutside, className, items }: Props) { return ( {items.map((e, i) => { const inner = ( diff --git a/components/FilterSearchDropdown.tsx b/components/FilterSearchDropdown.tsx new file mode 100644 index 0000000..fc99546 --- /dev/null +++ b/components/FilterSearchDropdown.tsx @@ -0,0 +1,57 @@ +import React, { SetStateAction } from "react"; +import ClickAwayHandler from "./ClickAwayHandler"; +import Checkbox from "./Checkbox"; +import { SearchSettings } from "@/types/global"; + +type Props = { + setFilterDropdown: (value: SetStateAction) => void; + toggleCheckbox: ( + name: "name" | "title" | "url" | "collection" | "tags" + ) => void; + searchSettings: SearchSettings; +}; + +export default function FilterSearchDropdown({ + setFilterDropdown, + toggleCheckbox, + searchSettings, +}: Props) { + return ( + { + const target = e.target as HTMLInputElement; + if (target.id !== "filter-dropdown") setFilterDropdown(false); + }} + className="absolute top-8 right-0 shadow-md bg-gray-50 rounded-md p-2 z-20 w-40" + > +

Filter by

+
+ toggleCheckbox("name")} + /> + toggleCheckbox("url")} + /> + toggleCheckbox("title")} + /> + toggleCheckbox("collection")} + /> + toggleCheckbox("tags")} + /> +
+
+ ); +} diff --git a/components/LinkList.tsx b/components/LinkList.tsx index 99e580b..2ab9fec 100644 --- a/components/LinkList.tsx +++ b/components/LinkList.tsx @@ -78,22 +78,26 @@ export default function ({ link, count }: Props) {
-

{count + 1}.

+

{count + 1}.

{link.name}

{link.title}

- +

{link.collection.name}

-
+
{link.tags.map((e, i) => ( -

+

{e.name}

diff --git a/components/Modal/ChangePassword.tsx b/components/Modal/ChangePassword.tsx index 43356e0..89635e1 100644 --- a/components/Modal/ChangePassword.tsx +++ b/components/Modal/ChangePassword.tsx @@ -34,7 +34,7 @@ export default function ChangePassword({

Change Password

-

Old Password

+

Old Password

-

New Password

+

New Password

-

Re-enter New Password

+

Re-enter New Password

Save diff --git a/components/Modal/Collection/CollectionInfo.tsx b/components/Modal/Collection/CollectionInfo.tsx index 202e812..66546c8 100644 --- a/components/Modal/Collection/CollectionInfo.tsx +++ b/components/Modal/Collection/CollectionInfo.tsx @@ -47,7 +47,7 @@ export default function CollectionInfo({
-

+

Name

@@ -63,9 +63,7 @@ export default function CollectionInfo({ />
-

- Icon Color -

+

Icon Color

- setCollection({ ...collection, color: "#7dd3fc" }) + setCollection({ ...collection, color: "#0ea5e9" }) } > Reset @@ -90,7 +88,7 @@ export default function CollectionInfo({
-

Description

+

Description