Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable ssr on /privacy-policy #9155

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9d3868e
feat: test SSR mode
preschian Jan 15, 2024
d510742
Add ClientOnly component to default layout
preschian Jan 15, 2024
0591e37
Add transpile option to build configuration
preschian Jan 15, 2024
6bbb96d
feat: add client-side process checks for localStorage and window objects
preschian Jan 15, 2024
23d2910
feat(nuxt.config.ts, package.json, pnpm-lock.yaml): add 'graphql-ws' …
preschian Jan 15, 2024
ed8f3e3
fix(package.json): add max-old-space-size option to NODE_OPTIONS in g…
preschian Jan 15, 2024
38b400f
Merge branch 'main' of github.com:preschian/nft-gallery into feat/tes…
preschian Jan 26, 2024
8e3cc75
Comment out PWA and Sentry configurations
preschian Jan 26, 2024
799522e
Update dependencies in nuxt.config.ts and package.json
preschian Jan 26, 2024
6dc1ba7
Enable sitemap plugin in nuxt.config.ts
preschian Jan 26, 2024
df90883
style: refactor computed functions to improve readability in multiple…
preschian Jan 26, 2024
43c6ef7
feat(nuxt.config.ts): enable pwa and vite-pwa/nuxt modules
preschian Jan 26, 2024
4b80bf0
chore(nuxt.config.ts): comment out pwa related imports and usage
preschian Jan 26, 2024
ca1d957
revert
preschian Jan 26, 2024
09cbf02
Update dependencies in package.json
preschian Jan 26, 2024
668cc2e
chore(package.json): update date-fns package from version 2.30.0 to 3…
preschian Jan 26, 2024
bae0045
Update Nuxt configuration to enable Vite PWA
preschian Jan 26, 2024
b276776
feat: add new default-ssr layout
preschian Jan 26, 2024
7de1ae3
chore: update lock file
preschian Jan 27, 2024
20de323
feat(ModelMedia.vue): add onMounted lifecycle hook to conditionally i…
preschian Jan 27, 2024
ffd4ddc
feat(NeoModal.scss): add modal-zindex variable with value 998
preschian Jan 27, 2024
4c2cec7
feat(nuxt.config.ts): add sentryVitePlugin to vite plugins
preschian Jan 27, 2024
9833a8f
Merge pull request #9154 from preschian/test-ssr
preschian Jan 27, 2024
0d3420d
Add tslib dependency
preschian Jan 27, 2024
21a9017
Add postbuild script to package.json
preschian Jan 27, 2024
d893766
Update postbuild script to fix tslib import
preschian Jan 27, 2024
44ceee0
Remove postbuild script from package.json
preschian Jan 27, 2024
95533c4
update lockfile
preschian Jan 27, 2024
1fe8b65
Remove tslib from build transpile
preschian Jan 27, 2024
c8ff6af
Merge branch 'main' into cf-ssr-privacy-policy
preschian Jan 30, 2024
32dfa40
Merge branch 'main' of github.com:kodadot/nft-gallery into cf-ssr-pri…
preschian Feb 1, 2024
173f628
chore: adjust lockfile
preschian Feb 2, 2024
1354ad2
chore(nuxt.config.ts): comment out sentryVitePlugin import and usage
preschian Feb 2, 2024
4f5e6a1
chore: opt out resolutions
preschian Feb 2, 2024
ea430a3
Merge branch 'main' into cf-ssr-privacy-policy
preschian Feb 2, 2024
7968185
Merge branch 'main' into cf-ssr-privacy-policy
preschian Feb 3, 2024
7e318b9
Merge branch 'main' into cf-ssr-privacy-policy
preschian Feb 4, 2024
f5c6aa3
Merge branch 'main' into cf-ssr-privacy-policy
preschian Feb 5, 2024
eda1068
Merge branch 'main' of github.com:kodadot/nft-gallery into cf-ssr-pri…
preschian Mar 17, 2024
d7f699b
build: readd optimizeDeps
preschian Mar 17, 2024
0c2b956
chore: update lockfile
preschian Mar 17, 2024
270c5b5
Merge branch 'main' of github.com:kodadot/nft-gallery into cf-ssr-pri…
preschian Mar 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions composables/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export default function <T>(key: string, defaultValue: T) {
return customRef((track, trigger) => ({
get: (): T => {
track()
const value = localStorage.getItem(key)
const value = process.client && localStorage.getItem(key)
return value ? JSON.parse(value) : defaultValue
},
set: (value: T) => {
if (value === null) {
localStorage.removeItem(key)
process.client && localStorage.removeItem(key)
} else {
localStorage.setItem(key, JSON.stringify(value))
process.client && localStorage.setItem(key, JSON.stringify(value))
}
trigger()
},
Expand Down
37 changes: 37 additions & 0 deletions layouts/default-ssr.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<div class="min-h-full flex flex-col is-clipped">
<ClientOnly>
<Navbar />
</ClientOnly>
<main class="flex-grow py-8">
<div class="container is-fluid">
<Error
v-if="$nuxt.isOffline"
:has-img="false"
error-subtitle="Please check your network connections"
error-title="Offline Detected" />
<NuxtPage v-else />
</div>
</main>
<ClientOnly>
<LazyTheFooter />
<LazyCookieBanner />
<Buy />
</ClientOnly>
</div>
</template>

<script lang="ts" setup>
const { $config } = useNuxtApp()
const route = useRoute()

useHead({
link: [
{
hid: 'canonical',
rel: 'canonical',
href: $config.public.baseUrl + route.path,
},
],
})
</script>
6 changes: 5 additions & 1 deletion libs/ui/src/components/MediaItem/type/ModelMedia.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
</template>

<script lang="ts" setup>
import '@google/model-viewer'
onMounted(() => {
if (process.client) {
import('@google/model-viewer')
}
})

defineProps<{
animationSrc: string
Expand Down
1 change: 1 addition & 0 deletions libs/ui/src/components/NeoModal/NeoModal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

$modal-content-border-radius: 0;
$modal-overlay-background-color: rgb(0 0 0 / 0.17);
$modal-zindex: 998;

@import '@oruga-ui/oruga-next/src/scss/components/_modal.scss';

Expand Down
2 changes: 1 addition & 1 deletion middleware/prefix.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineNuxtRouteMiddleware((route) => {

const isAnyChainPrefixInPath = chainPrefixes.includes(prefixInPath)
const rmrk2ChainPrefixInHostname = rmrk2ChainPrefixesInHostname.find(
(prefix) => location.hostname.startsWith(`${prefix}.`),
(prefix) => process.client && location.hostname.startsWith(`${prefix}.`),
)

if (
Expand Down
11 changes: 9 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default defineNuxtConfig({

vite: {
build: {
sourcemap: true,
sourcemap: false,
},
plugins: [
svgLoader({
Expand All @@ -49,22 +49,29 @@ export default defineNuxtConfig({
'@kodadot1/minimark/v2',
'@paraspell/sdk',
'@polkadot/api',
'@polkadot/extension-dapp',
'@polkadot/vue-identicon',
'@ramp-network/ramp-instant-sdk',
'@transak/transak-sdk',
'@unhead/vue',
'bn.js',
'chart.js/auto',
'chartjs-adapter-date-fns',
'chartjs-plugin-zoom',
'graphql-ws',
'keen-slider/vue',
'keen-slider/vue.es',
'lodash/isEqual',
'lodash/filter',
'lodash/orderBy',
'lodash/sortBy',
'lodash/sum',
'lodash/unionBy',
'markdown-it',
'partysocket',
'prismjs',
'qrcode.vue',
'wavesurfer.js',
],
}
: undefined,
Expand All @@ -80,7 +87,7 @@ export default defineNuxtConfig({
},

// Disable server-side rendering
ssr: false,
// ssr: false,

// Global page headers: https://nuxt.com/docs/api/configuration/nuxt-config#head
app: {
Expand Down
29 changes: 13 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
"locales:check": "node ./script/checkLocale.mjs",
"start": "nuxi preview",
"start:node": "PORT=9090 node .output/server/index.mjs",
"generate": "node ./script/posts.mjs && cross-env NODE_OPTIONS=--openssl-legacy-provider nuxi build",
"generate": "node ./script/posts.mjs && cross-env NODE_OPTIONS=--openssl-legacy-provider nuxi build && pnpm run postbuild",
"lint": "eslint --cache --ignore-path .gitignore --ext .js,.ts,.vue .",
"lint:quiet": "eslint --cache --quiet --ignore-path .gitignore --ext .js,.ts,.vue .",
"lint:fix": "eslint --cache --fix --quiet --ignore-path .gitignore --ext .js,.ts,.vue .",
"test": "vitest run --reporter verbose --allowOnly",
"test:watch": "vitest --reporter verbose",
"test:coverage": "vitest run --coverage",
"test:e2e": "playwright test --ui",
"prepare": "pnpm -F static build && nuxi prepare && husky install"
"prepare": "pnpm -F static build && nuxi prepare && husky install",
"postbuild": "cd .output/server/node_modules/tslib; npm pkg set 'exports[.].import.node'='./tslib.es6.mjs'"
},
"husky": {
"hooks": {
Expand All @@ -59,8 +60,8 @@
},
"packageManager": "pnpm@8.6.0",
"dependencies": {
"@braintree/sanitize-url": "^6.0.4",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@braintree/sanitize-url": "^7.0.0",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/vue-fontawesome": "^3.0.6",
"@kodadot1/brick": "workspace:*",
"@kodadot1/minimark": "^0.1.14-rc.0",
Expand Down Expand Up @@ -90,12 +91,12 @@
"chartjs-adapter-date-fns": "^3.0.0",
"chartjs-plugin-annotation": "^3.0.1",
"chartjs-plugin-zoom": "^2.0.1",
"date-fns": "^2.30.0",
"date-fns": "^3.3.1",
"graphql": "^16.8.1",
"graphql-ws": "^5.15.0",
"keen-slider": "^6.8.6",
"lodash": "^4.17.21",
"markdown-it": "^13.0.2",
"markdown-it": "^14.0.0",
"nuxt-speedkit": "3.0.0-next.27",
"ofetch": "^1.3.3",
"partysocket": "^0.0.25",
Expand All @@ -107,12 +108,12 @@
"slugify": "^1.6.6",
"unzipit": "^1.4.3",
"vue-apollo": "^3.1.2",
"vue-audio-visual": "2.5.0",
"vue-audio-visual": "3.0.7",
"vue-chartjs": "^5.3.0",
"vue-dompurify-html": "^4.1.4",
"vue-dompurify-html": "^5.0.1",
"vue-tippy": "^6.4.1",
"wavesurfer.js": "^7.7.4",
"workbox-window": "^6.6.0"
"workbox-window": "^7.0.0"
},
"devDependencies": {
"@nuxt/content": "^2.12.1",
Expand All @@ -123,14 +124,13 @@
"@nuxtjs/i18n": "^8.2.0",
"@nuxtjs/sitemap": "^5.1.2",
"@playwright/test": "^1.42.1",
"@types/jest": "^27.5.2",
"@types/lodash": "^4.17.0",
"@types/markdown-it": "^13.0.7",
"@types/prismjs": "^1.26.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vite-pwa/nuxt": "^0.6.0",
"@vitest/coverage-istanbul": "^0.34.6",
"@vitest/coverage-istanbul": "^1.2.1",
"@vueuse/core": "^9.13.0",
"@vueuse/nuxt": "^9.13.0",
"autoprefixer": "^10.4.18",
Expand All @@ -151,13 +151,10 @@
"prettier": "^3.2.5",
"sass": "^1.71.1",
"tailwindcss": "^3.4.1",
"tslib": "^2.6.2",
"vite-svg-loader": "^5.1.0",
"vitest": "^0.34.6",
"vitest": "^1.2.1",
"vue-eslint-parser": "^9.4.2",
"vue-gtag": "^2.0.1"
},
"resolutions": {
"@apollo/federation": "0.38.1",
"vue": "3.4.8"
}
}
4 changes: 4 additions & 0 deletions pages/privacy-policy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,10 @@ export default {
},
],
})

definePageMeta({
layout: 'default-ssr',
})
},
}
</script>
Expand Down