diff --git a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/useUserMenuItems.tsx b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/useUserMenuItems.tsx index f8e59cc28d6..03969ec2edd 100644 --- a/packages/commonwealth/client/scripts/views/components/SublayoutHeader/useUserMenuItems.tsx +++ b/packages/commonwealth/client/scripts/views/components/SublayoutHeader/useUserMenuItems.tsx @@ -32,7 +32,8 @@ import { } from 'views/components/component_kit/cw_toggle'; import CWIconButton from 'views/components/component_kit/new_designs/CWIconButton'; import useAuthentication from '../../modals/AuthModal/useAuthentication'; -import { MobileTabType, mobileTabParam } from '../../pages/RewardsPage/utils'; +import { MobileTabType } from '../../pages/RewardsPage/types'; +import { mobileTabParam } from '../../pages/RewardsPage/utils'; import { useCommunityStake } from '../CommunityStake'; import UserMenuItem from './UserMenuItem'; import useCheckAuthenticatedAddresses from './useCheckAuthenticatedAddresses'; diff --git a/packages/commonwealth/client/scripts/views/modals/InviteLinkModal/useReferralLink.ts b/packages/commonwealth/client/scripts/views/modals/InviteLinkModal/useReferralLink.ts index cce7b15921d..1cbbc5f84bd 100644 --- a/packages/commonwealth/client/scripts/views/modals/InviteLinkModal/useReferralLink.ts +++ b/packages/commonwealth/client/scripts/views/modals/InviteLinkModal/useReferralLink.ts @@ -7,7 +7,7 @@ import { const useReferralLink = ({ autorun = false }: { autorun?: boolean } = {}) => { const referralsEnabled = useFlag('referrals'); - const { data: refferalLinkData, isLoading: isLoadingReferralLink } = + const { data: referralLinkData, isLoading: isLoadingReferralLink } = useGetReferralLinkQuery(); const { @@ -16,7 +16,7 @@ const useReferralLink = ({ autorun = false }: { autorun?: boolean } = {}) => { isLoading: isLoadingCreateReferralLink, } = useCreateReferralLinkMutation(); - const referralLink = refferalLinkData?.referral_link; + const referralLink = referralLinkData?.referral_link; useRunOnceOnCondition({ callback: () => createReferralLink({}), diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/RewardsPage.tsx b/packages/commonwealth/client/scripts/views/pages/RewardsPage/RewardsPage.tsx index acf62d7c0e5..ebe3b039949 100644 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/RewardsPage.tsx +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/RewardsPage.tsx @@ -14,16 +14,10 @@ import { } from '../../components/component_kit/new_designs/CWTabs'; import { PageNotFound } from '../404'; import RewardsTab from './RewardsTab'; -import { QuestCard, RefferalCard, WalletCard } from './cards'; +import { QuestCard, ReferralCard, WalletCard } from './cards'; import { QuestTable, ReferralTable, WalletTable } from './tables'; -import { - MobileTabType, - TableType, - getInitialTab, - mobileTabParam, - tabToTable, - typeToIcon, -} from './utils'; +import { MobileTabType, TableType } from './types'; +import { getInitialTab, mobileTabParam, tabToTable, typeToIcon } from './utils'; import './RewardsPage.scss'; @@ -71,7 +65,7 @@ const RewardsPage = () => {
{(!isWindowSmallInclusive || mobileTab === MobileTabType.Referrals) && ( - handleTabChange(MobileTabType.Referrals)} /> )} diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.scss b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.scss new file mode 100644 index 00000000000..98b25a011b6 --- /dev/null +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.scss @@ -0,0 +1,2 @@ +.ReferralCard { +} diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.tsx b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.tsx similarity index 58% rename from packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.tsx rename to packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.tsx index 1c7e6210b11..a50fe70f79b 100644 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.tsx +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/ReferralCard.tsx @@ -2,13 +2,13 @@ import React from 'react'; import RewardsCard from '../../RewardsCard'; -import './RefferalCard.scss'; +import './ReferralCard.scss'; -interface RefferalCardProps { +interface ReferralCardProps { onSeeAllClick: () => void; } -const RefferalCard = ({ onSeeAllClick }: RefferalCardProps) => { +const ReferralCard = ({ onSeeAllClick }: ReferralCardProps) => { return ( { icon="userSwitch" onSeeAllClick={onSeeAllClick} > -
Referral Card Body
+
Referral Card Body
); }; -export default RefferalCard; +export default ReferralCard; diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/index.ts b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/index.ts new file mode 100644 index 00000000000..9f8e05c3a2b --- /dev/null +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/ReferralCard/index.ts @@ -0,0 +1,3 @@ +import ReferralCard from './ReferralCard'; + +export default ReferralCard; diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.scss b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.scss deleted file mode 100644 index 6ba3cc3e7e6..00000000000 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/RefferalCard.scss +++ /dev/null @@ -1,2 +0,0 @@ -.RefferalCard { -} diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/index.ts b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/index.ts deleted file mode 100644 index 5329ee1d53f..00000000000 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/RefferalCard/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import RefferalCard from './RefferalCard'; - -export default RefferalCard; diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/index.ts b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/index.ts index d3e65889bd5..b3d1ee00d26 100644 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/index.ts +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/cards/index.ts @@ -1,5 +1,5 @@ import QuestCard from './QuestCard'; -import RefferalCard from './RefferalCard'; +import ReferralCard from './ReferralCard'; import WalletCard from './WalletCard'; -export { QuestCard, RefferalCard, WalletCard }; +export { QuestCard, ReferralCard, WalletCard }; diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/types.ts b/packages/commonwealth/client/scripts/views/pages/RewardsPage/types.ts new file mode 100644 index 00000000000..3e2d83c0972 --- /dev/null +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/types.ts @@ -0,0 +1,17 @@ +export enum MobileTabType { + Referrals = 'Referrals', + WalletBalance = 'Wallet Balance', + Quests = 'Quests', +} + +export enum TableType { + Referrals = 'Referrals', + TokenTXHistory = 'Token TX History', + XPEarnings = 'XP Earnings', +} + +export const enum TabParam { + referrals = 'referrals', + wallet = 'wallet', + quests = 'quests', +} diff --git a/packages/commonwealth/client/scripts/views/pages/RewardsPage/utils.ts b/packages/commonwealth/client/scripts/views/pages/RewardsPage/utils.ts index 9a5e666afc0..97e3488bbf1 100644 --- a/packages/commonwealth/client/scripts/views/pages/RewardsPage/utils.ts +++ b/packages/commonwealth/client/scripts/views/pages/RewardsPage/utils.ts @@ -1,20 +1,15 @@ -export enum MobileTabType { - Referrals = 'Refferal Earnings', - WalletBalance = 'Wallet Balance', - Quests = 'Quests', -} +import { MobileTabType, TableType, TabParam } from './types'; -export enum TableType { - Referrals = 'Referrals', - TokenTXHistory = 'Token TX History', - XPEarnings = 'XP Earnings', -} +export const getInitialTab = () => { + const params = new URLSearchParams(location.search); + const tabParam = params.get('tab'); -export const enum TabParam { - referrals = 'referrals', - wallet = 'wallet', - quests = 'quests', -} + if (!tabParam) { + return MobileTabType.Referrals; + } + + return tabParamToMobileTab[tabParam]; +}; export const tabParamToMobileTab = { [TabParam.referrals]: MobileTabType.Referrals, @@ -39,14 +34,3 @@ export const typeToIcon = { [MobileTabType.WalletBalance]: 'cardholder', [MobileTabType.Quests]: 'trophy', }; - -export const getInitialTab = () => { - const params = new URLSearchParams(location.search); - const tabParam = params.get('tab'); - - if (!tabParam) { - return TabParam.referrals; - } - - return tabParamToMobileTab[tabParam]; -};