Skip to content

Commit

Permalink
feat: remove Sanity libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
martapanc committed Aug 26, 2023
1 parent 901bdb1 commit 7abbda0
Show file tree
Hide file tree
Showing 44 changed files with 108 additions and 3,663 deletions.
25 changes: 9 additions & 16 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ const nextConfig = {
reactStrictMode: true,
swcMinify: true,

// Uncoment to add domain whitelist
// images: {
// domains: [
// 'res.cloudinary.com',
// ],
// },

images: {
domains: ['cdn.sanity.io', 'res.cloudinary.com'],
remotePatterns: [
{
protocol: 'https',
hostname: 'cdn.sanity.io',
port: '',
pathname: '/about/**',
},
],
domains: ['res.cloudinary.com'],
// remotePatterns: [
// {
// protocol: 'https',
// hostname: 'cdn.sanity.io',
// port: '',
// pathname: '/about/**',
// },
// ],
},

// SVGR
Expand Down
12 changes: 0 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.13.5",
"@portabletext/react": "^3.0.4",
"@sanity/client": "^6.1.4",
"@sanity/code-input": "^4.1.1",
"@sanity/document-internationalization": "^2.0.1",
"@sanity/icons": "^2.0.0",
"@sanity/image-url": "1",
"@sanity/types": "^3.0.0",
"@sanity/ui": "^1.0.0",
"@sanity/vision": "3",
"@types/styled-components": "^5.1.0",
"classnames": "^2.3.2",
"clsx": "^1.2.1",
Expand All @@ -46,7 +38,6 @@
"inquirer-fuzzy-path": "^2.3.0",
"next": "^13.4.9",
"next-cloudinary": "^4.18.0",
"next-sanity": "5.1.0",
"next-themes": "^0.2.1",
"plop": "^3.1.2",
"react": "^18.2.0",
Expand All @@ -57,9 +48,6 @@
"react-markdown": "^8.0.7",
"react-syntax-highlighter": "^15.5.0",
"react-tippy": "^1.4.0",
"sanity": "^3.0.0",
"sanity-plugin-internationalized-array": "^1.7.0",
"sanity-plugin-media": "^2.2.1",
"strapi-flatten-graphql": "^0.1.0",
"styled-components": "^5.2.0",
"tailwind-merge": "^1.12.0",
Expand Down
10 changes: 0 additions & 10 deletions sanity.cli.ts

This file was deleted.

30 changes: 0 additions & 30 deletions sanity.config.ts

This file was deleted.

50 changes: 0 additions & 50 deletions sanity/deskStructure.js

This file was deleted.

22 changes: 0 additions & 22 deletions sanity/env.ts

This file was deleted.

10 changes: 0 additions & 10 deletions sanity/lib/client.ts

This file was deleted.

13 changes: 0 additions & 13 deletions sanity/lib/image.ts

This file was deleted.

36 changes: 0 additions & 36 deletions sanity/schema.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/app/(admin)/studio/[[...index]]/layout.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/app/(admin)/studio/[[...index]]/page.tsx

This file was deleted.

12 changes: 1 addition & 11 deletions src/app/(public)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import * as React from 'react';

import { flattenToArray } from '@/lib/graphqlUtils';

import Intro from '@/components/organisms/home/Intro';
import Summary from '@/components/organisms/home/Summary';
import Seo from '@/components/Seo';

import { codeSnippetsQueryQL } from '@/queries/codeSnippets';

import apolloClient from '../../../apollo/apollo-client';
import { queryCodeSnippets } from '@/queries/codeSnippets';

import { CodeSnippet } from '@/types/CodeSnippet';

async function queryCodeSnippets() {
const { data } = await apolloClient.query({ query: codeSnippetsQueryQL });

return flattenToArray<CodeSnippet>(data.codeSnippets);
}

const queryData = async () => {
const codeSnippets: CodeSnippet[] = await queryCodeSnippets();

Expand Down
9 changes: 3 additions & 6 deletions src/pages/api/code-snippets.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { NextApiRequest, NextApiResponse } from 'next';

import { codeSnippetsQuery } from '@/queries/codeSnippets';
import { CodeSnippet } from '@/sanityTypes/CodeSnippet';
import { queryCodeSnippets } from '@/queries/codeSnippets';

import { sanityClient } from '../../../sanity/lib/client';
import { CodeSnippet } from '@/types/CodeSnippet';

const codeSnippetsApi = async (req: NextApiRequest, res: NextApiResponse) => {
const codeSnippets: CodeSnippet[] = await sanityClient.fetch(
codeSnippetsQuery
);
const codeSnippets: CodeSnippet[] = await queryCodeSnippets();

res.status(200).json({
codeSnippets,
Expand Down
21 changes: 12 additions & 9 deletions src/queries/codeSnippets.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { gql } from '@apollo/client';
import { groq } from 'next-sanity';

export const codeSnippetsQuery = groq`
*[_type == "codeSnippet"] {
_id,
title,
"code": code.code,
"language": code.language,
}`;
import { flattenToArray } from '@/lib/graphqlUtils';

export const codeSnippetsQueryQL = gql`
import apolloClient from '../../apollo/apollo-client';

import { CodeSnippet } from '@/types/CodeSnippet';

export async function queryCodeSnippets() {
const { data } = await apolloClient.query({ query: codeSnippetsQuery });

return flattenToArray<CodeSnippet>(data.codeSnippets);
}

const codeSnippetsQuery = gql`
query {
codeSnippets {
data {
Expand Down
13 changes: 0 additions & 13 deletions src/queries/homeContent.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/sanityTypes/Book.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/sanityTypes/CodeSnippet.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/sanityTypes/HomeContent.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/sanityTypes/Icon.ts

This file was deleted.

Loading

0 comments on commit 7abbda0

Please sign in to comment.