Skip to content

Commit

Permalink
Restore the lootbottles to their former glory
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Jan 11, 2024
1 parent 9b0bda0 commit 66cea87
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions web/app.fluidity.money/app/queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from "./addReferral";
export * from "./useReferralCode";
export * from "./addReferralCode";
export * from "./useLootboxConfig";
export * from "./useLootBottles";
2 changes: 1 addition & 1 deletion web/app.fluidity.money/app/queries/useLootBottles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const QUERY_BY_TX_HASH = gql`
export type Lootbox = {
txHash?: string;
lootboxCount: number;
rewardTier: number;
rewardTier: Rarity;
};

type LootboxesByTxHashBody = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Transaction from "~/types/Transaction";
import { fetchGqlEndpoint, gql, jsonPost, Queryable } from "~/util";
import { Rarity } from "@fluidity-money/surfing";

export type AggregatedTransaction = Omit<
Transaction,
Expand All @@ -10,7 +11,7 @@ export type AggregatedTransaction = Omit<
swap_in: boolean;
type: "send" | "swap";
timestamp: string;
rewardTier: number;
rewardTier: Rarity;
lootboxCount: number;
};

Expand Down
6 changes: 4 additions & 2 deletions web/app.fluidity.money/app/queries/useUserTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
getTokenFromAddress,
Token,
} from "~/util/chainUtils/tokens";
import { Rarity } from "@fluidity-money/surfing";
import { MintAddress } from "~/types/MintAddress";
import { translateRewardTierToRarity } from "./useLootBottles";

const queryByAddress: Queryable = {
arbitrum: gql`
Expand Down Expand Up @@ -359,7 +361,7 @@ export type UserTransaction = {
currency: { symbol: string };
application: string;
lootboxCount: number;
rewardTier: number;
rewardTier: Rarity;
};

type HasuraUserTransaction = {
Expand Down Expand Up @@ -550,7 +552,7 @@ const parseHasuraUserTransactions = (
},
application: transfer.application,
lootboxCount: transfer.lootboxCount,
rewardTier: transfer.rewardTier,
rewardTier: translateRewardTierToRarity(transfer.rewardTier),
};
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
WalletIcon,
TabButton,
toDecimalPlaces,
LootBottle,
} from "@fluidity-money/surfing";
import { useContext, useEffect, useState, useMemo } from "react";
import { ToolTipContent, useToolTip, UtilityToken } from "~/components";
Expand Down Expand Up @@ -434,6 +435,7 @@ export default function Rewards() {
utilityTokens,
application,
lootboxCount,
rewardTier,
} = data;

const toolTip = useToolTip();
Expand Down Expand Up @@ -547,7 +549,11 @@ export default function Rewards() {
className="table-address"
href={`/${network}/dashboard/airdrop`}
>
<Text>{ lootboxCount }</Text>
<LootBottle
size="lg"
rarity={rewardTier}
quantity={lootboxCount}
/>
</a>
) : (
<Text>-</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useUserRewardsByAddress,
useUserTransactionsAll,
useUserTransactionsByAddress,
translateRewardTierToRarity
} from "~/queries";
import { captureException } from "@sentry/react";
import { MintAddress } from "~/types/MintAddress";
Expand All @@ -24,6 +25,7 @@ import {
useUserActionsAll,
useUserActionsByAddress,
} from "~/queries/useUserActionsAggregate";
import { Rarity } from "@fluidity-money/surfing";
import { chainType } from "~/util/chainUtils/chains";

const FLUID_UTILITY = "FLUID";
Expand All @@ -38,7 +40,7 @@ type UserTransaction = {
value: number;
currency: string;
application: string;
rewardTier: number;
rewardTier: Rarity;
lootboxCount: number;
};

Expand Down Expand Up @@ -377,7 +379,7 @@ export const loader: LoaderFunction = async ({ params, request }) => {
currency,
application,
lootboxCount,
rewardTier,
rewardTier: translateRewardTierToRarity(Object.values(Rarity).indexOf(rewardTier)),
};
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
useUserRewardsAll,
useUserRewardsByAddress,
useUserTransactionsByTxHash,
translateRewardTierToRarity
} from "~/queries";
import { Rarity } from "@fluidity-money/surfing";
import { captureException } from "@sentry/react";
import { MintAddress } from "~/types/MintAddress";
import { Winner } from "~/queries/useUserRewards";
Expand All @@ -26,7 +28,7 @@ type UserTransaction = {
value: number;
currency: string;
application: string;
rewardTier: number;
rewardTier: Rarity;
lootboxCount: number;
};

Expand Down Expand Up @@ -227,7 +229,7 @@ export const loader: LoaderFunction = async ({ params, request }) => {
currency,
application,
lootboxCount,
rewardTier,
rewardTier: translateRewardTierToRarity(Object.values(Rarity).indexOf(rewardTier)),
};
}
);
Expand Down
4 changes: 3 additions & 1 deletion web/app.fluidity.money/app/types/Transaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Rarity } from "@fluidity-money/surfing";

type Transaction = {
sender: string;
receiver: string;
Expand All @@ -14,7 +16,7 @@ type Transaction = {
swapType?: "in" | "out";
utilityTokens?: { [tokens: string]: number };
application: string;
rewardTier: number;
rewardTier: Rarity;
lootboxCount: number;
};

Expand Down

0 comments on commit 66cea87

Please sign in to comment.