Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 2 additions & 7 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -44,14 +44,9 @@
'/?/' +
l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') +
(l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') +
l.hash
l.hash,
);
</script>
<script type="text/javascript">
if (location.pathname.startsWith('/points') || window.location.pathname.startsWith('/points/')) {
window.location.href = "https://portal.push.org/rewards";
}
</script>
</head>
<body></body>
</html>
2 changes: 1 addition & 1 deletion src/helpers/w2w/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const decryptMessages = async ({
signatureValidationPubliKey = member ? member.publicKey : '';
} else {
const latestUserInfo = inbox.find(
(x) => x.wallets.split(':')[1]?.toLowerCase() === currentChat?.wallets?.split(':')[1]?.toLowerCase()
(x) => x.wallets.split(':')[1]?.toLowerCase() === currentChat?.wallets?.split(':')[1]?.toLowerCase(),
);

if (latestUserInfo) {
Expand Down
44 changes: 2 additions & 42 deletions src/modules/rewards/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,22 @@
import { FC } from 'react';

// third party libraries
import { useSelector } from 'react-redux';
import { css } from 'styled-components';
import { useSearchParams } from 'react-router-dom';

//Hooks
import { useRewardsTabs } from './hooks/useRewardsTabs';
import { useDiscordSession } from './hooks/useDiscordSession';
import { useRewardsAuth } from './hooks/useRewardsAuth';
import { useCreateRewardsUser } from './hooks/useCreateRewardsUser';

//Types
import { UserStoreType } from 'types';

//Components
import { Box, Text } from 'blocks';
import { RewardsTabsContainer } from './components/RewardsTabsContainer';
import UnlockProfileWrapper, { UNLOCK_PROFILE_TYPE } from 'components/chat/unlockProfile/UnlockProfileWrapper';
import { useRewardsContext } from 'contexts/RewardsContext';

export type RewardsProps = {};

const Rewards: FC<RewardsProps> = () => {
const { userPushSDKInstance } = useSelector((state: UserStoreType) => state.user);

//fetch ref from url
const [searchParams] = useSearchParams();

Expand All @@ -35,21 +27,12 @@ const Rewards: FC<RewardsProps> = () => {
// Used to set the discord session after discord redirects back to the Dapp.
useDiscordSession();

const { activeTab, handleSetActiveTab } = useRewardsTabs();

const { isAuthModalVisible } = useRewardsContext();

const { connectUserWallet, hideAuthModal } = useRewardsAuth();
const { activeTab } = useRewardsTabs();

useCreateRewardsUser();

const heading = activeTab === 'leaderboard' ? 'Push Reward Points' : 'Introducing Push Reward Points Program';

// retry unlock profile
const handleUnlockProfile = () => {
connectUserWallet();
};

return (
<Box
flexDirection="column"
Expand All @@ -73,30 +56,7 @@ const Rewards: FC<RewardsProps> = () => {
{heading}
</Text>

<RewardsTabsContainer
activeTab={activeTab}
handleSetActiveTab={handleSetActiveTab}
handleUnlockProfile={handleUnlockProfile}
/>

{userPushSDKInstance && userPushSDKInstance?.readmode() && isAuthModalVisible && (
<Box
display="flex"
justifyContent="center"
width="-webkit-fill-available"
alignItems="center"
css={css`
z-index: 99999;
`}
>
<UnlockProfileWrapper
type={UNLOCK_PROFILE_TYPE.MODAL}
showConnectModal={isAuthModalVisible}
onClose={() => hideAuthModal()}
description="Unlock your profile to proceed."
/>
</Box>
)}
<RewardsTabsContainer />
</Box>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/modules/rewards/components/DashboardSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DashboardSectionHeader } from './DashboardSectionHeader';
import { DashboardSectionPoints } from './DashboardSectionPoints';

export type DashboardSectionProps = {
onGetStarted: () => void;
onGetStarted?: () => void;
};

const DashboardSection: FC<DashboardSectionProps> = ({ onGetStarted }) => {
Expand Down
20 changes: 11 additions & 9 deletions src/modules/rewards/components/DashboardSectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import { css } from 'styled-components';
import { Box, Button, Link, Points, Text } from 'blocks';

export type DashboardSectionHeaderProps = {
onGetStarted: () => void;
onGetStarted?: () => void;
};

const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({ onGetStarted }) => {
const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({}) => {
const handleGoToNewSeason = () => {
window.open('http://portal.push.org/rewards');
};
return (
<Box
borderRadius="radius-md"
Expand Down Expand Up @@ -46,16 +49,16 @@ const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({ onGetStarted
variant="h4-semibold"
color="text-on-light-bg"
>
Push Points S1 has Ended!
Push Points S2 is Live
</Text>
<Box maxWidth={{ tb: 'auto', initial: '607px' }}>
<Text
variant="bl-regular"
color="text-on-light-bg"
>
Push Chain Rewards S2 coming soon! Find out more at{' '}
Season 1 has ended and your points have been snapshot. Participate in Season 2 at{' '}
<Link
to="https://x.com/PushChain"
to="https://portal.push.org/rewards"
target="_blank"
textProps={{
variant: 'bl-regular',
Expand All @@ -65,7 +68,7 @@ const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({ onGetStarted
`,
}}
>
Push Chain
Push Portal
</Link>
</Text>
</Box>
Expand All @@ -75,10 +78,9 @@ const DashboardSectionHeader: FC<DashboardSectionHeaderProps> = ({ onGetStarted
<Button
variant="tertiary"
size="medium"
onClick={onGetStarted}
disabled={true}
onClick={handleGoToNewSeason}
>
Ended
Go To Season 2
</Button>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/rewards/components/DashboardSectionPoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const DashboardSectionPoints: FC<DashboardSectionPointsProps> = ({
variant="h1-bold"
color="text-primary"
>
0
-
</Text>
)}

Expand Down
45 changes: 4 additions & 41 deletions src/modules/rewards/components/RewardsTabsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
import { FC } from 'react';

//Components
import { Box, TabItem, Tabs } from 'blocks';
import { Box } from 'blocks';
import { DashboardSection } from './DashboardSection';
import { LeaderBoardSection } from './LeaderBoardSection';
import { RewardsTabs } from '../Rewards.types';
import { ReferralSection } from './ReferralSection';
import { RewardsActivitiesBottomSection } from './RewardsActivitiesBottomSection';
import { DailyRewardsSection } from './DailyRewardsSection';

export type RewardsTabsContainerProps = {
activeTab: RewardsTabs;
handleSetActiveTab: (tab: RewardsTabs) => void;
handleUnlockProfile: () => void;
};

const RewardsTabsContainer: FC<RewardsTabsContainerProps> = ({
activeTab,
handleSetActiveTab,
handleUnlockProfile,
}) => {
const rewardsTabs: TabItem[] = [
{
key: 'dashboard',
label: 'Dashboard',
children: <DashboardSection onGetStarted={() => handleSetActiveTab('activity')} />,
},
{
key: 'activity',
label: 'Reward Activities',
children: <DailyRewardsSection />,
},
{
key: 'leaderboard',
label: 'Leaderboard',
children: <LeaderBoardSection />,
},
];
export type RewardsTabsContainerProps = {};

const RewardsTabsContainer: FC<RewardsTabsContainerProps> = ({}) => {
return (
<>
<Box
Expand All @@ -47,16 +16,10 @@ const RewardsTabsContainer: FC<RewardsTabsContainerProps> = ({
flexDirection="column"
padding={{ ml: 'spacing-sm', initial: 'spacing-md' }}
>
<Tabs
items={rewardsTabs}
activeKey={activeTab}
onChange={(activeKey) => handleSetActiveTab(activeKey as RewardsTabs)}
/>
<DashboardSection />
</Box>

{/* bottom sections */}
{activeTab === 'dashboard' && <ReferralSection handleUnlockProfile={handleUnlockProfile} />}
{activeTab === 'activity' && <RewardsActivitiesBottomSection />}
</>
);
};
Expand Down
6 changes: 0 additions & 6 deletions src/structure/MasterInterfacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ function MasterInterfacePage() {
}
}, [location]);

useEffect(() => {
if (location.pathname.startsWith('/points') || location.pathname.startsWith('/points/')) {
window.location.href = 'https://portal.push.org/rewards';
}
}, [location.pathname]);

const blockedLoadingToast = useToast();

return (
Expand Down
Loading