diff --git a/components/InputSelect/CollectionSelection.tsx b/components/InputSelect/CollectionSelection.tsx index 79957d93..e202d6ec 100644 --- a/components/InputSelect/CollectionSelection.tsx +++ b/components/InputSelect/CollectionSelection.tsx @@ -54,7 +54,7 @@ export default function ({ onChange, defaultValue }: Props) { options={options} styles={styles} defaultValue={defaultValue} - menuPosition="fixed" + // menuPosition="fixed" /> ); } diff --git a/components/InputSelect/TagSelection.tsx b/components/InputSelect/TagSelection.tsx index ca3c7a65..9f277ebe 100644 --- a/components/InputSelect/TagSelection.tsx +++ b/components/InputSelect/TagSelection.tsx @@ -37,7 +37,7 @@ export default function ({ onChange, defaultValue }: Props) { options={options} styles={styles} defaultValue={defaultValue} - menuPosition="fixed" + // menuPosition="fixed" isMulti /> ); diff --git a/components/InputSelect/styles.ts b/components/InputSelect/styles.ts index 967ce64b..c24357f6 100644 --- a/components/InputSelect/styles.ts +++ b/components/InputSelect/styles.ts @@ -29,8 +29,10 @@ export const styles: StylesConfig = { width: "15rem", border: "1px solid #e0f2fe", borderRadius: "0.375rem", - fontSize: "0.875rem", lineHeight: "1.25rem", + // "@media screen and (min-width: 1024px)": { + // fontSize: "0.875rem", + // }, }), input: (styles) => ({ ...styles, diff --git a/components/LinkList.tsx b/components/LinkList.tsx index 01ed6c75..a666a7ee 100644 --- a/components/LinkList.tsx +++ b/components/LinkList.tsx @@ -58,7 +58,7 @@ export default function ({ width={32} height={32} alt="" - className="select-none mt-3 z-10 rounded-md shadow" + className="select-none mt-3 z-10 rounded-md" draggable="false" onError={(e) => { const target = e.target as HTMLElement; @@ -70,7 +70,7 @@ export default function ({ width={80} height={80} alt="" - className="blur-sm absolute left-2 opacity-50 select-none hidden sm:block" + className="blur-sm absolute left-2 opacity-40 select-none hidden sm:block" draggable="false" onError={(e) => { const target = e.target as HTMLElement; @@ -194,7 +194,7 @@ export default function ({ const target = e.target as HTMLInputElement; if (target.id !== "edit-dropdown") setExpandDropdown(false); }} - className="absolute top-9 right-0 w-36" + className="absolute top-8 right-0 w-36" /> ) : null} diff --git a/components/Modal/AddCollection.tsx b/components/Modal/AddCollection.tsx index ef602647..54598450 100644 --- a/components/Modal/AddCollection.tsx +++ b/components/Modal/AddCollection.tsx @@ -9,6 +9,7 @@ import { faClose, faPlus } from "@fortawesome/free-solid-svg-icons"; import useCollectionStore from "@/store/collections"; import { NewCollection } from "@/types/global"; import { useSession } from "next-auth/react"; +import RequiredBadge from "../RequiredBadge"; type Props = { toggleCollectionModal: Function; @@ -48,7 +49,10 @@ export default function AddCollection({ toggleCollectionModal }: Props) {

New Collection

-

Name

+

+ Name + +

@@ -56,7 +60,7 @@ export default function AddCollection({ toggleCollectionModal }: Props) { } type="text" placeholder="e.g. Example Collection" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
@@ -68,8 +72,8 @@ export default function AddCollection({ toggleCollectionModal }: Props) { setNewCollection({ ...newCollection, description: e.target.value }) } type="text" - placeholder="Collection description (Optional)" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + placeholder="Collection description" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" /> @@ -120,8 +124,8 @@ export default function AddCollection({ toggleCollectionModal }: Props) { } }} type="text" - placeholder="Email (Optional)" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + placeholder="Email" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" /> diff --git a/components/Modal/AddLink.tsx b/components/Modal/AddLink.tsx index 7e6941d7..ccdfc77a 100644 --- a/components/Modal/AddLink.tsx +++ b/components/Modal/AddLink.tsx @@ -12,6 +12,7 @@ import { ExtendedLink, NewLink } from "@/types/global"; import useLinkStore from "@/store/links"; import { useRouter } from "next/router"; import useCollectionStore from "@/store/collections"; +import RequiredBadge from "../RequiredBadge"; type Props = { toggleLinkModal: Function; @@ -79,34 +80,38 @@ export default function AddLink({ toggleLinkModal }: Props) {

New Link

-

Name

+

+ Name + +

setNewLink({ ...newLink, name: e.target.value })} type="text" placeholder="e.g. Example Link" - className="w-60 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className="w-60 rounded-md p-2 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
-

URL

+

+ URL + +

setNewLink({ ...newLink, url: e.target.value })} type="text" placeholder="e.g. http://example.com/" - className="w-60 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className="w-60 rounded-md p-2 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
-

Tags

- -
- -
-

Collection

+

+ Collection + +

+
+

Tags

+ +
+
setInputField(e.target.value)} type="text" placeholder={`Type "${collection.name}" Here.`} - className=" w-72 sm:w-96 rounded-md p-3 mx-auto border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className=" w-72 sm:w-96 rounded-md p-3 mx-auto border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
Edit Collection

