improvements

This commit is contained in:
Daniel 2023-05-29 02:44:44 +03:30
parent 8f5dba6ed4
commit 271231120c
8 changed files with 15 additions and 30 deletions

View File

@ -96,7 +96,6 @@ export default function ({
</div> </div>
</div> </div>
</Link> </Link>
{expandDropdown ? ( {expandDropdown ? (
<Dropdown <Dropdown
items={[ items={[
@ -130,7 +129,6 @@ export default function ({
className="absolute top-[3.2rem] right-5 z-10 w-36" className="absolute top-[3.2rem] right-5 z-10 w-36"
/> />
) : null} ) : null}
{editCollectionModal ? ( {editCollectionModal ? (
<Modal toggleModal={toggleEditCollectionModal}> <Modal toggleModal={toggleEditCollectionModal}>
<CollectionInfo <CollectionInfo
@ -140,7 +138,6 @@ export default function ({
/> />
</Modal> </Modal>
) : null} ) : null}
{collectionMembersModal ? ( {collectionMembersModal ? (
<Modal toggleModal={toggleCollectionMembersModal}> <Modal toggleModal={toggleCollectionMembersModal}>
<TeamManagement <TeamManagement
@ -149,7 +146,6 @@ export default function ({
/> />
</Modal> </Modal>
) : null} ) : null}
{deleteCollectionModal ? ( {deleteCollectionModal ? (
<Modal toggleModal={toggleDeleteCollectionModal}> <Modal toggleModal={toggleDeleteCollectionModal}>
<DeleteCollection <DeleteCollection

View File

@ -61,7 +61,7 @@ export default function ({ link, count }: Props) {
width={42} width={42}
height={42} height={42}
alt="" alt=""
className="select-none mt-3 z-10 rounded-full shadow border-[3px] border-sky-100" className="select-none mt-3 z-10 rounded-full shadow border-[3px] border-white bg-white"
draggable="false" draggable="false"
onError={(e) => { onError={(e) => {
const target = e.target as HTMLElement; const target = e.target as HTMLElement;

View File

@ -5,23 +5,10 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { import { faPenToSquare, faPlus } from "@fortawesome/free-solid-svg-icons";
faClose,
faPenToSquare,
faPlus,
faTrashCan,
faUser,
faUserPlus,
} from "@fortawesome/free-solid-svg-icons";
import useCollectionStore from "@/store/collections"; import useCollectionStore from "@/store/collections";
import { CollectionIncludingMembers, Member } from "@/types/global"; import { CollectionIncludingMembers } from "@/types/global";
import { useSession } from "next-auth/react";
import Modal from "@/components/Modal";
import DeleteCollection from "@/components/Modal/Collection/DeleteCollection";
import RequiredBadge from "../../RequiredBadge"; import RequiredBadge from "../../RequiredBadge";
import addMemberToCollection from "@/lib/client/addMemberToCollection";
import ImageWithFallback from "../../ImageWithFallback";
import Checkbox from "../../Checkbox";
type Props = { type Props = {
toggleCollectionModal: Function; toggleCollectionModal: Function;

View File

@ -30,8 +30,6 @@ export default function TeamManagement({
const [collection, setCollection] = const [collection, setCollection] =
useState<CollectionIncludingMembers>(activeCollection); useState<CollectionIncludingMembers>(activeCollection);
const [isPublic, setIsPublic] = useState(false);
const currentURL = new URL(document.URL); const currentURL = new URL(document.URL);
const publicCollectionURL = `${currentURL.origin}/public/collections/${collection.id}`; const publicCollectionURL = `${currentURL.origin}/public/collections/${collection.id}`;
@ -87,15 +85,17 @@ export default function TeamManagement({
<Checkbox <Checkbox
label="Make this a public collection." label="Make this a public collection."
state={isPublic} state={collection.isPublic}
onClick={() => setIsPublic(!isPublic)} onClick={() =>
setCollection({ ...collection, isPublic: !collection.isPublic })
}
/> />
<p className="text-gray-500 text-sm"> <p className="text-gray-500 text-sm">
This will let <b>Anyone</b> to view this collection. This will let <b>Anyone</b> to view this collection.
</p> </p>
{isPublic ? ( {collection.isPublic ? (
<div> <div>
<p className="mb-2 text-gray-500">Public Link (Click to copy)</p> <p className="mb-2 text-gray-500">Public Link (Click to copy)</p>
<div <div

View File

@ -52,7 +52,6 @@ export default function () {
}; };
return ( return (
// lg:ml-64 xl:ml-80
<div className="flex justify-between gap-2 items-center px-5 py-2 border-solid border-b-sky-100 border-b h-16"> <div className="flex justify-between gap-2 items-center px-5 py-2 border-solid border-b-sky-100 border-b h-16">
<div <div
onClick={toggleSidebar} onClick={toggleSidebar}
@ -72,23 +71,23 @@ export default function () {
<div className="relative"> <div className="relative">
<div <div
className="flex gap-1 group items-center w-fit bg-white text-gray-600 cursor-pointer" className="flex gap-1 group items-center w-fit bg-white cursor-pointer"
onClick={() => setProfileDropdown(!profileDropdown)} onClick={() => setProfileDropdown(!profileDropdown)}
id="profile-dropdown" id="profile-dropdown"
> >
{account.profilePic ? ( {account.profilePic ? (
<img <img
src={account.profilePic} src={account.profilePic}
className="h-10 w-10 shadow pointer-events-none rounded-full border-[3px] border-sky-100 group-hover:border-sky-500 duration-100" className="h-10 w-10 shadow pointer-events-none rounded-full border-[3px] border-sky-500 group-hover:border-sky-400 duration-100"
alt="" alt=""
/> />
) : ( ) : (
<FontAwesomeIcon <FontAwesomeIcon
icon={faCircleUser} icon={faCircleUser}
className="h-10 w-10 pointer-events-none group-hover:text-sky-600 duration-100" className="h-10 w-10 pointer-events-none text-sky-500 group-hover:text-sky-400 duration-100"
/> />
)} )}
<div className="pointer-events-none hidden sm:block group-hover:text-sky-600 duration-100"> <div className="pointer-events-none hidden sm:block text-sky-500 group-hover:text-sky-400 duration-100">
<div className="flex item-center gap-1"> <div className="flex item-center gap-1">
<p className="font-bold leading-3 hidden sm:block"> <p className="font-bold leading-3 hidden sm:block">
{account.name} {account.name}

View File

@ -35,6 +35,7 @@ export default async function (
data: { data: {
name: collection.name, name: collection.name,
description: collection.description, description: collection.description,
isPublic: collection.isPublic,
members: { members: {
create: collection.members.map((e) => ({ create: collection.members.map((e) => ({
user: { connect: { email: e.user.email } }, user: { connect: { email: e.user.email } },

View File

@ -16,6 +16,7 @@ CREATE TABLE "Collection" (
"id" SERIAL NOT NULL, "id" SERIAL NOT NULL,
"name" TEXT NOT NULL, "name" TEXT NOT NULL,
"description" TEXT NOT NULL DEFAULT '', "description" TEXT NOT NULL DEFAULT '',
"isPublic" BOOLEAN NOT NULL DEFAULT false,
"ownerId" INTEGER NOT NULL, "ownerId" INTEGER NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

View File

@ -29,6 +29,7 @@ model Collection {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
name String name String
description String @default("") description String @default("")
isPublic Boolean @default(false)
owner User @relation(fields: [ownerId], references: [id]) owner User @relation(fields: [ownerId], references: [id])
ownerId Int ownerId Int
members UsersAndCollections[] members UsersAndCollections[]