changes and improvements

This commit is contained in:
Daniel 2023-06-24 16:47:24 +03:30
parent 3abea1d1b7
commit c00c2dcd60
10 changed files with 81 additions and 46 deletions

View File

@ -87,44 +87,51 @@ export default function CollectionCard({ collection, className }: Props) {
{expandDropdown ? ( {expandDropdown ? (
<Dropdown <Dropdown
items={[ items={[
permissions === true
? {
name: "Edit Collection Info",
onClick: () => {
collection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: collection,
});
setExpandDropdown(false);
},
}
: undefined,
{ {
name: "Edit Collection", name: permissions === true ? "Share/Collaborate" : "View Team",
onClick: () => { onClick: () => {
setModal({ collection &&
modal: "COLLECTION", setModal({
state: true, modal: "COLLECTION",
method: "UPDATE", state: true,
isOwner: permissions === true, method: "UPDATE",
active: collection, isOwner: permissions === true,
}); active: collection,
defaultIndex: permissions === true ? 1 : 0,
});
setExpandDropdown(false); setExpandDropdown(false);
}, },
}, },
{ {
name: "Share/Collaborate", name:
permissions === true ? "Delete Collection" : "Leave Collection",
onClick: () => { onClick: () => {
setModal({ collection &&
modal: "COLLECTION", setModal({
state: true, modal: "COLLECTION",
method: "UPDATE", state: true,
isOwner: permissions === true, method: "UPDATE",
active: collection, isOwner: permissions === true,
defaultIndex: 1, active: collection,
}); defaultIndex: permissions === true ? 2 : 1,
setExpandDropdown(false); });
},
},
{
name: "Delete Collection",
onClick: () => {
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: collection,
defaultIndex: 2,
});
setExpandDropdown(false); setExpandDropdown(false);
}, },
}, },

View File

@ -83,6 +83,7 @@ export default function LinkCard({ link, count, className }: Props) {
modal: "LINK", modal: "LINK",
state: true, state: true,
method: "UPDATE", method: "UPDATE",
isOwner: permissions === true,
active: link, active: link,
}); });
}} }}
@ -90,10 +91,10 @@ export default function LinkCard({ link, count, className }: Props) {
> >
<Image <Image
src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`} src={`https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url.origin}&size=32`}
width={70} width={64}
height={70} height={64}
alt="" alt=""
className="blur-sm absolute bottom-5 right-5 opacity-60 group-hover:opacity-80 duration-100 select-none" className="blur-sm absolute w-16 group-hover:scale-50 group-hover:blur-none group-hover:opacity-100 duration-100 rounded-md bottom-5 right-5 opacity-60 select-none"
draggable="false" draggable="false"
onError={(e) => { onError={(e) => {
const target = e.target as HTMLElement; const target = e.target as HTMLElement;
@ -157,6 +158,7 @@ export default function LinkCard({ link, count, className }: Props) {
modal: "LINK", modal: "LINK",
state: true, state: true,
method: "UPDATE", method: "UPDATE",
isOwner: permissions === true,
active: link, active: link,
defaultIndex: 1, defaultIndex: 1,
}); });

View File

@ -116,12 +116,12 @@ export default function LinkDetails({ link }: Props) {
return ( return (
<div className="flex flex-col gap-3 sm:w-[35rem] w-80"> <div className="flex flex-col gap-3 sm:w-[35rem] w-80">
{!imageError && ( {!imageError && (
<div id="link-banner" className="link-banner h-40 -mx-5 -mt-5 relative"> <div id="link-banner" className="link-banner h-44 -mx-5 -mt-5 relative">
<div id="link-banner-inner" className="link-banner-inner"></div> <div id="link-banner-inner" className="link-banner-inner"></div>
</div> </div>
)} )}
<div <div
className={`relative flex gap-5 items-start ${!imageError && "-mt-16"}`} className={`relative flex gap-5 items-start ${!imageError && "-mt-32"}`}
> >
{!imageError && ( {!imageError && (
<Image <Image
@ -167,7 +167,7 @@ export default function LinkDetails({ link }: Props) {
<div className="flex gap-1 items-center flex-wrap"> <div className="flex gap-1 items-center flex-wrap">
<Link <Link
href={`/collections/${link.collection.id}`} href={`/collections/${link.collection.id}`}
className="flex items-center gap-1 cursor-pointer hover:opacity-60 duration-100 mr-2" className="flex items-center gap-1 cursor-pointer hover:opacity-60 duration-100 mr-2 z-10"
> >
<FontAwesomeIcon <FontAwesomeIcon
icon={faFolder} icon={faFolder}
@ -182,7 +182,7 @@ export default function LinkDetails({ link }: Props) {
</p> </p>
</Link> </Link>
{link.tags.map((e, i) => ( {link.tags.map((e, i) => (
<Link key={i} href={`/tags/${e.id}`}> <Link key={i} href={`/tags/${e.id}`} className="z-10">
<p <p
title={e.name} title={e.name}
className="px-2 py-1 bg-sky-200 text-sky-700 text-xs rounded-3xl cursor-pointer hover:opacity-60 duration-100 truncate max-w-[19rem]" className="px-2 py-1 bg-sky-200 text-sky-700 text-xs rounded-3xl cursor-pointer hover:opacity-60 duration-100 truncate max-w-[19rem]"

View File

@ -7,6 +7,7 @@ type Props =
| { | {
toggleLinkModal: Function; toggleLinkModal: Function;
method: "CREATE"; method: "CREATE";
isOwner?: boolean;
activeLink?: LinkIncludingShortenedCollectionAndTags; activeLink?: LinkIncludingShortenedCollectionAndTags;
defaultIndex?: number; defaultIndex?: number;
className?: string; className?: string;
@ -14,6 +15,7 @@ type Props =
| { | {
toggleLinkModal: Function; toggleLinkModal: Function;
method: "UPDATE"; method: "UPDATE";
isOwner: boolean;
activeLink: LinkIncludingShortenedCollectionAndTags; activeLink: LinkIncludingShortenedCollectionAndTags;
defaultIndex?: number; defaultIndex?: number;
className?: string; className?: string;
@ -23,6 +25,7 @@ export default function CollectionModal({
className, className,
defaultIndex, defaultIndex,
toggleLinkModal, toggleLinkModal,
isOwner,
activeLink, activeLink,
method, method,
}: Props) { }: Props) {
@ -32,8 +35,12 @@ export default function CollectionModal({
{method === "CREATE" && ( {method === "CREATE" && (
<p className="text-xl text-sky-500 text-center">New Link</p> <p className="text-xl text-sky-500 text-center">New Link</p>
)} )}
<Tab.List className="flex justify-center flex-col max-w-[15rem] sm:max-w-[30rem] mx-auto sm:flex-row gap-2 sm:gap-3 mb-5 text-sky-600"> <Tab.List
{method === "UPDATE" && ( className={`flex justify-center flex-col max-w-[15rem] sm:max-w-[30rem] mx-auto sm:flex-row gap-2 sm:gap-3 mb-5 text-sky-600 ${
isOwner ? "" : "pb-8"
}`}
>
{method === "UPDATE" && isOwner && (
<> <>
<Tab <Tab
className={({ selected }) => className={({ selected }) =>

View File

@ -19,7 +19,7 @@ export default function Modal({ toggleModal, className, children }: Props) {
<div className="slide-up relative border-sky-100 rounded-2xl border-solid border shadow-lg p-5 bg-white"> <div className="slide-up relative border-sky-100 rounded-2xl border-solid border shadow-lg p-5 bg-white">
<div <div
onClick={toggleModal as MouseEventHandler<HTMLDivElement>} onClick={toggleModal as MouseEventHandler<HTMLDivElement>}
className="absolute top-5 left-5 inline-flex rounded-md cursor-pointer hover:bg-slate-200 duration-100 p-2" className="absolute top-5 left-5 inline-flex rounded-md cursor-pointer hover:bg-slate-200 duration-100 z-20 p-2"
> >
<FontAwesomeIcon <FontAwesomeIcon
icon={faChevronLeft} icon={faChevronLeft}

View File

@ -29,6 +29,7 @@ export default function ModalManagement() {
<LinkModal <LinkModal
toggleLinkModal={toggleModal} toggleLinkModal={toggleModal}
method={modal.method} method={modal.method}
isOwner={modal.isOwner as boolean}
defaultIndex={modal.defaultIndex} defaultIndex={modal.defaultIndex}
activeLink={modal.active as LinkIncludingShortenedCollectionAndTags} activeLink={modal.active as LinkIncludingShortenedCollectionAndTags}
/> />

View File

@ -197,7 +197,7 @@ export default function Index() {
method: "UPDATE", method: "UPDATE",
isOwner: permissions === true, isOwner: permissions === true,
active: activeCollection, active: activeCollection,
defaultIndex: 1, defaultIndex: permissions === true ? 1 : 0,
}); });
setExpandDropdown(false); setExpandDropdown(false);
}, },

View File

@ -1 +1,19 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} {
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@ -16,6 +16,7 @@ type Modal =
modal: "LINK"; modal: "LINK";
state: boolean; state: boolean;
method: "CREATE"; method: "CREATE";
isOwner?: boolean;
active?: LinkIncludingShortenedCollectionAndTags; active?: LinkIncludingShortenedCollectionAndTags;
defaultIndex?: number; defaultIndex?: number;
} }
@ -23,6 +24,7 @@ type Modal =
modal: "LINK"; modal: "LINK";
state: boolean; state: boolean;
method: "UPDATE"; method: "UPDATE";
isOwner: boolean;
active: LinkIncludingShortenedCollectionAndTags; active: LinkIncludingShortenedCollectionAndTags;
defaultIndex?: number; defaultIndex?: number;
} }

View File

@ -102,7 +102,7 @@
/* For the Link banner */ /* For the Link banner */
.link-banner { .link-banner {
/* box-shadow: inset 0px 10px 20px 20px #ffffff; */ /* box-shadow: inset 0px 10px 20px 20px #ffffff; */
opacity: 30%; opacity: 25%;
z-index: 0; z-index: 0;
} }
.link-banner .link-banner-inner { .link-banner .link-banner-inner {
@ -116,7 +116,6 @@
-webkit-mask: linear-gradient(#fff, transparent); -webkit-mask: linear-gradient(#fff, transparent);
mask: linear-gradient(#fff, transparent); mask: linear-gradient(#fff, transparent);
} }
.link-banner::after { .link-banner::after {
content: ""; content: "";
position: absolute; position: absolute;
@ -132,7 +131,6 @@
width: 100%; width: 100%;
height: 4rem; height: 4rem;
} }
.link-banner::before { .link-banner::before {
content: ""; content: "";
position: absolute; position: absolute;