From 1adb58c6d9f3991f257a34c13f2b68b4f9cca97c Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 27 May 2023 22:35:07 +0330 Subject: [PATCH] some visual changes + improvements --- components/CollectionCard.tsx | 13 ++++------ components/ImageWithFallback.tsx | 2 +- components/Modal/UserSettings.tsx | 1 - components/ProfilePhoto.tsx | 24 +++++++++++++++++++ lib/api/controllers/users/updateUser.ts | 4 ++-- pages/collections/[id].tsx | 32 ++++++++++++------------- 6 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 components/ProfilePhoto.tsx diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx index edbd678..89651db 100644 --- a/components/CollectionCard.tsx +++ b/components/CollectionCard.tsx @@ -5,7 +5,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { - faUser, faPenToSquare, faTrashCan, faEllipsis, @@ -13,12 +12,12 @@ import { import Link from "next/link"; import { CollectionIncludingMembers } from "@/types/global"; import useLinkStore from "@/store/links"; -import ImageWithFallback from "./ImageWithFallback"; import Dropdown from "./Dropdown"; import { useState } from "react"; import Modal from "@/components/Modal"; import CollectionModal from "@/components/Modal/CollectionModal"; import DeleteCollection from "@/components/Modal/DeleteCollection"; +import ProfilePhoto from "./ProfilePhoto"; export default function ({ collection, @@ -71,15 +70,11 @@ export default function ({ .sort((a, b) => (a.user.id as number) - (b.user.id as number)) .map((e, i) => { return ( - -
- -
-
+ className="-mr-3" + /> ); }) .slice(0, 4)} diff --git a/components/ImageWithFallback.tsx b/components/ImageWithFallback.tsx index f125216..44c6f81 100644 --- a/components/ImageWithFallback.tsx +++ b/components/ImageWithFallback.tsx @@ -1,4 +1,4 @@ -import { ElementType, ReactElement, ReactNode, useState } from "react"; +import { ReactNode, useState } from "react"; type Props = { src: string; diff --git a/components/Modal/UserSettings.tsx b/components/Modal/UserSettings.tsx index 31213d2..6c6f151 100644 --- a/components/Modal/UserSettings.tsx +++ b/components/Modal/UserSettings.tsx @@ -25,7 +25,6 @@ export default function UserSettings({ toggleSettingsModal }: Props) { const [user, setUser] = useState({ ...account, - // profilePic: null, }); const [whitelistedUsersTextbox, setWhiteListedUsersTextbox] = useState( diff --git a/components/ProfilePhoto.tsx b/components/ProfilePhoto.tsx new file mode 100644 index 0000000..9330f98 --- /dev/null +++ b/components/ProfilePhoto.tsx @@ -0,0 +1,24 @@ +import React from "react"; +import ImageWithFallback from "./ImageWithFallback"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faUser } from "@fortawesome/free-solid-svg-icons"; + +type Props = { + src: string; + className?: string; +}; + +export default function ProfilePhoto({ src, className }: Props) { + return ( + +
+ +
+
+ ); +} diff --git a/lib/api/controllers/users/updateUser.ts b/lib/api/controllers/users/updateUser.ts index 5ca5b06..9e0e864 100644 --- a/lib/api/controllers/users/updateUser.ts +++ b/lib/api/controllers/users/updateUser.ts @@ -74,7 +74,7 @@ export default async function (user: AccountSettings, userId: number) { } } - const { password, ...unsensitiveInfo } = updatedUser; + const { password, ...userInfo } = updatedUser; - return { response: unsensitiveInfo, status: 200 }; + return { response: userInfo, status: 200 }; } diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index fa39d42..22dbebb 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -19,7 +19,6 @@ import { faPenToSquare, faSort, faTrashCan, - faUser, } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useRouter } from "next/router"; @@ -27,8 +26,8 @@ import { ChangeEvent, useEffect, useState } from "react"; import MainLayout from "@/layouts/MainLayout"; import RadioButton from "@/components/RadioButton"; import ClickAwayHandler from "@/components/ClickAwayHandler"; -import ImageWithFallback from "@/components/ImageWithFallback"; import { useSession } from "next-auth/react"; +import ProfilePhoto from "@/components/ProfilePhoto"; export default function () { const router = useRouter(); @@ -120,10 +119,18 @@ export default function () { - {activeCollection?.members[0] ? ( -
-
-
+ {activeCollection ? ( +
+
+
{activeCollection.ownerId === data?.user.id ? "Manage" : "View"}{" "} @@ -135,18 +142,11 @@ export default function () { ) .map((e, i) => { return ( - -
- -
-
+ className="-mr-3 group-hover:brightness-125 bg-white duration-100" + /> ); }) .slice(0, 4)}