small improvements

This commit is contained in:
Daniel 2023-06-03 07:20:16 +03:30
parent a7021972eb
commit 6a4f21fc0a
4 changed files with 17 additions and 14 deletions

View File

@ -66,7 +66,7 @@ export default function CollectionInfo({
<p className="text-sm w-full font-bold text-sky-300 mb-2"> <p className="text-sm w-full font-bold text-sky-300 mb-2">
Icon Color Icon Color
</p> </p>
<div style={{ color: collection.color || "#7dd3fc" }}> <div style={{ color: collection.color }}>
<FontAwesomeIcon <FontAwesomeIcon
icon={faFolder} icon={faFolder}
className="w-12 h-12 drop-shadow" className="w-12 h-12 drop-shadow"
@ -82,7 +82,7 @@ export default function CollectionInfo({
</div> </div>
</div> </div>
<HexColorPicker <HexColorPicker
color={collection.color || "#7dd3fc"} color={collection.color}
onChange={(e) => setCollection({ ...collection, color: e })} onChange={(e) => setCollection({ ...collection, color: e })}
/> />
</div> </div>

View File

@ -1,11 +1,14 @@
const getPublicCollectionData = async (collectionId: string) => { const getPublicCollectionData = async (
collectionId: string,
setData?: Function
) => {
const res = await fetch( const res = await fetch(
"/api/public/routes/collections/?collectionId=" + collectionId "/api/public/routes/collections/?collectionId=" + collectionId
); );
const data = await res.json(); const data = await res.json();
console.log(data); if (setData) setData(data.response);
return data; return data;
}; };

View File

@ -218,6 +218,7 @@ export default function () {
activeCollection={{ activeCollection={{
name: "", name: "",
description: "", description: "",
color: "#7dd3fc",
isPublic: false, isPublic: false,
ownerId: session.data?.user.id as number, ownerId: session.data?.user.id as number,
members: [], members: [],

View File

@ -10,15 +10,12 @@ export default function PublicCollections() {
const [data, setData] = useState<PublicCollectionIncludingLinks>(); const [data, setData] = useState<PublicCollectionIncludingLinks>();
useEffect(() => { useEffect(() => {
const setState = async () => { if (router.query.id) {
if (router.query.id) { getPublicCollectionData(
const data = await getPublicCollectionData(router.query.id as string); router.query.id as string,
(e: PublicCollectionIncludingLinks) => setData(e)
setData(data.response); );
} }
};
setState();
// document // document
// .querySelector("body") // .querySelector("body")
@ -32,7 +29,9 @@ export default function PublicCollections() {
return data ? ( return data ? (
<div className="max-w-4xl mx-auto p-5 bg"> <div className="max-w-4xl mx-auto p-5 bg">
<div className="text-center bg-gradient-to-tr from-sky-100 from-10% via-gray-100 via-20% rounded-3xl shadow-lg p-5"> <div
className={`text-center bg-gradient-to-tr from-sky-100 from-10% via-gray-100 via-20% rounded-3xl shadow-lg p-5`}
>
<p className="text-5xl bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent font-bold mb-5 capitalize"> <p className="text-5xl bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent font-bold mb-5 capitalize">
{data.name} {data.name}
</p> </p>