Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(translations): remove translations to work with static pages #742

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
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
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- pierregee/remove-translations-to-work-with-static-pages # Change this to your main branch if different

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18" # or the version you're using

- name: Install dependencies
run: npm install

- name: Build
run: |
npm run build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs # The directory generated by `next build`
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ coverage
# next.js
/.next/
/out/
/docs/

# production
/build
Expand Down
6 changes: 0 additions & 6 deletions next-i18next.config.js

This file was deleted.

3 changes: 1 addition & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { i18n } = require("./next-i18next.config");

const securityHeaders = [
{
key: "Content-Security-Policy",
Expand Down Expand Up @@ -60,6 +58,7 @@ module.exports = {
},
images: {
domains: ["images.prismic.io"],
unoptimized: true,
},
async redirects() {
return [
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"classnames": "^2.3.2",
"gray-matter": "^4.0.3",
"lodash": "^4.17.21",
"next-i18next": "^14.0.0",
"react-countup": "^6.5.0",
"react-markdown": "^8.0.7",
"react-number-format": "^5.3.1",
Expand Down
69 changes: 0 additions & 69 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://defichain.com</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/bug-bounty</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/explore/dex</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/explore/dfi</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/explore/masternodes</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/explore/masternodes/technical-guide</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/explore/wallets</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/learn</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/media</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/metachain</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/privacy-policy</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/security</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://defichain.com/white-paper</loc><lastmod>2024-10-02T08:47:59.288Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
2 changes: 1 addition & 1 deletion src/components/commons/StartExploringButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IoChevronDown } from "react-icons/io5";
import classNames from "classnames";
import { useTranslation } from "next-i18next";
import { useTranslation } from "../../hooks/useTranslation";

export function StartExploringButton({
startExploringJumpLink,
Expand Down
30 changes: 3 additions & 27 deletions src/components/commons/StatisticPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useUnitSuffix } from "@hooks/useUnitSuffix";
import CountUp from "react-countup";
import classNames from "classnames";
import { useTranslation } from "next-i18next";
import { useRouter } from "next/router";

interface StatisticPanelItemProps {
Expand Down Expand Up @@ -75,7 +74,6 @@ function StatisticsPanelItem({
isTabletHorizontal?: boolean;
testID: string;
}) {
const { t } = useTranslation("common");
const router = useRouter();
const { suffix, value } = useUnitSuffix(
stats === undefined ? "N/A" : stats.toString(),
Expand Down Expand Up @@ -112,7 +110,7 @@ function StatisticsPanelItem({
)}
>
{stats ? (
getLocaledStatisticValue(t, router.locale, prefix, value, suffix)
getLocaledStatisticValue(router.locale, prefix, value, suffix)
) : (
<>N/A</>
)}
Expand All @@ -134,7 +132,6 @@ function StatisticsPanelItem({
}

function getLocaledStatisticValue(
t: any,
locale?: string,
prefix?: string,
value?: string,
Expand All @@ -144,7 +141,7 @@ function getLocaledStatisticValue(
case "de":
return (
<>
{suffix !== "" ? `${t("statisticsDisplay.prefix")} ` : ``}
{suffix !== "" ? ` ` : ``}
<CountUp
onUpdate={({ reset, start }) => {
reset();
Expand All @@ -158,27 +155,6 @@ function getLocaledStatisticValue(
</>
);

// commented out for further discussions
// case "fr":
// return (
// <>
// <CountUp
// onUpdate={({ reset, start }) => {
// reset();
// start();
// }}
// end={Number(value)}
// enableScrollSpy
// duration={0.5}
// />
// {suffix !== ""
// ? ` ${t(`statisticsDisplay.suffix.${suffix}`)} ${
// prefix ? " de $" : ""
// } ou plus`
// : `+`}
// </>
// );

default:
return (
<>
Expand All @@ -192,7 +168,7 @@ function getLocaledStatisticValue(
enableScrollSpy
duration={0.5}
/>
{suffix !== "" ? `${t(`statisticsDisplay.suffix.${suffix}`)} ` : ``}
{suffix !== "" ? `${suffix}` : ``}
</>
);
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/commons/navigatedPages/GuideComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import classNames from "classnames";
import { PropsWithChildren } from "react";
import { useTranslation } from "next-i18next";

export function ContentHeader({
text,
Expand Down Expand Up @@ -76,11 +75,10 @@ export function ContentDescription({
}

export function Step({ count }: { count: string }) {
const { t } = useTranslation("page-explore-masternodes");
return (
<div className="flex flex-row mb-2 mt-[72px] lg:mt-12">
<span className="font-mono text-dark-700 tracking-[0.04em] leading-4">
{t("technicalGuide.step")}&nbsp;{count}
STEP&nbsp;{count}
</span>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/BlockchainFeatureColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "@components/icons/assets/blockchainFeatures/DevelopmentIcon";
import classNames from "classnames";
import { useState } from "react";
import { useTranslation } from "next-i18next";
import { useTranslation } from "../../hooks/useTranslation";

interface BlockchainFeatureItemProp {
title: string;
Expand Down
10 changes: 5 additions & 5 deletions src/components/index/BlockchainFeaturesSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// import { Button } from "@components/commons/Buttons";
import { Container } from "@components/commons/Container";
import { useTranslation } from "next-i18next";
import Slider from "react-slick";
import { SectionTitle } from "@components/commons/SectionTitle";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -30,9 +29,8 @@ export const BlockchainFeatureItems = [
];

export function BlockchainFeaturesSection(): JSX.Element {
const { t } = useTranslation("page-index");
const router = useRouter();
const separatedTitle = t("BlockchainFeatureSection.title").split(" ");
const separatedTitle = "Designed for Decentralized Finance".split(" ");
const sliderSettings = {
arrows: false,
dots: true,
Expand Down Expand Up @@ -65,7 +63,7 @@ export function BlockchainFeaturesSection(): JSX.Element {
data-testid="blockchain-feature-section-text"
>
<SectionTitle
text={t("BlockchainFeatureSection.subtitle")}
text="NON-TURING-COMPLETE BLOCKCHAIN"
testID="non-turing-complete-blockchain"
/>
<h2
Expand All @@ -90,7 +88,9 @@ export function BlockchainFeaturesSection(): JSX.Element {
className="text-dark-700 tracking-[.03em] lg:text-xl lg:tracking-normal font-desc"
data-testid={`section-desc-${separatedTitle}`}
>
{t("BlockchainFeatureSection.desc")}
DeFiChain offers comprehensive functionality tailored to the
Distributed Ledger Technology (DLT) community, with an emphasis on
simplicity, speed, and security.
</div>
{/* TODO: uncomment after mvp */}
{/* <Button
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/DeFiChainEcoSystemSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { SectionTitle } from "@components/commons/SectionTitle";
import { useDeviceDetect, ViewPort } from "@hooks/useDeviceDetect";
import { useWindowDimensions } from "@hooks/useWindowDimensions";
import classNames from "classnames";
import { useTranslation } from "next-i18next";
import { useRouter } from "next/router";
import { useTranslation } from "../../hooks/useTranslation";
import { Card } from "./components/Card";

export function DeFiChainEcoSystemSection(): JSX.Element {
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/HomePageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Container } from "@components/commons/Container";
import { useTranslation } from "next-i18next";
import { Video } from "@components/commons/Video";
import classNames from "classnames";
import { useRouter } from "next/router";
import { useTranslation } from "../../hooks/useTranslation";

export function HomePageHeader(): JSX.Element {
const { t } = useTranslation("page-index");
Expand Down
2 changes: 1 addition & 1 deletion src/components/index/ReadyForFlexibility.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Container } from "@components/commons/Container";
import classNames from "classnames";
import { SecondaryButton } from "@components/commons/Buttons";
import { useTranslation } from "next-i18next";
import { SectionTitle } from "@components/commons/SectionTitle";
import { useWindowDimensions } from "@hooks/useWindowDimensions";
import { useTranslation } from "../../hooks/useTranslation";

export function ReadyForFlexibility() {
const { t } = useTranslation("page-index");
Expand Down
Loading
Loading