diff --git a/pages/kusa/[username].tsx b/pages/kusa/[username].tsx index 22123f0b..366d33a2 100644 --- a/pages/kusa/[username].tsx +++ b/pages/kusa/[username].tsx @@ -1,14 +1,14 @@ -import Head from 'next/head'; import { GetServerSidePropsContext, GetServerSidePropsResult } from 'next'; import { FetchProvider, useFetch } from 'react-hooks-fetch'; import { Suspense } from 'react'; +import Head from '../../src/components/kusa/head'; +import Title from '../../src/components/kusa/title'; import Contributions from '../../src/components/kusa/contributions/contributions'; +import { toGrassGraphImageUrl } from '../../src/lib/to-grass-graph-image-url'; type Props = { username: string; - todayContributionCount: number; - yesterdayContributionCount: number; - currentStreak: number; + description: string; }; export const getServerSideProps = async ( @@ -30,8 +30,9 @@ export const getServerSideProps = async ( const [todayContributionCount, yesterdayContributionCount] = contributions; const currentStreak = todayContributionCount > 0 ? contributions.indexOf(0) : contributions.slice(1).indexOf(0); + const description = `Today: ${todayContributionCount}, Yesterday: ${yesterdayContributionCount}, Streak: ${currentStreak}`; - return { props: { username, todayContributionCount, yesterdayContributionCount, currentStreak } }; + return { props: { username, description } }; }; const fetchFunc = async (username: string) => { @@ -49,37 +50,15 @@ const Detail = ({ username }: { username: string }) => { const Kusa = (props: Props) => { const username = props.username; - const imgUrl = `https://grass-graph.appspot.com/images/${username}.png?${Date.now()}`; - const siteUrl = `https://tools.swfz.io/kusa/${username}`; - const title = `GitHub Contributions(kusa) in ${username}`; - const desc = `Today: ${props.todayContributionCount}, Yesterday: ${props.yesterdayContributionCount}, Streak: ${props.currentStreak}`; - const toGitHub = `https://github.com/${username}`; return ( <> -
-