chore: removed minor bugs (#273)

This commit is contained in:
Aaryan Khandelwal 2023-02-13 19:38:58 +05:30 committed by GitHub
parent 8fb34fe1e3
commit 214e860e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 326 additions and 287 deletions

View File

@ -34,8 +34,8 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
reValidateMode: "onChange", reValidateMode: "onChange",
}); });
const onSubmit = ({ email }: EmailCodeFormValues) => { const onSubmit = async ({ email }: EmailCodeFormValues) => {
authenticationService await authenticationService
.emailCode({ email }) .emailCode({ email })
.then((res) => { .then((res) => {
setValue("key", res.key); setValue("key", res.key);
@ -46,8 +46,8 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
}); });
}; };
const handleSignin = (formData: EmailCodeFormValues) => { const handleSignin = async (formData: EmailCodeFormValues) => {
authenticationService await authenticationService
.magicSignIn(formData) .magicSignIn(formData)
.then((response) => { .then((response) => {
onSuccess(response); onSuccess(response);
@ -68,10 +68,7 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
return ( return (
<> <>
<form <form className="mt-5 space-y-5">
className="mt-5 space-y-5"
onSubmit={codeSent ? handleSubmit(handleSignin) : handleSubmit(onSubmit)}
>
{codeSent && ( {codeSent && (
<div className="rounded-md bg-green-50 p-4"> <div className="rounded-md bg-green-50 p-4">
<div className="flex"> <div className="flex">
@ -117,16 +114,37 @@ export const EmailCodeForm = ({ onSuccess }: any) => {
error={errors.token} error={errors.token}
placeholder="Enter code" placeholder="Enter code"
/> />
{/* <span
className="text-xs outline-none hover:text-theme"
onClick={() => {
console.log("Triggered");
handleSubmit(onSubmit);
}}
>
Resend code
</span> */}
</div> </div>
)} )}
<div> <div>
{codeSent ? (
<Button <Button
disabled={isSubmitting || (!isValid && isDirty)}
className="w-full text-center"
type="submit" type="submit"
className="w-full text-center"
onClick={handleSubmit(handleSignin)}
disabled={isSubmitting || (!isValid && isDirty)}
> >
{isSubmitting ? "Signing in..." : codeSent ? "Sign In" : "Continue with Email ID"} {isSubmitting ? "Signing in..." : "Sign in"}
</Button> </Button>
) : (
<Button
type="submit"
className="w-full text-center"
onClick={handleSubmit(onSubmit)}
disabled={isSubmitting || (!isValid && isDirty)}
>
{isSubmitting ? "Sending code..." : "Send code"}
</Button>
)}
</div> </div>
</form> </form>
</> </>

View File

@ -69,6 +69,8 @@ export const SingleBoard: React.FC<Props> = ({
? (bgColor = "#22c55e") ? (bgColor = "#22c55e")
: (bgColor = "#ff0000"); : (bgColor = "#ff0000");
const isNotAllowed = userAuth.isGuest || userAuth.isViewer;
return ( return (
<div className={`h-full flex-shrink-0 rounded ${!isCollapsed ? "" : "w-80 border bg-gray-50"}`}> <div className={`h-full flex-shrink-0 rounded ${!isCollapsed ? "" : "w-80 border bg-gray-50"}`}>
<div className={`${!isCollapsed ? "" : "flex h-full flex-col space-y-3 overflow-y-auto"}`}> <div className={`${!isCollapsed ? "" : "flex h-full flex-col space-y-3 overflow-y-auto"}`}>
@ -95,7 +97,7 @@ export const SingleBoard: React.FC<Props> = ({
key={issue.id} key={issue.id}
draggableId={issue.id} draggableId={issue.id}
index={index} index={index}
isDragDisabled={selectedGroup === "created_by"} isDragDisabled={isNotAllowed || selectedGroup === "created_by"}
> >
{(provided, snapshot) => ( {(provided, snapshot) => (
<SingleBoardIssue <SingleBoardIssue

View File

@ -28,11 +28,13 @@ export const ViewStateSelect: React.FC<Props> = ({
isNotAllowed, isNotAllowed,
}) => { }) => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId } = router.query; const { workspaceSlug } = router.query;
const { data: stateGroups } = useSWR( const { data: stateGroups } = useSWR(
workspaceSlug && projectId ? STATE_LIST(issue.project) : null, workspaceSlug && issue ? STATE_LIST(issue.project) : null,
workspaceSlug ? () => stateService.getStates(workspaceSlug as string, issue.project) : null workspaceSlug && issue
? () => stateService.getStates(workspaceSlug as string, issue.project)
: null
); );
const states = getStatesList(stateGroups ?? {}); const states = getStatesList(stateGroups ?? {});

View File

@ -12,13 +12,14 @@ import {
ClipboardDocumentListIcon, ClipboardDocumentListIcon,
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
// types // types
import type { IProject } from "types";
// ui // ui
import { Button } from "components/ui"; import { Button } from "components/ui";
// hooks // hooks
import useProjectMembers from "hooks/use-project-members"; import useProjectMembers from "hooks/use-project-members";
// helpers // helpers
import { renderShortNumericDateFormat } from "helpers/date-time.helper"; import { renderShortNumericDateFormat } from "helpers/date-time.helper";
// types
import type { IProject } from "types";
export type ProjectCardProps = { export type ProjectCardProps = {
workspaceSlug: string; workspaceSlug: string;
@ -85,6 +86,14 @@ export const ProjectCard: React.FC<ProjectCardProps> = (props) => {
</div> </div>
<div className="mt-3 flex h-full items-end justify-between"> <div className="mt-3 flex h-full items-end justify-between">
<div className="flex gap-2"> <div className="flex gap-2">
<Button
theme="secondary"
className="flex items-center gap-1"
onClick={() => router.push(`/${workspaceSlug}/projects/${project.id}/issues`)}
>
<ClipboardDocumentListIcon className="h-3 w-3" />
Open Project
</Button>
{!isMember ? ( {!isMember ? (
<button <button
type="button" type="button"
@ -97,19 +106,11 @@ export const ProjectCard: React.FC<ProjectCardProps> = (props) => {
<span>Select to Join</span> <span>Select to Join</span>
</button> </button>
) : ( ) : (
<Button theme="secondary" className="flex items-center gap-1" disabled> <div className="flex items-center gap-1 text-xs">
<CheckIcon className="h-3 w-3" /> <CheckIcon className="h-3 w-3" />
Member Member
</Button> </div>
)} )}
<Button
theme="secondary"
className="flex items-center gap-1"
onClick={() => router.push(`/${workspaceSlug}/projects/${project.id}/issues`)}
>
<ClipboardDocumentListIcon className="h-3 w-3" />
Open Project
</Button>
</div> </div>
<div className="mb-1 flex items-center gap-1 text-xs"> <div className="mb-1 flex items-center gap-1 text-xs">
<CalendarDaysIcon className="h-4 w-4" /> <CalendarDaysIcon className="h-4 w-4" />

View File

@ -36,10 +36,6 @@ const ConfirmCycleDeletion: React.FC<TConfirmCycleDeletionProps> = ({
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
useEffect(() => {
data && setIsOpen(true);
}, [data, setIsOpen]);
const handleClose = () => { const handleClose = () => {
setIsOpen(false); setIsOpen(false);
setIsDeleteLoading(false); setIsDeleteLoading(false);

View File

@ -18,6 +18,7 @@ import {
ChartPieIcon, ChartPieIcon,
LinkIcon, LinkIcon,
Squares2X2Icon, Squares2X2Icon,
TrashIcon,
UserIcon, UserIcon,
} from "@heroicons/react/24/outline"; } from "@heroicons/react/24/outline";
// ui // ui
@ -28,6 +29,8 @@ import useToast from "hooks/use-toast";
import cyclesService from "services/cycles.service"; import cyclesService from "services/cycles.service";
// components // components
import { SidebarProgressStats } from "components/core"; import { SidebarProgressStats } from "components/core";
import ProgressChart from "components/core/sidebar/progress-chart";
import ConfirmCycleDeletion from "components/project/cycles/confirm-cycle-deletion";
// helpers // helpers
import { copyTextToClipboard } from "helpers/string.helper"; import { copyTextToClipboard } from "helpers/string.helper";
import { groupBy } from "helpers/array.helper"; import { groupBy } from "helpers/array.helper";
@ -36,7 +39,7 @@ import { renderDateFormat, renderShortNumericDateFormat } from "helpers/date-tim
import { CycleIssueResponse, ICycle, IIssue } from "types"; import { CycleIssueResponse, ICycle, IIssue } from "types";
// fetch-keys // fetch-keys
import { CYCLE_DETAILS } from "constants/fetch-keys"; import { CYCLE_DETAILS } from "constants/fetch-keys";
import ProgressChart from "components/core/sidebar/progress-chart"; // constants
import { CYCLE_STATUS } from "constants/cycle"; import { CYCLE_STATUS } from "constants/cycle";
type Props = { type Props = {
@ -47,6 +50,8 @@ type Props = {
}; };
const CycleDetailSidebar: React.FC<Props> = ({ issues, cycle, isOpen, cycleIssues }) => { const CycleDetailSidebar: React.FC<Props> = ({ issues, cycle, isOpen, cycleIssues }) => {
const [cycleDeleteModal, setCycleDeleteModal] = useState(false);
const router = useRouter(); const router = useRouter();
const { workspaceSlug, projectId, cycleId } = router.query; const { workspaceSlug, projectId, cycleId } = router.query;
@ -103,7 +108,14 @@ const CycleDetailSidebar: React.FC<Props> = ({ issues, cycle, isOpen, cycleIssue
const isStartValid = new Date(`${cycle?.start_date}`) <= new Date(); const isStartValid = new Date(`${cycle?.start_date}`) <= new Date();
const isEndValid = new Date(`${cycle?.end_date}`) >= new Date(`${cycle?.start_date}`); const isEndValid = new Date(`${cycle?.end_date}`) >= new Date(`${cycle?.start_date}`);
return ( return (
<>
<ConfirmCycleDeletion
isOpen={cycleDeleteModal}
setIsOpen={setCycleDeleteModal}
data={cycle}
/>
<div <div
className={`fixed top-0 ${ className={`fixed top-0 ${
isOpen ? "right-0" : "-right-[24rem]" isOpen ? "right-0" : "-right-[24rem]"
@ -222,6 +234,13 @@ const CycleDetailSidebar: React.FC<Props> = ({ issues, cycle, isOpen, cycleIssue
> >
<LinkIcon className="h-3.5 w-3.5" /> <LinkIcon className="h-3.5 w-3.5" />
</button> </button>
<button
type="button"
className="rounded-md border border-red-500 p-2 text-red-500 shadow-sm duration-300 hover:bg-red-50 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500"
onClick={() => setCycleDeleteModal(true)}
>
<TrashIcon className="h-3.5 w-3.5" />
</button>
</div> </div>
</div> </div>
<div className="divide-y-2 divide-gray-100 text-xs"> <div className="divide-y-2 divide-gray-100 text-xs">
@ -309,6 +328,7 @@ const CycleDetailSidebar: React.FC<Props> = ({ issues, cycle, isOpen, cycleIssue
</Loader> </Loader>
)} )}
</div> </div>
</>
); );
}; };

View File

@ -148,9 +148,7 @@ export const SingleState: React.FC<Props> = ({
backgroundColor: state.color, backgroundColor: state.color,
}} }}
/> />
<h6 className="text-sm"> <h6 className="text-sm">{addSpaceIfCamelCase(state.name)}</h6>
{addSpaceIfCamelCase(state.name)} {state.sequence}
</h6>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{index !== 0 && ( {index !== 0 && (

View File

@ -16,7 +16,7 @@ export const WorkspaceHomeCardsList: FC<WorkspaceHomeCardsListProps> = (props) =
}, },
{ {
title: "Issues pending", title: "Issues pending",
number: myIssues?.length ?? 0 - groupedIssues.completed.length, number: myIssues.length - groupedIssues.completed.length,
}, },
{ {
title: "Projects", title: "Projects",

View File

@ -58,6 +58,7 @@ const MyIssuesPage: NextPage = () => {
} }
right={ right={
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
{myIssues && myIssues.length > 0 && (
<Popover className="relative"> <Popover className="relative">
{({ open }) => ( {({ open }) => (
<> <>
@ -106,6 +107,7 @@ const MyIssuesPage: NextPage = () => {
</> </>
)} )}
</Popover> </Popover>
)}
<HeaderButton <HeaderButton
Icon={PlusIcon} Icon={PlusIcon}
label="Add Issue" label="Add Issue"