Skip to content

Commit

Permalink
feat: update keys
Browse files Browse the repository at this point in the history
  • Loading branch information
icfor committed Nov 14, 2023
1 parent e95596f commit 2947289
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { Box, Typography } from "@mui/material";
import { useCounter } from "@screens/staking/components/hooks";
import { convertToMoney } from "@utils/convert_to_money";
import useTranslation from "next-translate/useTranslation";

import useStyles from "./useStyles";

const StatsCard = ({ title, stats }: any) => {
const { t } = useTranslation("common");
const styles = useStyles();
const { counterValue, counterRef } = useCounter(stats);

return (
<Box ref={counterRef} css={styles.root}>
<Typography variant="h6">{t(title)}</Typography>
<Typography variant="h6">{title}</Typography>
{title === "full tvl" && stats === "-" && (
<Typography variant="h3">{`$ ${stats}`}</Typography>
)}
Expand Down
8 changes: 4 additions & 4 deletions src/screens/contact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const Contact = () => {
const router = useRouter();

const selectList = [
{ label: "item_1", name: "collaboration" },
{ label: "item_2", name: "enterprise_solution" },
{ label: "item_3", name: "careers" },
{ label: "item_4", name: "other" },
{ label: t("item_1"), name: "collaboration" },
{ label: t("item_2"), name: "enterprise_solution" },
{ label: t("item_3"), name: "careers" },
{ label: t("item_4"), name: "other" },
] as const;

const inputRef = useRef<HTMLInputElement>(null);
Expand Down
14 changes: 0 additions & 14 deletions src/screens/staking/components/hero/components/stats/config.ts

This file was deleted.

33 changes: 27 additions & 6 deletions src/screens/staking/components/hero/components/stats/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,30 @@ import {
} from "@graphql/queries";
import { networkFunctions } from "@utils/network_functions";
import { networkNumber } from "@utils/network_info";
import useTranslation from "next-translate/useTranslation";
import { useEffect, useMemo, useState } from "react";

import { statsItems } from "./config";

export const useStatsHook = () => {
const { t } = useTranslation("common");

const statsItems = useMemo(
() => [
{
title: t("full tvl"),
stats: "-",
},
{
title: t("users staking"),
stats: "-",
},
{
title: t("supporting networks"),
stats: 0,
},
],
[t],
);

const [stats, setStats] = useState(statsItems);
const [cosmosTVL, setCosmosTVL] = useState(0);
const [elrondTotalTVL, setElrondTotalTVL] = useState(0);
Expand Down Expand Up @@ -130,7 +149,7 @@ export const useStatsHook = () => {
setTotalUsers(userCount);
}
statsItems.map((item, i) =>
item.title === "users staking"
item.title === t("users staking")
? setStats((prevStats) => ({
...prevStats,
[i]: {
Expand All @@ -148,6 +167,7 @@ export const useStatsHook = () => {
radixUser,
totalUsers,
setTotalUsers,
t,
]);

useEffect(() => {
Expand Down Expand Up @@ -209,7 +229,7 @@ export const useStatsHook = () => {
setTotalTVL(tvl);
}
statsItems.map((item, i) =>
item.title === "full tvl"
item.title === t("full tvl")
? setStats((prevStats) => ({
...prevStats,
[i]: {
Expand All @@ -228,12 +248,13 @@ export const useStatsHook = () => {
radixTotalTVL,
totalTVL,
setTotalTVL,
t,
]);

useMemo(() => {
if (networkNumber !== 0) {
statsItems.map((item, i) =>
item.title === "supporting networks"
item.title === t("supporting networks")
? setStats((prevStats) => ({
...prevStats,
[i]: {
Expand All @@ -245,7 +266,7 @@ export const useStatsHook = () => {
);
}
return stats;
}, [networkNumber]);
}, [networkNumber, t]);

return stats;
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* eslint-disable no-nested-ternary */
import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import useTranslation from "next-translate/useTranslation";
import Image from "next/image";

const HowToCard = (props: any) => {
const { t } = useTranslation("staking");
const theme = useTheme();
const onlyLargeScreen = useMediaQuery(theme.breakpoints.up("laptop"));
const { id, image, title, desc } = props;
Expand Down Expand Up @@ -52,7 +50,7 @@ const HowToCard = (props: any) => {
}}
variant="h4"
>
{t(title)}
{title}
</Typography>
<Typography
color={theme.palette.custom.forbole.blue}
Expand All @@ -66,7 +64,7 @@ const HowToCard = (props: any) => {
}}
variant="body1"
>
{t(desc)}
{desc}
</Typography>
</Box>
</Box>
Expand Down
26 changes: 0 additions & 26 deletions src/screens/staking/components/how_it_works/config.tsx

This file was deleted.

32 changes: 31 additions & 1 deletion src/screens/staking/components/how_it_works/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
import { Box, Typography, useTheme } from "@mui/material";
import useTranslation from "next-translate/useTranslation";
import dynamic from "next/dynamic";
import { useMemo } from "react";

import { HowToCard } from "./components";
import { howTos } from "./config";

const Trans = dynamic(() => import("next-translate/Trans"), { ssr: false });

const HowItWorks = () => {
const { t } = useTranslation("staking");
const howTos = useMemo(
() => [
{
id: 1,
image: "/images/assets/image_provider.png",
title: t("trusted provider"),
desc: t("trusted provider desc"),
},
{
id: 2,
image: "/images/assets/image_stake.png",
title: t("stake"),
desc: t("stake desc"),
},
{
id: 3,
image: "/images/assets/image_rewards.png",
title: t("rewards"),
desc: t("rewards desc"),
},
{
id: 4,
image: "/images/assets/image_non-custodial.png",
title: t("non-custodial"),
desc: t("non-custodial desc"),
},
],
[t],
);

const theme = useTheme();
return (
<Box display="flex" justifyContent="center">
Expand Down
17 changes: 0 additions & 17 deletions src/screens/staking/components/why_forbole/config.tsx

This file was deleted.

25 changes: 23 additions & 2 deletions src/screens/staking/components/why_forbole/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@ import { Box, Typography, useMediaQuery, useTheme } from "@mui/material";
import useTranslation from "next-translate/useTranslation";
import dynamic from "next/dynamic";
import Image from "next/image";

import { reasons } from "./config";
import { useMemo } from "react";

const Trans = dynamic(() => import("next-translate/Trans"), { ssr: false });

const WhyForbole = () => {
const { t } = useTranslation("staking");

const reasons = useMemo(
() => [
{
title: t("reputable validator"),
desc: t("reputable validator desc"),
image: "/images/assets/image_journey.png",
},
{
title: t("security focus"),
desc: t("security focus desc"),
image: "/images/assets/image_security.png",
},
{
title: t("our future"),
desc: t("our future desc"),
image: "/images/assets/image_future.png",
},
],
[t],
);

const theme = useTheme();
const onlyLargeScreen = useMediaQuery(theme.breakpoints.up("laptop"));
return (
Expand Down

0 comments on commit 2947289

Please sign in to comment.