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
+2 -15
View File
@@ -5,23 +5,10 @@
import React, { useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faClose,
faPenToSquare,
faPlus,
faTrashCan,
faUser,
faUserPlus,
} from "@fortawesome/free-solid-svg-icons";
import { faPenToSquare, faPlus } from "@fortawesome/free-solid-svg-icons";
import useCollectionStore from "@/store/collections";
import { CollectionIncludingMembers, Member } from "@/types/global";
import { useSession } from "next-auth/react";
import Modal from "@/components/Modal";
import DeleteCollection from "@/components/Modal/Collection/DeleteCollection";
import { CollectionIncludingMembers } from "@/types/global";
import RequiredBadge from "../../RequiredBadge";
import addMemberToCollection from "@/lib/client/addMemberToCollection";
import ImageWithFallback from "../../ImageWithFallback";
import Checkbox from "../../Checkbox";
type Props = {
toggleCollectionModal: Function;
@@ -30,8 +30,6 @@ export default function TeamManagement({
const [collection, setCollection] =
useState<CollectionIncludingMembers>(activeCollection);
const [isPublic, setIsPublic] = useState(false);
const currentURL = new URL(document.URL);
const publicCollectionURL = `${currentURL.origin}/public/collections/${collection.id}`;
@@ -87,15 +85,17 @@ export default function TeamManagement({
<Checkbox
label="Make this a public collection."
state={isPublic}
onClick={() => setIsPublic(!isPublic)}
state={collection.isPublic}
onClick={() =>
setCollection({ ...collection, isPublic: !collection.isPublic })
}
/>
<p className="text-gray-500 text-sm">
This will let <b>Anyone</b> to view this collection.
</p>
{isPublic ? (
{collection.isPublic ? (
<div>
<p className="mb-2 text-gray-500">Public Link (Click to copy)</p>
<div