Skip to content

Commit

Permalink
save progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheartcliff committed Feb 24, 2024
1 parent 1b6b9c2 commit 9929589
Show file tree
Hide file tree
Showing 24 changed files with 463 additions and 366 deletions.
37 changes: 19 additions & 18 deletions i18n.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const NextI18Next = require('next-i18next').default;
const path = require('path');
/** @type {import('next-i18next').UserConfig} */

module.exports = new NextI18Next({
defaultLanguage: 'en-us',
otherLanguages: [
'pt-br', // Portuguese (Brazil)
'en-us', // English (USA)
'fr-fr', // French (France)
'es-es', // Spanish (Spain)
'ko-ko', // Korean (South Korea)
'ja-ja', // Japanese (Japan)
'de-de', // German (Germany)
'it-it', // Italian (Italy)
'zh-cn', // Chinese (Simplified, Mainland China)
'ar-sa', // Arabic
],
localePath: path.resolve('./public/locales'),
});
module.exports = {
i18n: {
defaultLocale: "pt-br",
locales: [
"pt-br", // Portuguese (Brazil)
"en-us", // English (USA)
"fr-fr", // French (France)
"es-es", // Spanish (Spain)
"ko-ko", // Korean (South Korea)
"ja-ja", // Japanese (Japan)
"de-de", // German (Germany)
"it-it", // Italian (Italy)
"zh-cn", // Chinese (Simplified, Mainland China)
"ar-sa", // Arabic
],
localeDetection: false,
},
};
10 changes: 6 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
/* eslint-disable import/no-extraneous-dependencies */
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
const { i18n } = require("./i18n");

module.exports = withBundleAnalyzer({
eslint: {
dirs: ['.'],
dirs: ["."],
},
poweredByHeader: false,
trailingSlash: true,
basePath: '',
basePath: "",
// The starter code load resources from `public` folder with `router.basePath` in React components.
// So, the source code is "basePath-ready".
// You can remove `basePath` if you don't need it.
reactStrictMode: true,
i18n,
});
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@
"antd": "5.11.1",
"apexcharts": "3.28.1",
"fetch-jsonp": "1.2.3",
"i18next": "^23.10.0",
"moment": "^2.30.1",
"next": "^13.3.0",
"next-i18next": "^15.2.0",
"next-language-detector": "^1.1.0",
"next-seo": "^5.15.0",
"next-sitemap": "^4.0.6",
"react": "^18.2.0",
"react-apexcharts": "1.3.9",
"react-custom-scrollbars-2": "4.5.0",
"react-dom": "^18.2.0",
"react-i18next": "^14.0.5",
"react-query": "^3.39.2"
},
"devDependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/layouts/Meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const Meta = (props: IMetaProps) => {
title: props.title,
description: props.description,
url: props.canonical,
locale: 'en_US',
locale: 'pt-br',
site_name: props.title,
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/pages.test/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen } from '@testing-library/react';

import Index from '@/pages/index';
import Index from '@/pages/[locale]/index';

