Stop project functionality

pull/7093/head
Kamran Ahmed 2 months ago
parent 09b63442dc
commit bf80d3f052
  1. 16
      src/components/Projects/StatusStepper/ProjectStepper.tsx

@ -1,4 +1,4 @@
import { Flag, Play, Send, Share, X } from 'lucide-react'; import { Flag, Play, Send, Share, Square, StopCircle, X } from 'lucide-react';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { cn } from '../../../lib/classname.ts'; import { cn } from '../../../lib/classname.ts';
import { useStickyStuck } from '../../../hooks/use-sticky-stuck.tsx'; import { useStickyStuck } from '../../../hooks/use-sticky-stuck.tsx';
@ -13,6 +13,7 @@ import { showLoginPopup } from '../../../lib/popup.ts';
import { SubmitProjectModal } from '../SubmitProjectModal.tsx'; import { SubmitProjectModal } from '../SubmitProjectModal.tsx';
import { useCopyText } from '../../../hooks/use-copy-text.ts'; import { useCopyText } from '../../../hooks/use-copy-text.ts';
import { CheckIcon } from '../../ReactIcons/CheckIcon.tsx'; import { CheckIcon } from '../../ReactIcons/CheckIcon.tsx';
import { pageProgressMessage } from '../../../stores/page.ts';
type ProjectStatusResponse = { type ProjectStatusResponse = {
id?: string; id?: string;
@ -93,7 +94,12 @@ export function ProjectStepper(props: ProjectStepperProps) {
return; return;
} }
window.location.reload(); pageProgressMessage.set('Update project status');
setActiveStep(0);
loadProjectStatus().finally(() => {
pageProgressMessage.set('');
setIsStoppingProject(false);
});
}; };
useEffect(() => { useEffect(() => {
@ -210,13 +216,13 @@ export function ProjectStepper(props: ProjectStepperProps) {
{projectStatus?.startedAt && !projectStatus?.submittedAt && ( {projectStatus?.startedAt && !projectStatus?.submittedAt && (
<button <button
className={cn( className={cn(
'ml-auto hidden items-center gap-1 text-sm disabled:opacity-50 sm:flex', 'ml-auto hidden items-center gap-1.5 text-sm hover:text-black disabled:opacity-50 sm:flex',
)} )}
onClick={stopProject} onClick={stopProject}
disabled={isStoppingProject} disabled={isStoppingProject}
> >
<X className="h-3.5 w-3.5 stroke-[2.5px]" /> <Square className="h-3 w-3 fill-current stroke-[2.5px]" />
<span className="hidden md:inline">Stop Project</span> <span className="hidden md:inline">Stop Working</span>
<span className="md:hidden">Stop</span> <span className="md:hidden">Stop</span>
</button> </button>
)} )}

Loading…
Cancel
Save