From 207af3dbea80230560a26322e5dd679ad93df884 Mon Sep 17 00:00:00 2001 From: Plasmic Bot Date: Mon, 18 Jul 2022 22:22:17 +0000 Subject: [PATCH] [plasmic] Sync project Dark SaaS landing page starter - PRIMARY COPY This is an automated commit generated by Yang Zhang using Plasmic (https://plasmic.app/). Project name: Dark SaaS landing page starter - PRIMARY COPY Project URL: https://studio.plasmic.app/projects/rBVncjZMfEPDGmCMNe2QhK --- .eslintrc.json | 3 + .gitignore | 35 + README.md | 25 + next-env.d.ts | 5 + next.config.js | 7 + package.json | 25 + pages/[[...catchall]].tsx | 63 ++ pages/api/hello.ts | 13 + pages/plasmic-host.tsx | 18 + plasmic-init.ts | 25 + public/favicon.ico | Bin 0 -> 25931 bytes public/vercel.svg | 4 + styles/Home.module.css | 116 +++ styles/globals.css | 16 + tsconfig.json | 20 + yarn.lock | 1923 +++++++++++++++++++++++++++++++++++++ 16 files changed, 2298 insertions(+) create mode 100755 .eslintrc.json create mode 100755 .gitignore create mode 100755 README.md create mode 100755 next-env.d.ts create mode 100755 next.config.js create mode 100644 package.json create mode 100644 pages/[[...catchall]].tsx create mode 100755 pages/api/hello.ts create mode 100644 pages/plasmic-host.tsx create mode 100644 plasmic-init.ts create mode 100755 public/favicon.ico create mode 100755 public/vercel.svg create mode 100755 styles/Home.module.css create mode 100755 styles/globals.css create mode 100755 tsconfig.json create mode 100644 yarn.lock diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100755 index 0000000..bffb357 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..737d872 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo diff --git a/README.md b/README.md new file mode 100755 index 0000000..798929c --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +This is a Next.js project bootstrapped with [`create-plasmic-app`](https://www.npmjs.com/package/create-plasmic-app). + +## Getting Started + +First, run the development server: + +```bash +yarn dev +``` + +Open your browser to see the result. + +You can start editing your project in Plasmic Studio. The page auto-updates as you edit the project. + +## Learn More + +With Plasmic, you can enable non-developers on your team to publish pages and content into your website or app. + +To learn more about Plasmic, take a look at the following resources: + +- [Plasmic Website](https://www.plasmic.app/) +- [Plasmic Documentation](https://docs.plasmic.app/learn/) +- [Plasmic Slack Community](https://www.plasmic.app/slack) + +You can check out [the Plasmic GitHub repository](https://github.com/plasmicapp/plasmic) - your feedback and contributions are welcome! \ No newline at end of file diff --git a/next-env.d.ts b/next-env.d.ts new file mode 100755 index 0000000..4f11a03 --- /dev/null +++ b/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/next.config.js b/next.config.js new file mode 100755 index 0000000..ae88795 --- /dev/null +++ b/next.config.js @@ -0,0 +1,7 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, + swcMinify: true, +} + +module.exports = nextConfig diff --git a/package.json b/package.json new file mode 100644 index 0000000..ebfaa01 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "tmp-cpa", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "@plasmicapp/loader-nextjs": "^1.0.158", + "next": "12.2.2", + "react": "18.2.0", + "react-dom": "18.2.0" + }, + "devDependencies": { + "@types/node": "18.0.6", + "@types/react": "18.0.15", + "@types/react-dom": "18.0.6", + "eslint": "8.20.0", + "eslint-config-next": "12.2.2", + "typescript": "4.7.4" + } +} diff --git a/pages/[[...catchall]].tsx b/pages/[[...catchall]].tsx new file mode 100644 index 0000000..7214d5f --- /dev/null +++ b/pages/[[...catchall]].tsx @@ -0,0 +1,63 @@ +import * as React from "react"; +import { + PlasmicComponent, + extractPlasmicQueryData, + ComponentRenderData, + PlasmicRootProvider, +} from "@plasmicapp/loader-nextjs"; +import { GetStaticPaths, GetStaticProps } from "next"; + +import Error from "next/error"; +import { PLASMIC } from "../plasmic-init"; + +export default function PlasmicLoaderPage(props: { + plasmicData?: ComponentRenderData; + queryCache?: Record; +}) { + const { plasmicData, queryCache } = props; + if (!plasmicData || plasmicData.entryCompMetas.length === 0) { + return ; + } + return ( + + + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + const { catchall } = context.params ?? {}; + const plasmicPath = typeof catchall === 'string' ? catchall : Array.isArray(catchall) ? `/${catchall.join('/')}` : '/'; + const plasmicData = await PLASMIC.maybeFetchComponentData(plasmicPath); + if (!plasmicData) { + // non-Plasmic catch-all + return { props: {} }; + } + // Cache the necessary data fetched for the page + const queryCache = await extractPlasmicQueryData( + + + + ); + // Use revalidate if you want incremental static regeneration + return { props: { plasmicData, queryCache }, revalidate: 60 }; +} + +export const getStaticPaths: GetStaticPaths = async () => { + const pageModules = await PLASMIC.fetchPages(); + return { + paths: pageModules.map((mod) => ({ + params: { + catchall: mod.path.substring(1).split("/"), + }, + })), + + // Turn on "fallback: 'blocking'" if you would like new paths created + // in Plasmic to be automatically available + fallback: false, + }; +} \ No newline at end of file diff --git a/pages/api/hello.ts b/pages/api/hello.ts new file mode 100755 index 0000000..f8bcc7e --- /dev/null +++ b/pages/api/hello.ts @@ -0,0 +1,13 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import type { NextApiRequest, NextApiResponse } from 'next' + +type Data = { + name: string +} + +export default function handler( + req: NextApiRequest, + res: NextApiResponse +) { + res.status(200).json({ name: 'John Doe' }) +} diff --git a/pages/plasmic-host.tsx b/pages/plasmic-host.tsx new file mode 100644 index 0000000..84286ad --- /dev/null +++ b/pages/plasmic-host.tsx @@ -0,0 +1,18 @@ + +import * as React from 'react'; +import Script from 'next/script'; +import { PlasmicCanvasHost } from '@plasmicapp/loader-nextjs'; +import { PLASMIC } from '../plasmic-init'; + +export default function PlasmicHost() { + return PLASMIC && ( +
+