Skip to content

Commit

Permalink
Merge pull request #12 from martapanc/remove-sanity
Browse files Browse the repository at this point in the history
Remove Sanity
  • Loading branch information
martapanc committed Aug 26, 2023
2 parents de26e81 + c4def15 commit 0166290
Show file tree
Hide file tree
Showing 69 changed files with 299 additions and 4,007 deletions.
6 changes: 1 addition & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@

NEXT_PUBLIC_SHOW_LOGGER="false"

NEXT_PUBLIC_SANITY_PROJECT_ID=abcdefgh
NEXT_PUBLIC_SANITY_DATASET=production

SANITY_STUDIO_PROJECT_ID=abcdefgh
SANITY_STUDIO_DATASET=production
GRAPHQL_URL=https://some-url.com/graphql
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
16 changes: 1 addition & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,14 @@
"postbuild": "next-sitemap --config next-sitemap.config.js",
"prepare": "husky install",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"sanity:dev": "npx sanity dev",
"sanity:prod": "sanity build && sanity start"
"build-storybook": "storybook build"
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@emotion/react": "^11.11.1",
"@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 +36,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 +46,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.

61 changes: 11 additions & 50 deletions src/app/(public)/about/free-time/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { DocumentNode } from 'graphql/language';
import * as React from 'react';

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

import { QuizData, QuizOption } from '@/components/molecules/RandomFacts/Quiz';
Expand All @@ -12,59 +10,24 @@ import RandomFacts from '@/components/organisms/about-free-time/RandomFacts';
import TvSeries from '@/components/organisms/about-free-time/TvSeries';
import VideoGames from '@/components/organisms/about-free-time/VideoGames';

import { booksQueryQL } from '@/queries/books';
import { podcastsQueryQL } from '@/queries/podcasts';
import { queryBooks } from '@/queries/books';
import { queryPodcasts } from '@/queries/podcasts';
import {
falseRandomFactsQueryQL,
selectedTrueRandomFactsQueryQL,
trueRandomFactsQueryQL,
falseRandomFactsQuery,
queryRandomFacts,
selectedTrueRandomFactsQuery,
trueRandomFactsQuery,
} from '@/queries/random-facts';
import { tvShowsQueryQL } from '@/queries/tv-shows';
import { videoGamesQueryQL } from '@/queries/video-games';
import { queryTvShows } from '@/queries/tv-shows';
import { queryVideoGames } from '@/queries/video-games';

import apolloClient from '../../../../../apollo/apollo-client';

import { Book } from '@/types/Book';
import { Podcast } from '@/types/Podcast';
import { RandomFact } from '@/types/RandomFact';
import { TvShow } from '@/types/TvShow';
import { VideoGame } from '@/types/VideoGame';

export const metadata = {
title: 'About my Free Time | MartaCodes.it',
description: 'About page',
};

async function queryBooks() {
const { data } = await apolloClient.query({ query: booksQueryQL });

return flattenToArray<Book>(data.books);
}

async function queryPodcasts() {
const { data } = await apolloClient.query({ query: podcastsQueryQL });

return flattenToArray<Podcast>(data.podcasts);
}

async function queryTvShows() {
const { data } = await apolloClient.query({ query: tvShowsQueryQL });

return flattenToArray<TvShow>(data.tvShows);
}

async function queryVideoGames() {
const { data } = await apolloClient.query({ query: videoGamesQueryQL });

return flattenToArray<VideoGame>(data.videoGames);
}

async function queryRandomFacts(query: DocumentNode) {
const { data } = await apolloClient.query({ query });

return flattenToArray<RandomFact>(data.randomFacts);
}

const getData = async () => {
const randomFacts: QuizData = await loadRandomFactsForQuiz();

Expand All @@ -89,16 +52,14 @@ const queryData = async () => {

const loadRandomFactsForQuiz = async () => {
const falseFacts: RandomFact[] = await queryRandomFacts(
falseRandomFactsQueryQL
falseRandomFactsQuery
);

const selectedTrueFacts: RandomFact[] = await queryRandomFacts(
selectedTrueRandomFactsQueryQL
selectedTrueRandomFactsQuery
);

const trueFacts: RandomFact[] = await queryRandomFacts(
trueRandomFactsQueryQL
);
const trueFacts: RandomFact[] = await queryRandomFacts(trueRandomFactsQuery);

const oneFalseFact: RandomFact = shuffleArray(falseFacts)[0];
const threeTrueFacts: RandomFact[] = shuffleArray(selectedTrueFacts).slice(
Expand Down
Loading

1 comment on commit 0166290

@vercel
Copy link

@vercel vercel bot commented on 0166290 Aug 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.