Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions frontend/src/components/buttons/marketDetails/ResolveButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const ResolveButton = ({ onClick }) => {
const [isSelected, setIsSelected] = useState(false);
const initialButtonStyle = "bg-custom-gray-light";
const selectedButtonStyle = "bg-neutral-btn";
const buttonBaseStyle = "w-full px-4 py-2 text-white border rounded focus:outline-none";

const handleClick = () => {
setIsSelected(!isSelected);
Expand All @@ -23,30 +22,30 @@ const ResolveButton = ({ onClick }) => {
);
};

const SelectNoButton = ({ onClick }) => {
const SelectNoButton = ({ onClick, label = "NO" }) => {
return (
<button
className={`${buttonBaseStyle} bg-custom-gray-light hover:bg-red-btn`}
onClick={onClick}
>
RESOLVE NO
RESOLVE {label}
</button>
);
};

const SelectYesButton = ({ onClick }) => {
const SelectYesButton = ({ onClick, label = "YES" }) => {
return (
<button
className={`${buttonBaseStyle} bg-custom-gray-light hover:bg-green-btn`}
onClick={onClick}
>
RESOLVE YES
RESOLVE {label}
</button>
);
};


const ConfirmResolveButton = ({ onClick, selectedResolution }) => {
const ConfirmResolveButton = ({ onClick, selectedResolution, yesLabel = "YES", noLabel = "NO" }) => {
const getButtonStyle = () => {
switch (selectedResolution) {
case 'NO':
Expand All @@ -61,9 +60,9 @@ const ConfirmResolveButton = ({ onClick, selectedResolution }) => {
const buttonText = () => {
switch (selectedResolution) {
case 'NO':
return "CONFIRM RESOLVE NO";
return `CONFIRM RESOLVE ${noLabel}`;
case 'YES':
return "CONFIRM RESOLVE YES";
return `CONFIRM RESOLVE ${yesLabel}`;
default:
return "CONFIRM";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function MarketDetailsTable({
<ResolveModalButton
marketId={marketId}
token={token}
market={market}
disabled={!token}
className='text-xs px-4 py-2'
/>
Expand Down
12 changes: 8 additions & 4 deletions frontend/src/components/modals/resolution/ResolveModal.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React, { useState } from 'react';
import { ResolveButton, SelectNoButton, SelectYesButton, ConfirmResolveButton } from '../../buttons/marketDetails/ResolveButtons';
import { resolveMarket } from './ResolveUtils';
import { useMarketLabels } from '../../../hooks/useMarketLabels';

const ResolveModalButton = ({ marketId, token }) => {
const ResolveModalButton = ({ marketId, token, market }) => {
const [showResolveModal, setShowResolveModal] = useState(false);
const [selectedResolution, setSelectedResolution] = useState(null);

// Get custom labels for this market
const { yesLabel, noLabel } = useMarketLabels(market);

const toggleResolveModal = () => setShowResolveModal(prev => !prev);

Expand Down Expand Up @@ -34,17 +38,17 @@ const ResolveModalButton = ({ marketId, token }) => {

<div className="flex justify-center space-x-4 mb-4">
<div>
<SelectYesButton onClick={handleSelectYes} isSelected={selectedResolution === 'YES'} />
<SelectYesButton onClick={handleSelectYes} isSelected={selectedResolution === 'YES'} label={yesLabel} />
</div>
<div>
<SelectNoButton onClick={handleSelectNo} isSelected={selectedResolution === 'NO'} />
<SelectNoButton onClick={handleSelectNo} isSelected={selectedResolution === 'NO'} label={noLabel} />
</div>
</div>

<div className="border-t border-gray-200 my-2"></div>

<div className="mt-4">
<ConfirmResolveButton onClick={handleConfirm} selectedResolution={selectedResolution} />
<ConfirmResolveButton onClick={handleConfirm} selectedResolution={selectedResolution} yesLabel={yesLabel} noLabel={noLabel} />
</div>

<button onClick={toggleResolveModal} className="absolute top-0 right-0 mt-4 mr-4 text-gray-400 hover:text-white">
Expand Down
Loading