This commit is contained in:
2023-06-15 00:11:07 +04:00
parent 24222f4521
commit 293b6ea295
6 changed files with 395 additions and 323 deletions

View File

@@ -1,4 +1,5 @@
import { Box, Flex, Link, Stack, useColorMode, useColorModeValue } from '@chakra-ui/react' import { Link } from '@chakra-ui/next-js'
import { Box, Flex, Stack, useColorModeValue } from '@chakra-ui/react'
export default function Footer({ siteName }) { export default function Footer({ siteName }) {
return ( return (

View File

@@ -16,7 +16,6 @@
"@directus/sdk": "10.3.3", "@directus/sdk": "10.3.3",
"@emotion/react": "11.11.1", "@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0", "@emotion/styled": "11.11.0",
"framer-motion": "10.12.16",
"next": "13.4.5", "next": "13.4.5",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0" "react-dom": "18.2.0"

View File

@@ -1,17 +1,17 @@
import directus from '~/lib/directus' import directus from '~/lib/directus'
export const getServerSideProps = async () => { // export const getServerSideProps = async () => {
const { data: pages } = await directus.items('pages').readByQuery({ // const { data: pages } = await directus.items('pages').readByQuery({
limit: 1, // limit: 1,
}) // })
return { // return {
paths: pages.map((p) => ({ params: { slug: p.slug } })), // paths: pages.map((p) => ({ params: { slug: p.slug } })),
fallback: false, // false or "blocking" // fallback: false, // false or "blocking"
} // }
} // }
export const getStaticProps = async ({ params }) => { export const getServerSideProps = async ({ params }) => {
const { slug } = params const { slug } = params
const { const {
@@ -24,6 +24,9 @@ export const getStaticProps = async ({ params }) => {
}, },
}, },
}) })
if (!page) return { notFound: true }
return { props: { page } } return { props: { page } }
} }

View File

@@ -151,7 +151,7 @@ async function importVendors() {
) )
} }
export default async function Home() { export default function Home() {
// importCategories() // importCategories()
// importSubcategories() // importSubcategories()
// importCategoryStructure() // importCategoryStructure()

View File

@@ -1,4 +1,3 @@
import { notFound } from 'next/navigation'
import directus from '~/lib/directus' import directus from '~/lib/directus'
export const getServerSideProps = async ({ params }) => { export const getServerSideProps = async ({ params }) => {
@@ -20,7 +19,7 @@ export const getServerSideProps = async ({ params }) => {
filter: { slug: { _eq: slug } }, filter: { slug: { _eq: slug } },
}) })
if (!vendor) return notFound() if (!vendor) return { notFound: true }
return { props: { vendor } } return { props: { vendor } }
} }
@@ -79,7 +78,7 @@ export default function VendorPage({ vendor }) {
<h2>Categories</h2> <h2>Categories</h2>
<ul> <ul>
{vendor.categories.map((cat) => ( {vendor.categories.map((cat) => (
<li>{cat.categories_id.name}</li> <li key={cat.id}>{cat.categories_id.name}</li>
))} ))}
</ul> </ul>
</> </>

684
frontend/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff