Skip to content

Commit

Permalink
Merge pull request #794 from haqq-network/dev
Browse files Browse the repository at this point in the history
release
  • Loading branch information
kioqq authored Apr 26, 2024
2 parents e021c13 + d2ac297 commit 7126704
Show file tree
Hide file tree
Showing 18 changed files with 657 additions and 19 deletions.
4 changes: 3 additions & 1 deletion apps/islamic-website/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"first": "Mainnet accounts created",
"second": "Transactions in the last 24 hours",
"third": "Seconds to consensus finality",
"fourth": "Average cost per transaction"
"fourth": "Average cost per transaction",
"fifth": "Total supply ISLM",
"sixth": "Circulating supply ISLM"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions apps/islamic-website/utils/get-chain-stats-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const getChainStatsFromFalconer = cache(async () => {
transactionsInLast24Hours: Number.parseFloat(stats.transactionsIn24Hour),
secondsToConsensusFinality: Number.parseFloat(stats.consensusFinality),
averageCostPerTransaction: Number.parseFloat(stats.transactionAvgCost),
supply: Number.parseFloat(stats.supply),
circulatingSupply: Number.parseFloat(stats.circulatingSupply),
};
} catch (error) {
console.error(error);
Expand All @@ -27,5 +29,7 @@ export const getChainStatsFromFalconer = cache(async () => {
transactionsInLast24Hours: 0,
secondsToConsensusFinality: 0,
averageCostPerTransaction: 0,
supply: 0,
circulatingSupply: 0,
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface HaqqChainStats {
coinomicsEmissionRate: string;
supply: string;
coinomicsWillBeMinted: string;
circulatingSupply: string;
}

export async function getHaqqChainStatsData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ export function HeroBlock() {
const distinctId = posthog.get_distinct_id();

if (!distinctId) {
return {};
return {
appStoreLink: null,
playMarketLink: null,
};
}

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
'use client';
import { useMemo } from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import { usePostHog } from 'posthog-js/react';
import {
Container,
GradientText,
Text,
WalletDownloadButton,
RatingBadge,
WalletDownloadWithQrButton,
WalletDownloadButton,
} from '@haqq/islamic-website-ui-kit';
import halfIphoneImgData from '../../assets/images/half-iphone.jpg';
import iphoneImgData from '../../assets/images/iphone.jpg';
import { getDynamicLink } from '../utils/get-dynamic-link';

export function PortfolioBlock({
storeRatings,
Expand All @@ -20,6 +25,31 @@ export function PortfolioBlock({
};
}) {
const t = useTranslations('index-page');
const posthog = usePostHog();

const { appStoreLink, playMarketLink } = useMemo(() => {
const distinctId = posthog.get_distinct_id();

if (!distinctId) {
return {
appStoreLink: null,
playMarketLink: null,
};
}

return {
appStoreLink: getDynamicLink(
'https://haqq.network/wallet',
distinctId,
'https://apps.apple.com/app/haqq-wallet-by-bored-gen/id6443843352',
),
playMarketLink: getDynamicLink(
'https://haqq.network/wallet',
distinctId,
'https://play.google.com/store/apps/details?id=com.haqq.wallet',
),
};
}, [posthog]);

return (
<section>
Expand Down Expand Up @@ -73,12 +103,51 @@ export function PortfolioBlock({
<RatingBadge rating={storeRatings.googlePlay} />
</div>
</div>
<div className="mt-[20px] flex flex-col gap-x-[16px] gap-y-[20px] lg:mt-[24px] lg:flex-row">
<div className="hidden lg:mt-[24px] lg:flex lg:flex-row lg:gap-x-[16px]">
<div className="w-fit">
{appStoreLink && (
<Link
href={appStoreLink}
target="_blank"
rel="noopener noreferrer"
data-attr="download-ios"
>
<WalletDownloadWithQrButton
type="apple"
title={t(
'portfolio-block.stores.download-button.title',
)}
link={appStoreLink}
/>
</Link>
)}
</div>
<div className="w-fit">
{playMarketLink && (
<Link
href={playMarketLink}
target="_blank"
rel="noopener noreferrer"
data-attr="download-android"
>
<WalletDownloadWithQrButton
type="google"
title={t(
'portfolio-block.stores.download-button.title',
)}
link={playMarketLink}
/>
</Link>
)}
</div>
</div>
<div className="mt-[20px] flex flex-col gap-y-[20px] lg:hidden">
{appStoreLink && (
<Link
href="https://apps.apple.com/app/haqq-wallet-by-bored-gen/id6443843352"
href={appStoreLink}
target="_blank"
rel="noopener noreferrer"
data-attr="download-ios"
>
<WalletDownloadButton
type="apple"
Expand All @@ -87,12 +156,13 @@ export function PortfolioBlock({
)}
/>
</Link>
</div>
<div className="w-fit">
)}
{playMarketLink && (
<Link
href="https://play.google.com/store/apps/details?id=com.haqq.wallet"
href={playMarketLink}
target="_blank"
rel="noopener noreferrer"
data-attr="download-android"
>
<WalletDownloadButton
type="google"
Expand All @@ -101,7 +171,7 @@ export function PortfolioBlock({
)}
/>
</Link>
</div>
)}
</div>
</div>
</div>
Expand Down
18 changes: 18 additions & 0 deletions libs/islamic-website/index-page/src/lib/utils/get-dynamic-link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function getDynamicLink(
link: string,
distinctId: string,
forwardTo?: string,
) {
const linkIrl = new URL(link);
linkIrl.searchParams.append('distinct_id', distinctId);

if (forwardTo) {
linkIrl.searchParams.append('go_to', forwardTo);
}

return (
'https://haqq.page.link/' +
`?link=${encodeURIComponent(linkIrl.toString())}` +
'&apn=com.haqq.wallet&isi=6443843352&ibi=com.haqq.wallet'
);
}
18 changes: 17 additions & 1 deletion libs/islamic-website/index-page/src/lib/why-block/why-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export interface ChainStats {
transactionsInLast24Hours: number;
secondsToConsensusFinality: number;
averageCostPerTransaction: number;
supply: number;
circulatingSupply: number;
}

function IslamStar() {
Expand Down Expand Up @@ -169,6 +171,8 @@ export function WhyBlock({ stats }: { stats: ChainStats }) {
transactionsInLast24Hours: stats.transactionsInLast24Hours,
secondsToConsensusFinality: stats.secondsToConsensusFinality,
averageCostPerTransaction: stats.averageCostPerTransaction,
supply: stats.supply,
circulatingSupply: stats.circulatingSupply,
};
}, [stats]);

Expand Down Expand Up @@ -237,7 +241,7 @@ export function WhyBlock({ stats }: { stats: ChainStats }) {
</Text>
<div
ref={blockRef}
className="mt-[16px] grid w-full gap-[38px] sm:grid-cols-2 md:mt-[20px] lg:mt-[24px] lg:grid-cols-4"
className="mt-[16px] grid w-full gap-[38px] sm:grid-cols-2 md:mt-[20px] lg:mt-[24px] lg:grid-cols-3"
>
<StatisticsBlockStatCard
value={memoizedStats.mainnetAccountsCreated}
Expand All @@ -256,6 +260,18 @@ export function WhyBlock({ stats }: { stats: ChainStats }) {
startAnimation={startAnimation}
prefix="~"
/>
<StatisticsBlockStatCard
value={memoizedStats.supply}
title={t('counters.statistic-card.fifth')}
startAnimation={startAnimation}
postfix="ISLM"
/>
<StatisticsBlockStatCard
value={memoizedStats.circulatingSupply}
title={t('counters.statistic-card.sixth')}
startAnimation={startAnimation}
postfix="ISLM"
/>
<StatisticsBlockStatCard
value={memoizedStats.averageCostPerTransaction}
title={t('counters.statistic-card.fourth')}
Expand Down
11 changes: 11 additions & 0 deletions libs/islamic-website/markets-page/src/assets/images/uniswap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import mexcLogoImageData from '../../assets/images/mexc.svg';
import osmosisLogoImageData from '../../assets/images/osmosis.svg';
import bgPageImageData from '../../assets/images/page-background.svg';
import sushiLogoImageData from '../../assets/images/sushi.svg';
import uniswapLogoImageData from '../../assets/images/uniswap.svg';
import xtLogoImageData from '../../assets/images/xt.svg';
import { CEXCard } from '../cex-card/cex-card';
import { DEXBlock } from '../dex-block/dex-block';
Expand All @@ -19,6 +20,20 @@ const dexData: Array<{
logo: string;
pools: Array<{ pair: [string, string]; href: string }>;
}> = [
{
name: 'UNISWAP',
logo: uniswapLogoImageData,
pools: [
{
pair: ['USDC', 'ISLM'],
href: 'https://app.uniswap.org/explore/pools/ethereum/0x2ed7B9F472bE4D0A5a0a3e6D2f8E7dECCF7dFC9D',
},
{
pair: ['ETH', 'ISLM'],
href: 'https://app.uniswap.org/explore/pools/ethereum/0x1DE43182992FE252674B5Aac9B5C884ca48D2812',
},
],
},
{
name: 'SUSHI',
logo: sushiLogoImageData,
Expand Down
1 change: 1 addition & 0 deletions libs/islamic-website/ui-kit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export * from './lib/blog-post-card/blog-post-card';
export * from './lib/tab/tab';
export * from './lib/breadcrumb/breadcrumb';
export * from './lib/blog-article/blog-article';
export * from './lib/popover/popover';
Loading

0 comments on commit 7126704

Please sign in to comment.