mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-14 16:40:50 -05:00
refactor constants
This commit is contained in:
@@ -7,7 +7,7 @@ import Footer from "../components/Footer";
|
||||
import { SkipNavLink, SkipNavTarget } from "../components/SkipNav";
|
||||
import { defaultMetadata } from "../lib/helpers/metadata";
|
||||
import * as config from "../lib/config";
|
||||
import { BASE_URL, MAX_WIDTH } from "../lib/config/constants";
|
||||
import { BASE_URL, MAX_WIDTH, SITE_LOCALE } from "../lib/config/constants";
|
||||
import type { Metadata } from "next";
|
||||
import type { Person, WebSite } from "schema-dts";
|
||||
|
||||
@@ -21,7 +21,7 @@ export const metadata: Metadata = defaultMetadata;
|
||||
|
||||
const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => {
|
||||
return (
|
||||
<html lang={config.siteLocale} suppressHydrationWarning>
|
||||
<html lang={SITE_LOCALE || "en-US"} suppressHydrationWarning>
|
||||
<head>
|
||||
<ThemeScript />
|
||||
|
||||
@@ -55,8 +55,8 @@ const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => {
|
||||
name: config.siteName,
|
||||
url: BASE_URL,
|
||||
author: config.authorName,
|
||||
description: config.longDescription,
|
||||
inLanguage: config.siteLocale,
|
||||
description: config.description,
|
||||
inLanguage: SITE_LOCALE,
|
||||
license: config.licenseUrl,
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as config from "../lib/config";
|
||||
import { SITE_LOCALE } from "../lib/config/constants";
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
const manifest = (): MetadataRoute.Manifest => {
|
||||
@@ -6,8 +7,8 @@ const manifest = (): MetadataRoute.Manifest => {
|
||||
name: config.siteName,
|
||||
// eslint-disable-next-line camelcase
|
||||
short_name: config.siteName,
|
||||
description: config.longDescription,
|
||||
lang: config.siteLocale,
|
||||
description: config.description,
|
||||
lang: SITE_LOCALE,
|
||||
icons: [
|
||||
{
|
||||
src: "/icon.png",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { connection } from "next/server";
|
||||
import CountUp from "../../../components/CountUp";
|
||||
import redis from "../../../lib/redis";
|
||||
import { siteLocale } from "../../../lib/config";
|
||||
import { SITE_LOCALE } from "../../../lib/config/constants";
|
||||
|
||||
const HitCounter = async ({ slug }: { slug: string }) => {
|
||||
await connection();
|
||||
@@ -16,7 +16,7 @@ const HitCounter = async ({ slug }: { slug: string }) => {
|
||||
|
||||
// we have data!
|
||||
return (
|
||||
<span title={`${Intl.NumberFormat(siteLocale || "en-US").format(hits)} ${hits === 1 ? "view" : "views"}`}>
|
||||
<span title={`${Intl.NumberFormat(SITE_LOCALE || "en-US").format(hits)} ${hits === 1 ? "view" : "views"}`}>
|
||||
<CountUp start={0} end={hits} delay={0} duration={1.5} />
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ import HitCounter from "./counter";
|
||||
import { getSlugs, getFrontMatter } from "../../../lib/helpers/posts";
|
||||
import { addMetadata } from "../../../lib/helpers/metadata";
|
||||
import * as config from "../../../lib/config";
|
||||
import { BASE_URL, POSTS_DIR } from "../../../lib/config/constants";
|
||||
import { BASE_URL, POSTS_DIR, SITE_LOCALE } from "../../../lib/config/constants";
|
||||
import { size as ogImageSize } from "./opengraph-image";
|
||||
import type { Metadata } from "next";
|
||||
import type { BlogPosting } from "schema-dts";
|
||||
@@ -79,7 +79,7 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
|
||||
keywords: frontmatter!.tags?.join(", "),
|
||||
datePublished: frontmatter!.date,
|
||||
dateModified: frontmatter!.date,
|
||||
inLanguage: config.siteLocale,
|
||||
inLanguage: SITE_LOCALE,
|
||||
license: config.licenseUrl,
|
||||
author: {
|
||||
// defined in app/layout.tsx
|
||||
|
||||
@@ -7,6 +7,7 @@ import Link from "../../components/Link";
|
||||
import RelativeTime from "../../components/RelativeTime";
|
||||
import { addMetadata } from "../../lib/helpers/metadata";
|
||||
import * as config from "../../lib/config";
|
||||
import { SITE_LOCALE } from "../../lib/config/constants";
|
||||
import type { User } from "@octokit/graphql-schema";
|
||||
|
||||
import styles from "./page.module.css";
|
||||
@@ -120,12 +121,12 @@ const Page = async () => {
|
||||
<div className={styles.metaItem}>
|
||||
<Link
|
||||
href={`${repo!.url}/stargazers`}
|
||||
title={`${Intl.NumberFormat(config.siteLocale || "en-US").format(repo!.stargazerCount)} ${repo!.stargazerCount === 1 ? "star" : "stars"}`}
|
||||
title={`${Intl.NumberFormat(SITE_LOCALE || "en-US").format(repo!.stargazerCount)} ${repo!.stargazerCount === 1 ? "star" : "stars"}`}
|
||||
plain
|
||||
className={styles.metaLink}
|
||||
>
|
||||
<StarIcon size="1.25em" className={styles.metaIcon} />
|
||||
<span>{Intl.NumberFormat(config.siteLocale || "en-US").format(repo!.stargazerCount)}</span>
|
||||
<span>{Intl.NumberFormat(SITE_LOCALE || "en-US").format(repo!.stargazerCount)}</span>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
@@ -134,12 +135,12 @@ const Page = async () => {
|
||||
<div className={styles.metaItem}>
|
||||
<Link
|
||||
href={`${repo!.url}/network/members`}
|
||||
title={`${Intl.NumberFormat(config.siteLocale || "en-US").format(repo!.forkCount)} ${repo!.forkCount === 1 ? "fork" : "forks"}`}
|
||||
title={`${Intl.NumberFormat(SITE_LOCALE || "en-US").format(repo!.forkCount)} ${repo!.forkCount === 1 ? "fork" : "forks"}`}
|
||||
plain
|
||||
className={styles.metaLink}
|
||||
>
|
||||
<GitForkIcon size="1.25em" className={styles.metaIcon} />
|
||||
<span>{Intl.NumberFormat(config.siteLocale || "en-US").format(repo!.forkCount)}</span>
|
||||
<span>{Intl.NumberFormat(SITE_LOCALE || "en-US").format(repo!.forkCount)}</span>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user