-

Name

+

+ Name + +

@@ -64,7 +68,7 @@ export default function EditCollection({ } type="text" placeholder="e.g. Example Collection" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
@@ -79,8 +83,8 @@ export default function EditCollection({ }) } type="text" - placeholder="Collection description (Optional)" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + placeholder="Collection description" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
@@ -135,8 +139,8 @@ export default function EditCollection({ } }} type="text" - placeholder="Email (Optional)" - className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + placeholder="Email" + className="w-56 sm:w-96 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" />
diff --git a/components/Modal/EditLink.tsx b/components/Modal/EditLink.tsx index 8ce35adc..c0859002 100644 --- a/components/Modal/EditLink.tsx +++ b/components/Modal/EditLink.tsx @@ -11,6 +11,7 @@ import { ExtendedLink } from "@/types/global"; import { faPenToSquare } from "@fortawesome/free-regular-svg-icons"; import useLinkStore from "@/store/links"; import { faTrashCan } from "@fortawesome/free-solid-svg-icons"; +import RequiredBadge from "../RequiredBadge"; type Props = { toggleLinkModal: Function; @@ -53,7 +54,10 @@ export default function EditLink({ toggleLinkModal, link }: Props) { {shortendURL} | {link.title}

-

Name

+

+ Name + +

@@ -61,7 +65,21 @@ export default function EditLink({ toggleLinkModal, link }: Props) { } type="text" placeholder="e.g. Example Link" - className="w-60 rounded-md p-3 border-sky-100 border-solid border text-sm outline-none focus:border-sky-500 duration-100" + className="w-60 rounded-md p-3 border-sky-100 border-solid border outline-none focus:border-sky-500 duration-100" + /> +
+ +
+

+ Collection + +

+
@@ -75,17 +93,6 @@ export default function EditLink({ toggleLinkModal, link }: Props) { /> -
-

Collection

- -
-
{children} diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 8fe2389d..c1d6c3be 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -68,7 +68,7 @@ export default function () { id="search-box" type="text" placeholder="Search for Links" - className="border border-sky-100 rounded-md pr-6 w-60 focus:border-sky-500 sm:focus:w-80 hover:border-sky-500 duration-100 outline-none p-1 text-sm" + className="border border-sky-100 rounded-md pr-6 w-60 focus:border-sky-500 sm:focus:w-80 hover:border-sky-500 duration-100 outline-none p-1" />
@@ -77,7 +77,7 @@ export default function () { title="New Link" className="inline-flex gap-1 items-center select-none cursor-pointer p-1 text-sky-500 rounded-md hover:outline-sky-500 outline duration-100 bg-white outline-sky-100 outline-1" > - +
{linkModal ? ( @@ -94,7 +94,7 @@ export default function () { >

@@ -123,7 +123,7 @@ export default function () { const target = e.target as HTMLInputElement; if (target.id !== "profile-dropdown") setProfileDropdown(false); }} - className="absolute top-8 right-0 z-20 w-36" + className="absolute top-9 right-0 z-20 w-36" /> ) : null} diff --git a/components/RequiredBadge.tsx b/components/RequiredBadge.tsx new file mode 100644 index 00000000..40eb3e21 --- /dev/null +++ b/components/RequiredBadge.tsx @@ -0,0 +1,13 @@ +// Copyright (C) 2022-present Daniel31x13 +// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3. +// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +// You should have received a copy of the GNU General Public License along with this program. If not, see . + +export default function RequiredBadge() { + return ( + + {" "} + * + + ); +} diff --git a/layouts/AuthRedirect.tsx b/layouts/AuthRedirect.tsx index c0c19805..132a2da6 100644 --- a/layouts/AuthRedirect.tsx +++ b/layouts/AuthRedirect.tsx @@ -41,5 +41,5 @@ export default function ({ children }: Props) { }, [status]); if (status !== "loading" && !redirect) return <>{children}; - // else return ; + else return <>; } diff --git a/lib/api/controllers/collections/postCollection.ts b/lib/api/controllers/collections/postCollection.ts index 70f1e1a7..3de04787 100644 --- a/lib/api/controllers/collections/postCollection.ts +++ b/lib/api/controllers/collections/postCollection.ts @@ -50,6 +50,18 @@ export default async function (collection: NewCollection, userId: number) { })), }, }, + include: { + members: { + include: { + user: { + select: { + email: true, + name: true, + }, + }, + }, + }, + }, }); const collectionPath = `data/archives/${newCollection.id}`; diff --git a/lib/api/controllers/collections/updateCollection.ts b/lib/api/controllers/collections/updateCollection.ts index 4f8519ac..4815fe4d 100644 --- a/lib/api/controllers/collections/updateCollection.ts +++ b/lib/api/controllers/collections/updateCollection.ts @@ -41,6 +41,18 @@ export default async function (collection: ExtendedCollection, userId: number) { })), }, }, + include: { + members: { + include: { + user: { + select: { + email: true, + name: true, + }, + }, + }, + }, + }, }); }); diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index 234d18b8..ab8fe6fc 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -78,7 +78,7 @@ export default function () {

{expandDropdown ? ( @@ -113,7 +113,7 @@ export default function () { const target = e.target as HTMLInputElement; if (target.id !== "edit-dropdown") setExpandDropdown(false); }} - className="absolute top-7 left-0 z-10 w-44" + className="absolute top-8 left-0 z-10 w-44" /> ) : null} diff --git a/pages/collections/index.tsx b/pages/collections/index.tsx index 755b9a81..080e7c1e 100644 --- a/pages/collections/index.tsx +++ b/pages/collections/index.tsx @@ -46,7 +46,7 @@ export default function () { {expandDropdown ? ( @@ -65,7 +65,7 @@ export default function () { const target = e.target as HTMLInputElement; if (target.id !== "edit-dropdown") setExpandDropdown(false); }} - className="absolute top-7 left-0 w-36" + className="absolute top-8 left-0 w-36" /> ) : null} diff --git a/store/collections.ts b/store/collections.ts index 9fd6ca58..67fb8e43 100644 --- a/store/collections.ts +++ b/store/collections.ts @@ -61,7 +61,7 @@ const useCollectionStore = create()((set) => ({ if (response.ok) set((state) => ({ collections: state.collections.map((e) => - e.id === collection.id ? collection : e + e.id === data.response.id ? data.response : e ), }));