Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
posaune0423 committed Jul 5, 2024
1 parent b33023a commit 15f4076
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 162 deletions.
21 changes: 8 additions & 13 deletions src/components/NewProposalPopupForMain/NewProposalPopupForMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const NewProposalPopupForMain: React.FC = () => {
const handleDisasterColorChange = (
selectedOption: SingleValue<{ value: string; label: JSX.Element }>,
) => {
if (selectedOption) {
console.log(selectedOption.value);
setColor(formatColorToRGBA(selectedOption.value)); // to submit the color.
if (!selectedOption) {
console.error('handleDisasterColorChange: selectedOption is null');
return;
}
setColor(formatColorToRGBA(selectedOption.value)); // to submit the color.
};

const handleClickOutside = (event: MouseEvent) => {
Expand Down Expand Up @@ -173,17 +174,11 @@ const NewProposalPopupForMain: React.FC = () => {
<label className='mb-2 block text-lg'>Select Proposal Type</label>
<select
value={proposalType}
onChange={(e) =>
setProposalType(
ProposalType[
e.target.value as keyof typeof ProposalType
],
)
}
onChange={(e) => setProposalType(Number(e.target.value))}
className='w-full rounded-md bg-gray-700 p-3 text-white'
>
<option value='AddNewColor'>Add Color</option>
<option value='MakeADisasterByColor'>Reset To White</option>
<option value='1'>Add Color</option>
<option value='2'>Reset To White</option>
</select>
</div>

Expand Down Expand Up @@ -227,7 +222,7 @@ const NewProposalPopupForMain: React.FC = () => {
</div>
)}

{proposalType === ProposalType.ResetToWhiteByColor && (
{proposalType === ProposalType.MakeADisasterByColor && (
<div className='mb-4'>
<label className='mb-2 block text-lg'>
Choose a color to turn white on the canvas.
Expand Down
38 changes: 19 additions & 19 deletions src/components/NewProposalPopupForMain/ProposalListForMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ const ProposalListForMain: React.FC<ProposalListForMainProps> = ({
const proposals = useProposals(GAME_ID);
const proposalArray = proposals?.data ?? [];

const getStatusColor = (status: string) => {
if (status.startsWith('end in')) {
return 'bg-green-500';
} else if (status === 'closed') {
return 'bg-purple-500';
} else {
return 'bg-gray-500';
}
};

const getStatusColorForBg = (status: string) => {
if (status.startsWith('end in')) {
return 'bg-black-800';
} else if (status === 'closed') {
return 'bg-gray-500';
} else {
return 'bg-black-800';
}
};
// const getStatusColor = (status: string) => {
// if (status.startsWith('end in')) {
// return 'bg-green-500';
// } else if (status === 'closed') {
// return 'bg-purple-500';
// } else {
// return 'bg-gray-500';
// }
// };

// const getStatusColorForBg = (status: string) => {
// if (status.startsWith('end in')) {
// return 'bg-black-800';
// } else if (status === 'closed') {
// return 'bg-gray-500';
// } else {
// return 'bg-black-800';
// }
// };

const handleVote = (proposal: StartVoteParam) => {
setSelectedProposal(proposal);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePixelRecoveryRate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Data = {

const usePixelRecoveryRate = () => {
const settings = useSettingsStore();
const baseUrl = settings?.config?.toriiUrl ?? '';
const baseUrl = settings?.config?.toriiUrl ?? 'http://localhost:8080';
const gqlClient = new GraphQLClient(`${baseUrl}/graphql`);

return useQuery({
Expand Down
10 changes: 3 additions & 7 deletions src/pages/NewProposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,11 @@ const NewProposal: React.FC = () => {
<label className='mb-2 block text-lg'>Select Proposal Type</label>
<select
value={proposalType}
onChange={(e) =>
setProposalType(
ProposalType[e.target.value as keyof typeof ProposalType],
)
}
onChange={(e) => setProposalType(Number(e.target.value))}
className='w-full rounded-md bg-gray-700 p-3 text-white'
>
<option value='AddNewColor'>Add Color</option>
<option value='MakeADisasterByColor'>Reset To White</option>
<option value='1'>Add Color</option>
<option value='2'>Reset To White</option>
</select>
</div>

Expand Down
Loading

0 comments on commit 15f4076

Please sign in to comment.