Skip to content

Commit 999c0ac

Browse files
authored
Merge pull request #56 from dydxprotocol/jv/fix-amplitude-plugin
fix: change plugin to class
2 parents d896083 + cf66669 commit 999c0ac

3 files changed

Lines changed: 29 additions & 24 deletions

File tree

scripts/inject-amplitude.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ async function inject(fileName) {
3535
if (!e) return;
3636
3737
// Enrichment plugin to add 'frontend' to ALL events (including automatic ones)
38-
var appendBonkPlugin = {
39-
name: 'append-bonk-plugin',
40-
execute: async function(event) {
38+
class AppendBonkPlugin {
39+
name = 'append-bonk-plugin';
40+
41+
async setup(config) {
42+
return undefined;
43+
}
44+
45+
async execute(event) {
4146
event.event_properties = {
4247
...event.event_properties,
4348
frontend: 'bonk',
@@ -47,7 +52,7 @@ async function inject(fileName) {
4752
};
4853
4954
// add plugin BEFORE init
50-
globalThis.amplitude.add(appendBonkPlugin());
55+
globalThis.amplitude.add(new AppendBonkPlugin());
5156
5257
// now initialize amplitude
5358
globalThis.amplitude.init(e${

src/pages/token/RewardsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ import { orEmptyObj } from '@/lib/typeUtils';
3232

3333
import { BonkPnlLeaderboardPanel } from './BonkPnlLeaderboardPanel';
3434
import { CompetitionLeaderboardPanel } from './CompetitionLeaderboardPanel';
35-
import { RwaCompetitionPanel } from './RwaCompetitionPanel';
3635
import { GeoblockedPanel } from './GeoblockedPanel';
3736
import { LaunchIncentivesPanel } from './LaunchIncentivesPanel';
3837
import { LiquidationRebatesHeader } from './LiquidationRebatesHeader';
3938
import { LiquidationRebatesPanel } from './LiquidationRebatesPanel';
4039
import { RebatesIncetivesPanel } from './RebatesIncetivesPanel';
4140
import { RewardsHelpPanel } from './RewardsHelpPanel';
41+
import { RwaCompetitionPanel } from './RwaCompetitionPanel';
4242
import { StakingRewardPanel } from './StakingRewardPanel';
4343
import { SwapAndStakingPanel } from './SwapAndStakingPanel';
4444
import { UnbondingPanels } from './UnbondingPanels';

src/pages/token/RwaCompetitionPanel.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ import { LoadingSpace } from '@/components/Loading/LoadingSpinner';
2525
import { Output, OutputType } from '@/components/Output';
2626
import { Panel } from '@/components/Panel';
2727
import { ColumnDef, Table } from '@/components/Table';
28-
import { SuccessTag, PrivateTag, TagSize } from '@/components/Tag';
28+
import { PrivateTag, SuccessTag, TagSize } from '@/components/Tag';
2929

3030
import { truncateAddress } from '@/lib/wallet';
3131

32-
const PRIZE_TIERS = [
33-
{ place: '1st', amount: '$3,000' },
34-
{ place: '2nd', amount: '$2,000' },
35-
{ place: '3rd', amount: '$1,000' },
36-
{ place: '4th-5th', amount: '$750' },
37-
{ place: '6th-10th', amount: '$500' },
38-
];
32+
// const PRIZE_TIERS = [
33+
// { place: '1st', amount: '$3,000' },
34+
// { place: '2nd', amount: '$2,000' },
35+
// { place: '3rd', amount: '$1,000' },
36+
// { place: '4th-5th', amount: '$750' },
37+
// { place: '6th-10th', amount: '$500' },
38+
// ];
3939

4040
export const RwaCompetitionPanel = () => {
4141
const activeWeek = getActiveRwaWeek();
42-
const { market, week } = useRwaMarketPnl();
42+
const { market } = useRwaMarketPnl();
4343

4444
const displayWeek = activeWeek ?? RWA_COMPETITION_WEEKS[RWA_COMPETITION_WEEKS.length - 1]!;
4545
const competitionStart = new Date(RWA_COMPETITION_DETAILS.startTime);
@@ -68,8 +68,8 @@ export const RwaCompetitionPanel = () => {
6868
</div>
6969

7070
<span tw="text-color-text-0">
71-
Compete for a {RWA_COMPETITION_DETAILS.rewardAmount} prize pool in every RWA
72-
trading sprint, awarded to the Top 10 traders.
71+
Compete for a {RWA_COMPETITION_DETAILS.rewardAmount} prize pool in every RWA trading
72+
sprint, awarded to the Top 10 traders.
7373
</span>
7474

7575
<div>
@@ -82,13 +82,12 @@ export const RwaCompetitionPanel = () => {
8282
</div>
8383

8484
<span tw="text-small text-color-text-0">
85-
2 days after each RWA trading sprint, users can claim rewards and check
86-
eligibility{' '}
85+
2 days after each RWA trading sprint, users can claim rewards and check eligibility{' '}
8786
<Link href="https://www.dydx.xyz/bonk-trading-competition-claims" isInline>
8887
here
8988
</Link>
90-
. Rewards are distributed within 30 days of a valid claim and must be claimed
91-
within 30 days after the trading competition ends.
89+
. Rewards are distributed within 30 days of a valid claim and must be claimed within
90+
30 days after the trading competition ends.
9291
</span>
9392
</div>
9493

@@ -122,7 +121,10 @@ const RwaLeaderboardTable = () => {
122121

123122
const userRow = pnlItems?.find((item) => item.address === dydxAddress);
124123
const data = [
125-
...new Set([...(userRow ? [userRow] : []), ...(pnlItems?.filter((item) => item.pnl !== 0) ?? [])]),
124+
...new Set([
125+
...(userRow ? [userRow] : []),
126+
...(pnlItems?.filter((item) => item.pnl !== 0) ?? []),
127+
]),
126128
];
127129

128130
return (
@@ -267,9 +269,7 @@ const getRwaTableColumnDef = ({
267269
[RwaTableColumns.Prize]: {
268270
columnKey: RwaTableColumns.Prize,
269271
getCellValue: (row) => row.position,
270-
label: (
271-
<div tw="py-0.375 text-base font-medium text-color-text-0">Prize</div>
272-
),
272+
label: <div tw="py-0.375 text-base font-medium text-color-text-0">Prize</div>,
273273
renderCell: ({ position }) => (
274274
<Output
275275
tw="text-small font-medium"

0 commit comments

Comments
 (0)