Skip to content

Commit 0dc7b17

Browse files
feat(web): notify-to-pass-phase-in-case-maintenance-button
1 parent 0542179 commit 0dc7b17

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

web/src/pages/Cases/CaseDetails/MaintenanceButtons/DrawButton.tsx

+18-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ import { isUndefined } from "src/utils";
1717
import { Phases } from "components/Phase";
1818

1919
import { IBaseMaintenanceButton } from ".";
20+
import { Link } from "react-router-dom";
2021

2122
const StyledButton = styled(Button)`
2223
width: 100%;
2324
`;
2425

26+
const StyledLabel = styled.label``;
2527
interface IDrawButton extends IBaseMaintenanceButton {
2628
numberOfVotes?: string;
2729
period?: string;
@@ -40,6 +42,11 @@ const DrawButton: React.FC<IDrawButton> = ({ id, numberOfVotes, setIsOpen, perio
4042
[maintenanceData, isDrawn, phase, period]
4143
);
4244

45+
const needToPassPhase = useMemo(
46+
() => !isUndefined(maintenanceData) && !isDrawn && period === Period.Evidence && phase !== Phases.drawing,
47+
[maintenanceData, isDrawn, phase, period]
48+
);
49+
4350
const {
4451
data: drawConfig,
4552
isLoading: isLoadingConfig,
@@ -68,7 +75,17 @@ const DrawButton: React.FC<IDrawButton> = ({ id, numberOfVotes, setIsOpen, perio
6875
setIsOpen(false);
6976
});
7077
};
71-
return <StyledButton text="Draw" small isLoading={isLoading} disabled={isDisabled} onClick={handleClick} />;
78+
return (
79+
<>
80+
{needToPassPhase ? (
81+
<StyledLabel>
82+
Jurors can be drawn in <small>drawing</small> phase.
83+
<br /> Pass phase <Link to="/courts/1/purpose/#maintenance">here</Link>.
84+
</StyledLabel>
85+
) : null}
86+
<StyledButton text="Draw" small isLoading={isLoading} disabled={isDisabled} onClick={handleClick} />
87+
</>
88+
);
7289
};
7390

7491
export default DrawButton;

web/src/pages/Courts/StakeMaintenanceButton/index.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from "react";
1+
import React, { useEffect, useState } from "react";
22
import styled from "styled-components";
33

44
import DottedMenuButton from "components/DottedMenuButton";
@@ -47,6 +47,11 @@ interface IStakeMaintenanceButtons {
4747
const StakeMaintenanceButtons: React.FC<IStakeMaintenanceButtons> = ({ className }) => {
4848
const [isOpen, setIsOpen] = useState(false);
4949

50+
useEffect(() => {
51+
const openDefault = location.hash.includes("#maintenance");
52+
if (openDefault) setIsOpen(true);
53+
}, []);
54+
5055
const toggle = () => setIsOpen((prevValue) => !prevValue);
5156
return (
5257
<Container {...{ className }}>

0 commit comments

Comments
 (0)