feat(market): add draft status and multiplier
This commit is contained in:
@@ -41,6 +41,8 @@ const timeRemaining = computed(() => {
|
||||
|
||||
const statusColor = computed(() => {
|
||||
switch (props.market.status) {
|
||||
case "draft":
|
||||
return "badge-secondary";
|
||||
case "open":
|
||||
return "badge-success";
|
||||
case "closed":
|
||||
@@ -68,7 +70,7 @@ const getMultiplier = (option: MarketOption) => {
|
||||
const getPotentialGain = (option: MarketOption) => {
|
||||
if (!existingBet.value || existingBet.value.option.uuid !== option.uuid) return 0;
|
||||
const multiplier = getMultiplier(option);
|
||||
return Math.round(existingBet.value.amount * multiplier);
|
||||
return Math.round(existingBet.value.amount * multiplier * props.market.multiplier);
|
||||
};
|
||||
|
||||
const closeMarket = async () => {
|
||||
@@ -194,10 +196,15 @@ onMounted(async () => {
|
||||
<p class="text-sm text-base-content/70">{{ market.description }}</p>
|
||||
</div>
|
||||
<div class="flex flex-col items-end gap-2">
|
||||
<div :class="['badge', statusColor, 'text-white']">
|
||||
{{ market.status }}
|
||||
<div class="flex gap-2 items-center">
|
||||
<div :class="['badge', statusColor, 'text-white']">
|
||||
{{ market.status }}
|
||||
</div>
|
||||
<div v-if="market.multiplier > 1" class="badge badge-accent text-white font-bold">
|
||||
{{ market.multiplier }}x
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="market.status === 'open'" class="text-sm text-base-content/60 text-right">
|
||||
<div v-if="market.status === 'open' || market.status === 'closed'" class="text-sm text-base-content/60 text-right">
|
||||
<div>{{ timeRemaining }}</div>
|
||||
<div class="text-xs">until close</div>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,7 @@ const winningBets = computed(() => {
|
||||
return userBets.value.filter(bet => {
|
||||
const market = bet.market;
|
||||
return market?.status === "resolved" && market?.winning_option?.uuid === bet.option.uuid;
|
||||
});
|
||||
}).reverse();
|
||||
});
|
||||
|
||||
const losingBets = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user