Skip to content

Commit

Permalink
Merge branch 'dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Oct 18, 2024
2 parents 35617c6 + 3b3664f commit 19c9c88
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
7 changes: 3 additions & 4 deletions apps/web/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ const btnStyles: BtnStyles = {

export function Button({
onClick,
className: styles,
className: styles = "",
disabled = false,
tooltip,
showToolTip = true,
tooltipClassName: tooltipStyles,
tooltipClassName: tooltipStyles = "",
tooltipSide = "tooltip-top",
children,
btnStyle = "filled",
Expand All @@ -86,8 +86,7 @@ export function Button({
const buttonElement = (
<button
type={type}
className={`${btnStyles[btnStyle][disabled ? "disabled" : color]}
flex relative cursor-pointer justify-center rounded-lg px-6 py-4 transition-all ease-out disabled:cursor-not-allowed h-fit ${styles}`}
className={`${btnStyles[btnStyle][disabled ? "disabled" : color]} flex relative cursor-pointer justify-center rounded-lg px-6 py-4 transition-all ease-out disabled:cursor-not-allowed h-fit ${styles}`}
onClick={onClick}
disabled={disabled || isLoading}
>
Expand Down
22 changes: 14 additions & 8 deletions apps/web/components/DisputeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
condition: isCooldown,
message: "Please wait 2 hours before submitting another dispute",
},
{
condition: isCooldown,
message: "Please wait 2 hours before submitting another dispute",
},
],
[isEnoughBalance, isCooldown],
);
Expand All @@ -270,7 +274,7 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
);

const content = (
<div className="flex md:flex-col gap-10 flex-wrap">
<div className="flex md:flex-col gap-10 flex-wrap w-[600px]">
{proposalStatus !== "active" ?
<div className="p-16 rounded-lg">
{disputes.map((dispute) => (
Expand Down Expand Up @@ -310,7 +314,7 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
},
];

const disableTribunalSafeButtons = disableTribunalSafeBtnCondition.some(
const disableTribunalSafeButtons = disableTribunalSafeBtnCondition.find(
(cond) => cond.condition,
);

Expand All @@ -328,7 +332,8 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
btnStyle="outline"
onClick={() => handleSubmitRuling(ABSTAINED_RULING)}
isLoading={rulingLoading === ABSTAINED_RULING}
disabled={disableTribunalSafeButtons}
disabled={!!disableTribunalSafeButtons}
tooltip={disableTribunalSafeButtons?.message}
>
<InfoWrapper
className={"[&>svg]:text-secondary-content"}
Expand All @@ -346,8 +351,8 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
btnStyle="outline"
onClick={() => handleSubmitRuling(APPROVED_RULING)}
isLoading={rulingLoading === APPROVED_RULING}
disabled={disableTribunalSafeButtons}
tooltip={tooltipMessage}
disabled={!!disableTribunalSafeButtons}
tooltip={disableTribunalSafeButtons?.message}
>
<InfoWrapper
className="[&>svg]:text-primary-content"
Expand All @@ -363,11 +368,12 @@ export const DisputeButton: FC<Props> = ({ proposalData }) => {
btnStyle="outline"
onClick={() => handleSubmitRuling(REJECTED_RULING)}
isLoading={rulingLoading === REJECTED_RULING}
disabled={disableTribunalSafeButtons}
tooltip={tooltipMessage}
disabled={!!disableTribunalSafeButtons}
tooltip={disableTribunalSafeButtons?.message}
tooltipSide="tooltip-left"
>
<InfoWrapper
className="[&>svg]:text-error"
className="[&>svg]:!text-error tooltip-left"
tooltip={
"Reject if the proposal violates the rules outlined in the community covenant."
}
Expand Down
14 changes: 10 additions & 4 deletions apps/web/components/ProposalTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Countdown } from "./Countdown";
import { DateComponent } from "./DateComponent";
import { InfoWrapper } from "./InfoWrapper";
import { DisputeOutcome, DisputeStatus, ProposalStatus } from "@/types";
import { convertSecondsToReadableTime } from "@/utils/numbers";

type Props = {
proposalData: Pick<CVProposal, "createdAt" | "proposalStatus"> & {
Expand Down Expand Up @@ -36,7 +37,7 @@ type Props = {
export const ProposalTimeline: FC<Props> = ({
proposalData,
disputes = [],
className,
className = "",
}) => {
const arbitrationConfig = proposalData.arbitrableConfig;
const defaultRuling = DisputeOutcome[arbitrationConfig.defaultRuling];
Expand Down Expand Up @@ -65,7 +66,7 @@ export const ProposalTimeline: FC<Props> = ({

return (
<ul
className={`timeline timeline-vertical sm:timeline-horizontal mt-5 ${className}`}
className={`timeline timeline-vertical sm:timeline-horizontal mt-5 w-fit ${className}`}
>
<li className="flex-grow">
<div className="timeline-start text-sm opacity-60">
Expand All @@ -87,6 +88,11 @@ export const ProposalTimeline: FC<Props> = ({
const isLastDispute = index === disputes.length - 1;
const timeoutTimestamp =
+dispute.createdAt + +arbitrationConfig.defaultRulingTimeout;

const rulingTimeout = convertSecondsToReadableTime(
arbitrationConfig.defaultRulingTimeout,
);

return (
<Fragment key={dispute.id}>
<li className="flex-grow">
Expand All @@ -107,7 +113,7 @@ export const ProposalTimeline: FC<Props> = ({
<div className="timeline-start shadow-lg p-2 border border-tertiary-content rounded-lg flex items-center">
<InfoWrapper
className="[&>svg]:text-tertiary-content m-0.5"
tooltip={`The tribunal safe has 3 days to rule the dispute. Past this delay and considering the abstain behavior on this pool, this proposal will be ${defaultRuling === "rejected" ? "closed as rejected" : "back to active"} and both collateral will be restored.`}
tooltip={`The tribunal safe has ${rulingTimeout.value} ${rulingTimeout.unit} to rule the dispute. Past this delay and considering the abstain behavior on this pool, this proposal will be ${defaultRuling === "rejected" ? "closed as rejected" : "back to active"} and both collateral will be restored.`}
>
<Countdown endTimestamp={timeoutTimestamp} />
</InfoWrapper>
Expand Down Expand Up @@ -135,7 +141,7 @@ export const ProposalTimeline: FC<Props> = ({
"Pool default ruling on timeout is to Approve"
: "The proposal will be closed as rejected."
}
className={`[&>svg]:text-error-content [&:before]:ml-[-26px] ${isTimeout && defaultRuling === "approved" && "[&>svg]:opacity-50"}`}
className={`[&>svg]:!text-error-content [&:before]:ml-[-26px] ${isTimeout && defaultRuling === "approved" && "[&>svg]:opacity-50"}`}
>
<span
className={`${isTimeout && defaultRuling === "approved" && "opacity-50"}`}
Expand Down

0 comments on commit 19c9c88

Please sign in to comment.