fix: view list link (#653)

* fix: viewlist link

* fix/removed side effects

* fix: deadzones in the link
This commit is contained in:
Kunal Vishwakarma 2023-03-31 17:54:05 +05:30 committed by GitHub
parent afd7741d0c
commit 844ae4869a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 65 deletions

View File

@ -53,7 +53,7 @@ const ConfirmProjectMemberRemove: React.FC<Props> = ({ isOpen, onClose, data, ha
leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
> >
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-[40rem]">
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start"> <div className="sm:flex sm:items-start">
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"> <div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
@ -68,9 +68,9 @@ const ConfirmProjectMemberRemove: React.FC<Props> = ({ isOpen, onClose, data, ha
</Dialog.Title> </Dialog.Title>
<div className="mt-2"> <div className="mt-2">
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500">
Are you sure you want to remove member - {`"`} Are you sure you want to remove member- {" "}
<span className="italic">{data?.email}</span> <span className="font-bold">{data?.email}</span>
{`"`} ? They will no longer have access to this project. This action ? They will no longer have access to this project. This action
cannot be undone. cannot be undone.
</p> </p>
</div> </div>

View File

@ -104,7 +104,7 @@ export const DeleteStateModal: React.FC<Props> = ({ isOpen, onClose, data }) =>
leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
> >
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-[40rem]">
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start"> <div className="sm:flex sm:items-start">
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"> <div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
@ -119,9 +119,9 @@ export const DeleteStateModal: React.FC<Props> = ({ isOpen, onClose, data }) =>
</Dialog.Title> </Dialog.Title>
<div className="mt-2"> <div className="mt-2">
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500">
Are you sure you want to delete state - {`"`} Are you sure you want to delete state- {" "}
<span className="italic">{data?.name}</span> <span className="italic">{data?.name}</span>
{`"`} ? All of the data related to the state will be permanently removed. ? All of the data related to the state will be permanently removed.
This action cannot be undone. This action cannot be undone.
</p> </p>
</div> </div>

View File

@ -96,7 +96,7 @@ export const DeleteViewModal: React.FC<Props> = ({ isOpen, data, onClose, onSucc
leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
> >
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-[40rem]">
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start"> <div className="sm:flex sm:items-start">
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"> <div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
@ -111,9 +111,9 @@ export const DeleteViewModal: React.FC<Props> = ({ isOpen, data, onClose, onSucc
</Dialog.Title> </Dialog.Title>
<div className="mt-2"> <div className="mt-2">
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500">
Are you sure you want to delete view - {`"`} Are you sure you want to delete view- {" "}
<span className="italic">{data?.name}</span> <span className="font-bold">{data?.name}</span>
{`?"`} All of the data related to the view will be permanently removed. ? All of the data related to the view will be permanently removed.
This action cannot be undone. This action cannot be undone.
</p> </p>
</div> </div>

View File

@ -20,16 +20,11 @@ import { VIEWS_LIST } from "constants/fetch-keys";
import useToast from "hooks/use-toast"; import useToast from "hooks/use-toast";
type Props = { type Props = {
view: IView, view: IView;
setSelectedView: React.Dispatch<React.SetStateAction<IView | null>>, setSelectedView: React.Dispatch<React.SetStateAction<IView | null>>;
}; };
export const SingleViewItem: React.FC<Props> = ({ view, setSelectedView }) => {
export const SingleViewItem: React.FC<Props> = ({
view,
setSelectedView,
}) => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query; const { workspaceSlug, projectId } = router.query;
@ -86,47 +81,63 @@ export const SingleViewItem: React.FC<Props> = ({
}; };
return ( return (
<div <>
className="flex items-center justify-between border-b bg-white p-4 first:rounded-t-[10px] last:rounded-b-[10px]" <Link href={`/${workspaceSlug}/projects/${projectId}/views/${view.id}`}>
> <div className="flex items-center cursor-pointer justify-between border-b bg-white p-4 first:rounded-t-[10px] last:rounded-b-[10px]">
<div className="flex flex-col w-full gap-3"> <div className="flex flex-col w-full gap-3">
<div className="flex justify-between w-full"> <div className="flex justify-between w-full">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<StackedLayersIcon height={18} width={18} /> <StackedLayersIcon height={18} width={18} />
<Link href={`/${workspaceSlug}/projects/${projectId}/views/${view.id}`}> <a>{view.name}</a>
<a>{view.name}</a> </div>
</Link> <div className="flex">
</div> {view.is_favorite ? (
<div className="flex"> <button
{ type="button"
view.is_favorite ? ( onClick={(e) => {
<button type="button" onClick={handleRemoveFromFavorites}> e.preventDefault();
<StarIcon className="h-4 w-4 text-orange-400" fill="#f6ad55" /> e.stopPropagation();
</button> handleRemoveFromFavorites();
) : ( }}
<button type="button" onClick={handleAddToFavorites}> >
<StarIcon className="h-4 w-4 " color="#858E96" /> <StarIcon className="h-4 w-4 text-orange-400" fill="#f6ad55" />
</button> </button>
) ) : (
} <button
<CustomMenu width="auto" verticalEllipsis> type="button"
<CustomMenu.MenuItem onClick={(e) => {
onClick={() => { e.preventDefault();
setSelectedView(view); e.stopPropagation();
}} handleAddToFavorites();
> }}
<span className="flex items-center justify-start gap-2"> >
<TrashIcon className="h-4 w-4" /> <StarIcon className="h-4 w-4 " color="#858E96" />
<span>Delete</span> </button>
</span> )}
</CustomMenu.MenuItem> <CustomMenu width="auto" verticalEllipsis>
</CustomMenu> <CustomMenu.MenuItem
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
setSelectedView(view);
}}
>
<span className="flex items-center justify-start gap-2">
<TrashIcon className="h-4 w-4" />
<span>Delete</span>
</span>
</CustomMenu.MenuItem>
</CustomMenu>
</div>
</div>
{view?.description && (
<p className="text-sm text-[#858E96] font-normal leading-5 px-[27px]">
{view.description}
</p>
)}
</div> </div>
</div> </div>
{view?.description && <p className="text-sm text-[#858E96] font-normal leading-5 px-[27px]"> </Link>
{view.description} </>
</p>} );
</div> };
</div>
)
}

View File

@ -53,7 +53,7 @@ const ConfirmWorkspaceMemberRemove: React.FC<Props> = ({ isOpen, onClose, data,
leaveFrom="opacity-100 translate-y-0 sm:scale-100" leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95" leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
> >
<Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"> <Dialog.Panel className="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-[40rem]">
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"> <div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div className="sm:flex sm:items-start"> <div className="sm:flex sm:items-start">
<div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"> <div className="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
@ -68,9 +68,9 @@ const ConfirmWorkspaceMemberRemove: React.FC<Props> = ({ isOpen, onClose, data,
</Dialog.Title> </Dialog.Title>
<div className="mt-2"> <div className="mt-2">
<p className="text-sm text-gray-500"> <p className="text-sm text-gray-500">
Are you sure you want to remove member - {`"`} Are you sure you want to remove member- {" "}
<span className="italic">{data?.email}</span> <span className="font-bold">{data?.email}</span>
{`"`} ? They will no longer have access to this workspace. This action ? They will no longer have access to this workspace. This action
cannot be undone. cannot be undone.
</p> </p>
</div> </div>