From 5970ad6594e8824483437c95506081cebb6f99c6 Mon Sep 17 00:00:00 2001 From: Keming He Date: Sun, 15 Dec 2024 17:56:34 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20(Header)=20Moved=20GitHub=20corn?= =?UTF-8?q?er=20styling=20to=20global.css,=20removed=20styled-jsx=20dep.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/__snapshots__/constants.test.ts.snap | 1 + common/constants.test.ts | 2 +- common/constants.ts | 3 +- common/github/repoQuery.ts | 3 +- next.config.js | 4 --- package.json | 1 - pnpm-lock.yaml | 23 ------------- src/components/error/error.test.tsx | 2 +- src/components/footer/footer.test.tsx | 2 +- .../header/__snapshots__/header.test.tsx.snap | 18 ++++------ src/components/header/header.test.tsx | 2 +- src/components/header/header.tsx | 33 ------------------ src/components/preview/badge.test.tsx | 2 +- .../preview/cardThemeWrapper.test.tsx | 2 +- src/components/repo/repo.test.tsx | 2 +- styles/global.css | 34 ++++++++++++++++++- 16 files changed, 52 insertions(+), 82 deletions(-) diff --git a/common/__snapshots__/constants.test.ts.snap b/common/__snapshots__/constants.test.ts.snap index 333100ac..b175ad53 100644 --- a/common/__snapshots__/constants.test.ts.snap +++ b/common/__snapshots__/constants.test.ts.snap @@ -3,5 +3,6 @@ exports[`constants matches snapshot 1`] = ` { "GITHUB_GRAPHQL_ENDPOINT": "https://api.github.com/graphql", + "SOCIALIFY_GRAPHQL_ENDPOINT": "/api/graphql", } `; diff --git a/common/constants.test.ts b/common/constants.test.ts index f7b52182..8b4b58fb 100644 --- a/common/constants.test.ts +++ b/common/constants.test.ts @@ -1,4 +1,4 @@ -import * as constants from './constants' +import * as constants from '@/common/constants' describe('constants', () => { test('matches snapshot', () => { diff --git a/common/constants.ts b/common/constants.ts index 435f2640..7deca6d2 100644 --- a/common/constants.ts +++ b/common/constants.ts @@ -1,4 +1,5 @@ // GitHub constants. -export const GITHUB_GRAPHQL_ENDPOINT = 'https://api.github.com/graphql' +export const GITHUB_GRAPHQL_ENDPOINT: string = 'https://api.github.com/graphql' // Socialify constants. +export const SOCIALIFY_GRAPHQL_ENDPOINT: string = '/api/graphql' diff --git a/common/github/repoQuery.ts b/common/github/repoQuery.ts index 98d59387..50e4beb8 100644 --- a/common/github/repoQuery.ts +++ b/common/github/repoQuery.ts @@ -1,3 +1,4 @@ +import { SOCIALIFY_GRAPHQL_ENDPOINT } from '@/common/constants' import { HOST_PREFIX } from '@/common/helpers' export const getRepoDetails = async (owner: string, name: string) => { @@ -40,7 +41,7 @@ export const getRepoDetails = async (owner: string, name: string) => { }, } - const res = await fetch(`${HOST_PREFIX}/graphql`, { + const res = await fetch(`${HOST_PREFIX}${SOCIALIFY_GRAPHQL_ENDPOINT}`, { method: 'POST', headers: { 'content-type': 'application/json', diff --git a/next.config.js b/next.config.js index ab1369e4..25b3fb94 100644 --- a/next.config.js +++ b/next.config.js @@ -23,10 +23,6 @@ const nextConfig = { source: '/:_owner/:_name/jpg', destination: '/api/png', }, - { - source: '/graphql', - destination: '/api/graphql', - }, ] }, async headers() { diff --git a/package.json b/package.json index 4c5b106a..c1eecd6f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "react-icons": "^5.4.0", "satori": "^0.10.14", "simple-icons": "^13.20.0", - "styled-jsx": "^5.1.6", "use-debounce": "^10.0.4", "yoga-wasm-web": "^0.3.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24f5df02..445b0743 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,9 +50,6 @@ importers: simple-icons: specifier: ^13.20.0 version: 13.20.0 - styled-jsx: - specifier: ^5.1.6 - version: 5.1.6(@babel/core@7.26.0)(react@18.3.1) use-debounce: specifier: ^10.0.4 version: 10.0.4(react@18.3.1) @@ -2198,19 +2195,6 @@ packages: babel-plugin-macros: optional: true - styled-jsx@5.1.6: - resolution: {integrity: sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==} - engines: {node: '>= 12.0.0'} - peerDependencies: - '@babel/core': '*' - babel-plugin-macros: '*' - react: '>= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0' - peerDependenciesMeta: - '@babel/core': - optional: true - babel-plugin-macros: - optional: true - sucrase@3.35.0: resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==} engines: {node: '>=16 || 14 >=14.17'} @@ -4836,13 +4820,6 @@ snapshots: optionalDependencies: '@babel/core': 7.26.0 - styled-jsx@5.1.6(@babel/core@7.26.0)(react@18.3.1): - dependencies: - client-only: 0.0.1 - react: 18.3.1 - optionalDependencies: - '@babel/core': 7.26.0 - sucrase@3.35.0: dependencies: '@jridgewell/gen-mapping': 0.3.8 diff --git a/src/components/error/error.test.tsx b/src/components/error/error.test.tsx index 18b05304..6978543e 100644 --- a/src/components/error/error.test.tsx +++ b/src/components/error/error.test.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react' -import ErrorContent from './error' +import ErrorContent from '@/src/components/error/error' test('Error renders', () => { const { container } = render( diff --git a/src/components/footer/footer.test.tsx b/src/components/footer/footer.test.tsx index 0835519c..073bd3ce 100644 --- a/src/components/footer/footer.test.tsx +++ b/src/components/footer/footer.test.tsx @@ -1,5 +1,5 @@ +import Footer from '@/src/components/footer/footer' import { render } from '@testing-library/react' -import Footer from './footer' jest.mock('@/common/helpers', () => ({ version: '0.0.0', diff --git a/src/components/header/__snapshots__/header.test.tsx.snap b/src/components/header/__snapshots__/header.test.tsx.snap index 664a8535..82a511d0 100644 --- a/src/components/header/__snapshots__/header.test.tsx.snap +++ b/src/components/header/__snapshots__/header.test.tsx.snap @@ -1,14 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Header renders 1`] = ` -
+