-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(web): migrate to app router (#89)
* feat(web): migrate to nextjs app router * fix: lint * fix: frontendbuild * fix: frontend test * fix: frontend test * fix: frontend test * fix: frontend test * fix: frontend test
- Loading branch information
1 parent
36bbff0
commit 7349e92
Showing
111 changed files
with
2,392 additions
and
1,231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@snipcode/front': minor | ||
'@snipcode/web': minor | ||
'@snipcode/backend': patch | ||
--- | ||
|
||
migrate to next.js app router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
NEXT_PUBLIC_APP_ENV=development | ||
NEXT_PUBLIC_GITHUB_CLIENT_ID=github-client-id | ||
NEXT_PUBLIC_SERVER_URL=http://localhost:7501/graphql | ||
NEXT_PUBLIC_APP_URL=http://localhost:7500 | ||
NEXT_PUBLIC_SENTRY_DSN=https://[email protected]/1234567 | ||
NEXT_PUBLIC_SENTRY_ENABLED=false | ||
SENTRY_AUTH_TOKEN= | ||
SENTRY_RELEASE= | ||
SHAREABLE_HOST=http://localhost:7500 | ||
EMBEDDABLE_HOST=http://localhost:7502 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,6 @@ module.exports = withSentryConfig(nextConfigOptions, { | |
project: 'frontend', | ||
// release: "[email protected]", | ||
authToken: process.env.SENTRY_AUTH_TOKEN, // An auth token is required for uploading source maps. | ||
silent: false, | ||
silent: true, | ||
telemetry: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apps/web/src/app/(protected)/app/browse/lib/fetch-snippets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { findPublicSnippetsQuery } from '@snipcode/front/graphql'; | ||
import { PublicSnippetsQuery } from '@snipcode/front/graphql/generated'; | ||
import { formatPublicSnippetsResult } from '@snipcode/front/services'; | ||
import { SNIPPET_ITEM_PER_PAGE } from '@snipcode/front/utils/constants'; | ||
import { cookies } from 'next/headers'; | ||
|
||
import { getApolloClient } from '@/lib/apollo/server'; | ||
import { AUTH_COOKIE_NAME } from '@/lib/constants'; | ||
import { logErrorToSentry } from '@/lib/errors'; | ||
|
||
export const fetchSnippets = async () => { | ||
try { | ||
const authToken = cookies().get(AUTH_COOKIE_NAME); | ||
|
||
const { data } = await getApolloClient().query<PublicSnippetsQuery>({ | ||
context: { | ||
headers: { | ||
Authorization: authToken?.value, | ||
}, | ||
}, | ||
query: findPublicSnippetsQuery, | ||
variables: { input: { itemPerPage: SNIPPET_ITEM_PER_PAGE } }, | ||
}); | ||
|
||
return formatPublicSnippetsResult(data); | ||
} catch (error: unknown) { | ||
logErrorToSentry(error); | ||
|
||
throw new Error('Failed to fetch public snippets'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { generatePageMetadata } from '@/lib/seo'; | ||
|
||
import { BrowseContainer } from './container'; | ||
import { fetchSnippets } from './lib/fetch-snippets'; | ||
|
||
export const dynamic = 'force-dynamic'; | ||
|
||
export const metadata = generatePageMetadata({ | ||
title: 'Snipcode - Browse code snippets', | ||
}); | ||
|
||
const BrowsePage = async () => { | ||
const data = await fetchSnippets(); | ||
|
||
if (!data) { | ||
throw new Error('Failed to fetch public snippets'); | ||
} | ||
|
||
return <BrowseContainer data={data} />; | ||
}; | ||
|
||
export default BrowsePage; |
Oops, something went wrong.