// The easiest solution to mock `next/router`: https://github.com/vercel/next.js/issues/7479
// The mock has been moved to `__mocks__` folder to avoid duplication
Expand Down
293 changes: 293 additions & 0 deletions src/pages/[locale]/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
import {
GithubOutlined,
LinkedinOutlined,
MailOutlined,
WhatsAppOutlined,
} from "@ant-design/icons";
import dynamic from "next/dynamic";
import { useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import { useEffect, useState } from "react";

import CertificateCard from "@/components/CertificateCard";
import Footer from "@/components/Footer";
import Icon from "@/components/Icon";
import { SocialLink } from "@/components/Link";
import ProjectGrid from "@/components/ProjectGrid";
import Scroll from "@/components/Scroll";
import Timeline from "@/components/Timeline";
import Block from "@/layouts/Block";
import { Meta } from "@/layouts/Meta";
import Row from "@/layouts/Row";
import profile from "@/public/assets/jsons/profile.json";
import { apiFetch } from "@/services";
import { Main } from "@/templates/Main";
import { capitalize, isProgrammingLanguage } from "@/utils";
import { getStaticPaths, makeStaticProps } from "@/utils/getStatic";
import {
GITHUB_PINNED_REPO,
GITHUB_REPO,
WAKATIME_CODING_TIME,
WAKATIME_LANGUAGES,
} from "@/utils/url";

const LanguageChart = dynamic(() => import("@/components/LanguageChart"), {
ssr: false,
});

const Index = () => {
const router = useRouter();
const [data, setData] = useState<any[]>([]);
const [pinnedRepos, setPinnedRepos] = useState<any[]>([]);

const { t } = useTranslation("common");
const {
firstName,
lastName,
username,
logoTitle,
phone,
introductionBio,
bio,
email,
experience,
education,
certification,
} = profile;
const name = `${firstName} ${lastName}`.trim();
useEffect(() => {
Promise.all([
apiFetch(GITHUB_PINNED_REPO(username)).get(),
apiFetch(WAKATIME_CODING_TIME).getJsonP(),
apiFetch(WAKATIME_LANGUAGES).getJsonP(),
])
.then((responses) => {
return responses.map((r) => r.json());
})
.then(async ([repos, codingTime, languages]: any[]) => {
const r = (await repos) as any;
const c = (await codingTime) as any;
const lang = (await languages) as any;
setPinnedRepos(
r.map((v: any) => ({
...v,
url: GITHUB_REPO(username, v.name),
name: capitalize(v.name?.replace(/-/g, " ")),
}))
);
const totalSeconds =
c.data?.grand_total?.total_seconds_including_other_language || 0;

// Fixing data percentage
const totalPercentage =
lang.data?.reduce((acc: number, curr: any) => {
let a = acc;
if (isProgrammingLanguage(curr.name)) a += curr.percent;
return a;
}, 0) || 100;

const langData = [];
for (const l of lang.data || []) {
if (!isProgrammingLanguage(l.name) || !l.percent) continue;
langData.push({
...l,
value: (l.percent / totalPercentage) * totalSeconds,
});
}
setData(langData);
})
.catch((err) => console.error(err));
/*
apiFetch(GITHUB_PROFILE(username))
.getJsonP()
.then((r) => r.json())
.then((d) => {
setGithubProfile(d.data);
})
.catch((e) => console.error(e));
*/
}, []);

return (
<>
<Main
title={logoTitle}
meta={
<Meta
title={name}
description={t(introductionBio)}
canonical={"https://lucasheartcliff.netlify.app/"}
/>
}
>
<div className="mx-2 md:mx-14">
<Row>
<Block>
<div className="flex flex-col">
<h1 className="text-4xl font-bold text-black md:text-7xl">
{t(name)}
</h1>
<h2 className="text-xl font-semibold italic text-black md:text-4xl ">
{`@${t(username)}`}
</h2>
<p className="my-5 text-pretty text-justify text-xl text-gray-600 md:text-3xl">
{t(introductionBio)}
</p>
<div className="flex flex-1 flex-row items-center justify-start text-3xl text-black hover:no-underline">
<SocialLink href={`https://github.com/${username}`}>
<Icon color={"#000000"}>
<GithubOutlined />
</Icon>
</SocialLink>
<SocialLink
href={`https://api.whatsapp.com/send?phone=${phone}`}
>
<Icon color={"#25D366"}>
<WhatsAppOutlined />
</Icon>
</SocialLink>
{/* <SocialLink href={`https://x.com/${username}`}>
<Icon color={"#00acee"}>
<TwitterOutlined />
</Icon>
</SocialLink> */}
<SocialLink href={`https://linkedin.com/in/${username}`}>
<Icon color={"#0e76a8"}>
<LinkedinOutlined />
</Icon>
</SocialLink>
{/* <SocialLink href={`https://instagram.com/${username}`}>
<Icon color={'#dd2a7b'}>
<InstagramOutlined />
</Icon>
</SocialLink> */}
<SocialLink href={`mailto:${email}`}>
<Icon color={"#d44638"}>
<MailOutlined />
</Icon>
</SocialLink>
</div>
</div>
</Block>
<Block>
<div className="hidden w-full items-center justify-center md:flex ">
<div
className=" border-0 bg-cover"
style={{
height: "30rem",
width: "32rem",
backgroundImage: `url(${router.basePath}/assets/images/cover.png)`,
}}
/>
</div>
</Block>
</Row>
<Row>
<Block>
<div className="mt-5 flex w-full items-center justify-center md:mt-0">
<div>
<div
className="h-72 w-72 rounded-full bg-cover"
style={{
backgroundImage: `url(${router.basePath}/assets/images/profile.jpeg)`,
}}
/>
</div>
</div>
</Block>
<Block>
<div className="flex flex-1 flex-col">
<span
id="about"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("About Me")}
</span>
<p className="text-pretty text-justify text-lg text-gray-600 md:text-2xl">
{t(bio)}
</p>
</div>
</Block>
</Row>

<Row>
<Block>
<div className="flex flex-1 flex-col ">
<span
id="languages"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("Languages")}
</span>
<LanguageChart data={data} />
</div>
</Block>
<Block>
<div className="flex flex-1 flex-col ">
<span
id="experience"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("Experiences")}
</span>
<Timeline data={experience} />
</div>
</Block>
</Row>
<Row>
<Block>
<div className="flex flex-1 flex-col">
<span
id="education"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("Educations")}
</span>
<Timeline data={education} />
</div>
</Block>
<Block>
<div className="flex flex-1 flex-col">
<span
id="certification"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("Certifications")}
</span>
<Scroll style={{ height: 400 }}>
{certification?.map((v, key) => (
<div key={key} className="">
<CertificateCard key={key} {...v} />
</div>
))}
</Scroll>
</div>
</Block>
</Row>
<Row>
<Block>
<div className="flex flex-1 flex-col">
<span
id="projects"
className="mb-3 text-xl font-semibold text-black md:text-4xl "
>
{t("Projects")}
</span>
<ProjectGrid
initialItemsCount={8}
itemsToAdd={8}
items={pinnedRepos}
/>
</div>
</Block>
</Row>
</div>
<Footer />
</Main>
</>
);
};

export default Index;
const getStaticProps = makeStaticProps(["common"]);
export { getStaticPaths, getStaticProps };
Loading

0 comments on commit 9929589

Please sign in to comment.