Skip to content

Commit

Permalink
Merge pull request #488 from hifrontendcafe/use-sanity-next-client
Browse files Browse the repository at this point in the history
Remove next-sanity-client, remove `equipo` and `talentos` pages
  • Loading branch information
Santiago-j-s authored Aug 21, 2024
2 parents 3ebd6be + 8d3fee1 commit 95eb03e
Show file tree
Hide file tree
Showing 73 changed files with 427 additions and 2,490 deletions.
1 change: 0 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ module.exports = {
},
experimental: {},
swcMinify: true,
transpilePackages: ['next-sanity-client'],
};
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"fs": false
},
"dependencies": {
"@emailjs/browser": "^3.12.1",
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-brands-svg-icons": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
Expand All @@ -33,7 +32,6 @@
"next": "14.2.5",
"next-auth": "^4.24.7",
"prettier-plugin-tailwindcss": "^0.3.0",
"query-string": "^8.2.0",
"react": "^18.3.1",
"react-cookie-consent": "^6.4.1",
"react-dom": "^18.3.1",
Expand Down Expand Up @@ -79,7 +77,6 @@
"eslint-plugin-prettier": "^3.4.1",
"knip": "^5.27.0",
"next-sanity": "^9.4.4",
"next-sanity-client": "1.0.8",
"postcss": "^8.4.41",
"postcss-preset-env": "^7.8.3",
"prettier": "^2.8.8",
Expand Down
52 changes: 0 additions & 52 deletions pnpm-lock.yaml

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

16 changes: 11 additions & 5 deletions src/app/(website)/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import { notFound } from 'next/navigation';

import type { AppPage } from '@/lib/types';
import { getPageByPath } from '@/lib/api.server';
import { PageComponents } from '@/components/Page/Matcher';
import { getPageByPath } from '@/lib/sanity/page/getPageByPath';
import type { AppPage } from '@/lib/types';

export const generateStaticParams = () => {
return [];
};

// FIXME: https://github.com/vercel/next.js/issues/49489
const dynamicParams = true;
export { dynamicParams };
export const dynamicParams = true;

const CustomPage: AppPage<{ slug: string[] }> = async ({ params }) => {
const [base, ...rest] = params.slug;

const path = [`/${base}`].concat(rest).join('/');

const page = await getPageByPath({ path, next: { revalidate: 120 } });
const page = await getPageByPath(
{ path },
{
next: {
revalidate: 120,
},
},
);

if (!page) return notFound();

Expand Down
115 changes: 0 additions & 115 deletions src/app/(website)/api/profiles/search/route.ts

This file was deleted.

12 changes: 5 additions & 7 deletions src/app/(website)/cmyk/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import SectionHero from '@/components/SectionHero';
import { getPageByName } from '@/lib/api.server';
import { getPageByName } from '@/lib/sanity/page/getPageByName';

export default async function CMYKLayout({
children,
}: {
children: React.ReactNode;
}) {
const page = await getPageByName({
name: 'CMYK',
next: {
revalidate: 60,
},
});
const page = await getPageByName(
{ name: 'CMYK' },
{ next: { revalidate: 60 } },
);

return (
<main>
Expand Down
10 changes: 7 additions & 3 deletions src/app/(website)/cmyk/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CMYKEdition from '@/components/CMYKEditions';
import CMYKEditionsSkeleton from '@/components/CMYKEditions/CMYKEditionsSkeleton';
import { cmykVersions } from '@/components/CMYKEditions/cmykVersions';
import { getAllCMYKVersionsOrderedFromLatest } from '@/lib/api.server';
import { getAllCMYKProjects } from '@/lib/sanity/cmyk/getAllCMYKProjects';
import { getPageMetadata } from '@/lib/seo';
import type { AppPage } from '@/lib/types';
import { notFound } from 'next/navigation';
Expand All @@ -12,10 +12,14 @@ export const generateMetadata = () => {
};

const CMYKPage: AppPage = async () => {
const versions = await getAllCMYKVersionsOrderedFromLatest({
next: { revalidate: 3600 },
const projects = await getAllCMYKProjects({
next: {
revalidate: 3600,
},
});

const versions = projects.map((project) => project.cmykVersion);

const current = cmykVersions.find(
(cmykVersion) => cmykVersion.version === versions[0],
);
Expand Down
Loading

0 comments on commit 95eb03e

Please sign in to comment.