Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 11 additions & 2 deletions components/waves/create-wave/voting/CreateWaveVoting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import NegativeVotingToggle from "./NegativeVotingToggle";
import TimeWeightedVoting from "./TimeWeightedVoting";
import { TimeWeightedVotingConfig } from "./types";

const VOTING_TYPES_ORDER: Record<ApiWaveCreditType, number> = {
[ApiWaveCreditType.Tdh]: 0,
[ApiWaveCreditType.Xtdh]: 1,
[ApiWaveCreditType.TdhPlusXtdh]: 2,
[ApiWaveCreditType.Rep]: 3,
};

export default function CreateWaveVoting({
waveType,
selectedType,
Expand Down Expand Up @@ -55,13 +62,15 @@ export default function CreateWaveVoting({
{TITLES[waveType]}
</p>
<div className="tw-mt-3 tw-grid lg:tw-grid-cols-3 tw-gap-x-4 tw-gap-y-4">
{Object.values(ApiWaveCreditType).map((votingType) => (
{(
Object.keys(VOTING_TYPES_ORDER) as ApiWaveCreditType[]
).map((votingType) => (
<CommonBorderedRadioButton
key={votingType}
type={votingType}
selected={selectedType}
disabled={false}
label={WAVE_VOTING_LABELS[votingType]}
label={`By ${WAVE_VOTING_LABELS[votingType]}`}
onChange={onTypeChange}
/>
))}
Expand Down
25 changes: 11 additions & 14 deletions components/waves/drop/SingleWaveDropLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from "@/helpers/Helpers";
import Link from "next/link";
import { ApiWaveCreditType } from "@/generated/models/ApiWaveCreditType";
import { WAVE_VOTING_LABELS } from "@/helpers/waves/waves.constants";
import { SystemAdjustmentPill } from "@/components/common/SystemAdjustmentPill";
import useIsMobileScreen from "@/hooks/isMobileScreen";
import Image from "next/image";
Expand Down Expand Up @@ -41,9 +42,8 @@ export const SingleWaveDropLog: React.FC<SingleWaveDropLogProps> = ({
/>
) : (
<div
className={`tw-rounded-md tw-ring-1 tw-ring-white/10 tw-bg-iron-800 tw-flex-shrink-0 ${
isMobile ? "tw-size-7" : "tw-size-6"
}`}
className={`tw-rounded-md tw-ring-1 tw-ring-white/10 tw-bg-iron-800 tw-flex-shrink-0 ${isMobile ? "tw-size-7" : "tw-size-6"
}`}
/>
);

Expand All @@ -54,9 +54,8 @@ export const SingleWaveDropLog: React.FC<SingleWaveDropLogProps> = ({
className="tw-no-underline tw-group desktop-hover:hover:tw-opacity-80 tw-transition-all tw-duration-300"
>
<span
className={`tw-inline-block${
shouldLimit ? " tw-truncate tw-max-w-[8rem]" : ""
}`}
className={`tw-inline-block${shouldLimit ? " tw-truncate tw-max-w-[8rem]" : ""
}`}
>
<span className="tw-text-sm tw-font-medium tw-text-iron-50 tw-transition-all tw-duration-300 desktop-hover:group-hover:tw-text-iron-300">
{log.invoker.handle}
Expand Down Expand Up @@ -110,11 +109,10 @@ export const SingleWaveDropLog: React.FC<SingleWaveDropLogProps> = ({
</span>
)}
<span
className={`tw-text-sm tw-font-semibold tw-whitespace-nowrap ${
log.contents.newVote > 0 ? "tw-text-green" : "tw-text-red"
}`}
className={`tw-text-sm tw-font-semibold tw-whitespace-nowrap ${log.contents.newVote > 0 ? "tw-text-green" : "tw-text-red"
}`}
>
{formatNumberWithCommas(log.contents.newVote)} {creditType}
{formatNumberWithCommas(log.contents.newVote)} {WAVE_VOTING_LABELS[creditType]}
</span>
{log.contents?.reason === "CREDIT_OVERSPENT" && (
<SystemAdjustmentPill />
Expand All @@ -138,11 +136,10 @@ export const SingleWaveDropLog: React.FC<SingleWaveDropLogProps> = ({
</span>
)}
<span
className={`tw-text-sm tw-font-semibold tw-whitespace-nowrap ${
log.contents.newVote > 0 ? "tw-text-green" : "tw-text-red"
}`}
className={`tw-text-sm tw-font-semibold tw-whitespace-nowrap ${log.contents.newVote > 0 ? "tw-text-green" : "tw-text-red"
}`}
>
{formatNumberWithCommas(log.contents.newVote)} {creditType}
{formatNumberWithCommas(log.contents.newVote)} {WAVE_VOTING_LABELS[creditType]}
</span>
{log.contents?.reason === "CREDIT_OVERSPENT" && (
<SystemAdjustmentPill />
Expand Down
5 changes: 3 additions & 2 deletions components/waves/drop/SingleWaveDropVoteContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface SingleWaveDropVoteContentProps {
export const SingleWaveDropVoteContent: React.FC<
SingleWaveDropVoteContentProps
> = ({ drop, size, onVoteSuccess }) => {
console.log(drop)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
const currentVoteValue = drop.context_profile_context?.rating ?? 0;
const minRating = drop.context_profile_context?.min_rating ?? 0;
const maxRating = drop.context_profile_context?.max_rating ?? 0;
Expand All @@ -42,7 +43,7 @@ export const SingleWaveDropVoteContent: React.FC<
// MINI layout uses single horizontal row, others use existing responsive layout
if (size === SingleWaveDropVoteSize.MINI) {
return (

<div
className="tw-bg-iron-900 tw-border tw-border-iron-800 tw-border-solid tw-rounded-lg tw-px-2 tw-py-1.5"
onClick={(e) => e.stopPropagation()}
Expand Down Expand Up @@ -100,7 +101,7 @@ export const SingleWaveDropVoteContent: React.FC<
/>
</div>
</div>

{/* Stats below the controls */}
<div className="tw-mt-3">
<SingleWaveDropVoteStats
Expand Down
Loading