Skip to content

Commit

Permalink
Frontpage auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cdedreuille committed Jul 17, 2024
1 parent cb164cc commit c9f8339
Show file tree
Hide file tree
Showing 47 changed files with 98 additions and 114 deletions.
8 changes: 4 additions & 4 deletions apps/frontpage/app/addons/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MetadataRoute } from 'next';
import { fetchAddonsQuery, gql } from '../../lib/fetch-addons-query';
import { type MetadataRoute } from 'next';
import { validateResponse } from '@repo/utils';
import { fetchAddonsQuery, gql } from '../../lib/fetch-addons-query';

type AddonValue = string;

Expand All @@ -16,7 +16,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
async function fetchAddonsData() {
try {
let value: AddonValue[] = [];
async function fetchPartialData(skip: number = 0) {
async function fetchPartialData(skip = 0) {
const data = await fetchAddonsQuery<AddonsData, { skip: number }>(
gql`
query Addons($skip: Int!) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
} = {}) {
try {
let value: TagValue[] = [];
async function fetchPartialData(skip: number = 0) {
async function fetchPartialData(skip = 0) {
const data = await fetchAddonsQuery<
TagsData,
{ isCategory: boolean; skip: number }
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/blog/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { fetchExternalSitemap } from '../../lib/fetch-external-sitemap';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
Expand Down
4 changes: 2 additions & 2 deletions apps/frontpage/app/community/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function Page() {
return (
<CommunityProvider>
<Header
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
githubCount={githubCount}
/>
<NavTop />
Expand All @@ -54,7 +54,7 @@ export default async function Page() {
<Community />
<Numbers
githubCount={githubCountFormatted}
contributorsCount={'2282'}
contributorsCount="2282"
discordMembersCount={discordMembers}
npmDownloadsCount={npmDownloads}
youtubeSubscribersCount={youtubeSubscribers}
Expand Down
6 changes: 3 additions & 3 deletions apps/frontpage/app/docs-all/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MetadataRoute } from 'next';
import { FlatTreeNode, getFlatTree } from '../../lib/get-flat-tree';
import { getAllTrees } from '../../lib/get-all-trees';
import { type MetadataRoute } from 'next';
import { docsVersions, latestVersion } from '@repo/utils';
import { type FlatTreeNode, getFlatTree } from '../../lib/get-flat-tree';
import { getAllTrees } from '../../lib/get-all-trees';

export default function sitemap(): MetadataRoute.Sitemap {
// Generate docs tree for each version
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/docs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { notFound, redirect } from 'next/navigation';
import { globalSearchMetaKeys, globalSearchImportance } from '@repo/ui';
import { latestVersion } from '@repo/utils';
import { type Metadata } from 'next';
import { getVersion } from '../../../lib/get-version';
import { getPageData } from '../../../lib/get-page';
import { Metadata } from 'next';
import { getAllTrees } from '../../../lib/get-all-trees';
import { getFlatTree } from '../../../lib/get-flat-tree';
import { Content } from '../../../components/docs/content';
Expand Down
8 changes: 4 additions & 4 deletions apps/frontpage/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Header, Footer, Container } from '@repo/ui';
import Image from 'next/image';
import { fetchGithubCount } from '@repo/utils';
import { type ReactNode, Suspense } from 'react';
import { type Metadata } from 'next';
import { Sidebar } from '../../components/docs/sidebar/sidebar';
import { NavDocs } from '../../components/docs/sidebar/docs-nav';
import { DocsProvider } from './provider';
import { Submenu } from '../../components/docs/submenu';
import { DocsMainNav } from '../../components/docs/sidebar/docs-main-nav';
import { ReactNode, Suspense } from 'react';
import { TOCSectionTitles } from '../../components/docs/toc-section-titles';
import { getAllTrees } from '../../lib/get-all-trees';
import { Metadata } from 'next';
import { DocsProvider } from './provider';
import { RendererCookie } from './renderer-cookie';

export async function generateMetadata(): Promise<Metadata> {
Expand All @@ -32,7 +32,7 @@ export default async function Layout({ children }: { children: ReactNode }) {
<RendererCookie />
</Suspense>
<Header
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
githubCount={githubCount}
subMenu={<Submenu listOfTrees={listofTrees} />}
/>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/docs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { notFound } from 'next/navigation';
import { globalSearchMetaKeys, globalSearchImportance } from '@repo/ui';
import { latestVersion } from '@repo/utils';
import { type Metadata } from 'next';
import { getPageData } from '../../lib/get-page';
import { Metadata } from 'next';
import { Content } from '../../components/docs/content';

export async function generateMetadata(): Promise<Metadata> {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/docs/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { languages, packageManagers, renderers } from '@repo/utils';
import { getCookie, setCookie } from 'cookies-next';
import type { ReactNode } from 'react';
import { createContext, useContext, useEffect, useState } from 'react';
import { useSearchParams } from 'next/navigation';
import {
cookieLanguageId,
cookiePackageManagerId,
cookieRenderId,
} from '../../constants';
import { useSearchParams } from 'next/navigation';

export interface DocsContextProps {
activeRenderer: null | string;
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/docs/renderer-cookie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { useSearchParams } from 'next/navigation';
import { useEffect } from 'react';
import { useDocs } from './provider';
import { renderers } from '@repo/utils';
import { useDocs } from './provider';

export const RendererCookie = () => {
const { setRenderer } = useDocs();
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/docs/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { docsVersions } from '@repo/utils';
import { getFlatTree } from '../../lib/get-flat-tree';
import { getAllTrees } from '../../lib/get-all-trees';
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
globalSearchImportance,
} from '@repo/ui';
import { cn } from '@repo/utils';
import { Providers } from './providers';
import { SpeedInsights } from '@vercel/speed-insights/next';
import { GoogleAnalytics } from '@next/third-parties/google';
import { Analytics } from '@vercel/analytics/react';
import { Providers } from './providers';

import '@docsearch/css';
import './globals.css';
Expand Down
4 changes: 2 additions & 2 deletions apps/frontpage/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function NotFound() {
return (
<div>
<Header
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
githubCount={githubCount}
/>
<div className="m-auto mb-24 flex max-w-[960px] flex-col items-center px-8 pt-24">
Expand All @@ -36,7 +36,7 @@ export default async function NotFound() {
</p>
</div>
<Search
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function Page() {

return (
<Home
contributorCount={'2282'}
contributorCount="2282"
discordMembers={discordMembers}
githubCount={githubCount}
npmDownloads={npmDownloads}
Expand Down
22 changes: 10 additions & 12 deletions apps/frontpage/app/recipes/[...name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
Pill,
SubHeader,
} from '@repo/ui';
import { fetchRecipeDetailsData } from '../../../lib/fetch-recipe-details-data';
import { fetchRecipesData } from '../../../lib/fetch-recipes-data';
import { fetchGithubCount } from '@repo/utils';
import Image from 'next/image';
import { EmbeddedExample } from '../../../components/recipes/embedded-example';
import { MDXRemote } from 'next-mdx-remote/rsc';
import { fetchRecipeDetailsData } from '../../../lib/fetch-recipe-details-data';
import { fetchRecipesData } from '../../../lib/fetch-recipes-data';
import { EmbeddedExample } from '../../../components/recipes/embedded-example';

interface RecipeDetailsProps {
params: {
Expand Down Expand Up @@ -45,7 +45,7 @@ export default async function RecipeDetails({ params }: RecipeDetailsProps) {
return (
<>
<Header
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
githubCount={githubCount}
/>
<Container className="mb-16">
Expand All @@ -61,11 +61,11 @@ export default async function RecipeDetails({ params }: RecipeDetailsProps) {
fill="none"
>
<path
clip-rule="evenodd"
clipRule="evenodd"
d="M7 2.111a2.413 2.413 0 0 0-2.26 2.5l1.486 39.62a2.413 2.413 0 0 0 2.304 2.32l32.213 1.447.108.002a2.413 2.413 0 0 0 2.413-2.413V2.413A2.413 2.413 0 0 0 40.7.004l-2.649.167.194 5.539a.36.36 0 0 1-.583.295l-1.784-1.406-2.114 1.603a.36.36 0 0 1-.577-.302l.226-5.44L7.001 2.111Zm27.441 16.276c-.849.66-7.173 1.11-7.173.17.134-3.582-1.47-3.739-2.361-3.739-.847 0-2.273.256-2.273 2.175 0 1.956 2.084 3.06 4.53 4.356 3.474 1.841 7.678 4.07 7.678 9.677 0 5.374-4.366 8.342-9.935 8.342-5.748 0-10.77-2.325-10.204-10.387.223-.947 7.53-.722 7.53 0-.089 3.327.669 4.305 2.584 4.305 1.47 0 2.14-.81 2.14-2.175 0-2.066-2.172-3.284-4.67-4.687-3.38-1.898-7.36-4.133-7.36-9.26 0-5.118 3.52-8.53 9.801-8.53 6.283 0 9.713 3.36 9.713 9.753Z"
fill-rule="evenodd"
fillRule="evenodd"
fill="#fff"
></path>
/>
</svg>
</div>
<div
Expand Down Expand Up @@ -106,15 +106,13 @@ export default async function RecipeDetails({ params }: RecipeDetailsProps) {
<ul className="mb-6 flex flex-col gap-4">
{metadata?.authors?.map((author) => (
<li className="flex items-center gap-2" key={author.username}>
{author.gravatarUrl && (
<div className="relative h-7 w-7 overflow-hidden rounded-full">
{author.gravatarUrl ? <div className="relative h-7 w-7 overflow-hidden rounded-full">
<Image
src={`https:${author.gravatarUrl}`}
alt={author.username}
fill={true}
fill
/>
</div>
)}
</div> : null}
{author.username}
</li>
))}
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/recipes/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { fetchRecipesData } from '../../lib/fetch-recipes-data';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/releases/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function Page({ params: { slug } }: PageProps) {
return (
<>
<Header
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
githubCount={githubCount}
/>
<Container asChild className="flex gap-4 lg:pl-5 lg:pr-8">
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/releases/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { getReleases } from '../../lib/get-releases';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/showcase/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { fetchExternalSitemap } from '../../lib/fetch-external-sitemap';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/app/tutorials/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetadataRoute } from 'next';
import { type MetadataRoute } from 'next';
import { fetchExternalSitemap } from '../../lib/fetch-external-sitemap';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/components/community/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type { FC } from 'react';
import { useMemo } from 'react';
import { zonedTimeToUtc, format } from 'date-fns-tz';
import { isPast } from 'date-fns';
import { Section } from './section';
import { Youtube } from '../logos/youtube';
import { Section } from './section';

const rezoneDate = (date: Date) => zonedTimeToUtc(date, 'America/Los_Angeles');

Expand Down
2 changes: 1 addition & 1 deletion apps/frontpage/components/community/support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Support: FC = () => {
</p>
</div>
<Search
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY as string}
algoliaApiKey={process.env.NEXT_PUBLIC_ALGOLIA_API_KEY!}
/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontpage/components/docs/content.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cn } from '@repo/utils';
import { PageDataProps } from '../../lib/get-page';
import { type FC } from 'react';
import { type PageDataProps } from '../../lib/get-page';
import { Renderers } from './renderers';
import { DocsFooter } from './footer/footer';
import { TableOfContent } from './table-of-content';
import { FC } from 'react';

export const Content: FC<{ page: PageDataProps }> = ({ page }) => {
return (
Expand Down
3 changes: 1 addition & 2 deletions apps/frontpage/components/docs/footer/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import dedent from 'dedent';
import { headers } from 'next/headers';
import fetch from 'node-fetch';
import { z } from 'zod';

import type { TreeProps } from '@repo/utils';
import { docsVersions } from '@repo/utils';
import { getAllTrees } from '../../../lib/get-all-trees';
Expand Down Expand Up @@ -184,7 +183,7 @@ async function getDiscussion(title: string) {
pageInfo: { hasNextPage, endCursor },
},
},
// eslint-disable-next-line no-await-in-loop -- This is node; we can deal with it
} = await queryGitHub<{
repository: {
discussions: {
Expand Down
9 changes: 4 additions & 5 deletions apps/frontpage/components/docs/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { useEffect, useState } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import { usePathname } from 'next/navigation';

import { cn } from '@repo/utils';
import { Form } from './form';

Expand Down Expand Up @@ -55,7 +54,7 @@ export const DocsFooter = ({ isIndexPage }: FooterProps) => {
'h-8 w-8 rounded-full hover:bg-blue-100',
reaction === 'up' && 'bg-blue-100',
)}
onClick={() => selectReaction('up')}
onClick={() => { selectReaction('up'); }}
>
👍
</button>
Expand All @@ -64,20 +63,20 @@ export const DocsFooter = ({ isIndexPage }: FooterProps) => {
'h-8 w-8 rounded-full hover:bg-blue-100',
reaction === 'down' && 'bg-blue-100',
)}
onClick={() => selectReaction('down')}
onClick={() => { selectReaction('down'); }}
>
👎
</button>
</div>
</div>
<AnimatePresence>
{reaction && <Form reaction={reaction} setReaction={setReaction} />}
{reaction ? <Form reaction={reaction} setReaction={setReaction} /> : null}
</AnimatePresence>
</motion.div>
<a
href={`${githubDocsBaseUrl}${pathname}${isIndexPage ? '/index' : ''}.mdx`}
target="_blank"
className="textsm flex h-12 items-center rounded-full border border-zinc-200 px-5 text-sm transition-all hover:-translate-y-1 hover:border-zinc-400"
className="textsm flex h-12 items-center rounded-full border border-zinc-200 px-5 text-sm transition-all hover:-translate-y-1 hover:border-zinc-400" rel="noopener"
>
✍️ Edit on Github
</a>
Expand Down
Loading

0 comments on commit c9f8339

Please sign in to comment.