From ae3780880c6d8190d819e90c98aabc4d87ec64ac Mon Sep 17 00:00:00 2001 From: Matthias Nannt Date: Thu, 8 Dec 2022 17:19:54 +0100 Subject: [PATCH] add demo app, update cors on hq --- .gitignore | 1 - apps/demo/.eslintrc.js | 4 + apps/demo/.gitignore | 34 ++ apps/demo/CHANGELOG.md | 8 + apps/demo/README.md | 30 ++ apps/demo/components/FeedbackModal.tsx | 68 +++ apps/demo/next-env.d.ts | 5 + apps/demo/next.config.js | 6 + apps/demo/package.json | 33 ++ apps/demo/pages/_app.tsx | 9 + apps/demo/pages/api/submissions.ts | 24 + apps/demo/pages/app.tsx | 580 +++++++++++++++++++++++++ apps/demo/pages/index.tsx | 383 ++++++++++++++++ apps/demo/postcss.config.js | 6 + apps/demo/styles/globals.css | 3 + apps/demo/tailwind.config.js | 20 + apps/demo/tsconfig.json | 5 + apps/hq/next.config.js | 18 + packages/react/src/helpers/sendToHq.ts | 2 +- pnpm-lock.yaml | 235 ++++++++-- 20 files changed, 1439 insertions(+), 35 deletions(-) create mode 100644 apps/demo/.eslintrc.js create mode 100644 apps/demo/.gitignore create mode 100644 apps/demo/CHANGELOG.md create mode 100644 apps/demo/README.md create mode 100644 apps/demo/components/FeedbackModal.tsx create mode 100644 apps/demo/next-env.d.ts create mode 100644 apps/demo/next.config.js create mode 100644 apps/demo/package.json create mode 100644 apps/demo/pages/_app.tsx create mode 100644 apps/demo/pages/api/submissions.ts create mode 100644 apps/demo/pages/app.tsx create mode 100644 apps/demo/pages/index.tsx create mode 100644 apps/demo/postcss.config.js create mode 100644 apps/demo/styles/globals.css create mode 100644 apps/demo/tailwind.config.js create mode 100644 apps/demo/tsconfig.json diff --git a/.gitignore b/.gitignore index ba7006bec5..d58af5885d 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,3 @@ yarn-error.log* # nixos stuff .direnv -apps/demo diff --git a/apps/demo/.eslintrc.js b/apps/demo/.eslintrc.js new file mode 100644 index 0000000000..bcf4aad3a3 --- /dev/null +++ b/apps/demo/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: ["formbricks"], +}; diff --git a/apps/demo/.gitignore b/apps/demo/.gitignore new file mode 100644 index 0000000000..1437c53f70 --- /dev/null +++ b/apps/demo/.gitignore @@ -0,0 +1,34 @@ +# 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* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel diff --git a/apps/demo/CHANGELOG.md b/apps/demo/CHANGELOG.md new file mode 100644 index 0000000000..927e207078 --- /dev/null +++ b/apps/demo/CHANGELOG.md @@ -0,0 +1,8 @@ +# @formbricks/examples + +## 1.0.1 + +### Patch Changes + +- Updated dependencies [0e946c7] + - @formbricks/react@0.0.2 diff --git a/apps/demo/README.md b/apps/demo/README.md new file mode 100644 index 0000000000..6d80fdc38b --- /dev/null +++ b/apps/demo/README.md @@ -0,0 +1,30 @@ +## Getting Started + +First, run the development server: + +```bash +pnpm dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. + +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn/foundations/about-nextjs) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_source=github.com&utm_medium=referral&utm_campaign=turborepo-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/apps/demo/components/FeedbackModal.tsx b/apps/demo/components/FeedbackModal.tsx new file mode 100644 index 0000000000..972e19adb4 --- /dev/null +++ b/apps/demo/components/FeedbackModal.tsx @@ -0,0 +1,68 @@ +import { Form, Nps, sendToHq, Submit, Textarea } from "@formbricks/react"; +import { Transition } from "@headlessui/react"; +import { XMarkIcon } from "@heroicons/react/20/solid"; +import { Fragment } from "react"; + +export default function FeedbackModal({ show, setShow }) { + return ( + <> + {/* Global notification live region, render this permanently at the end of the document */} +
+
+ {/* Notification panel, dynamically insert this into the live region when it needs to be displayed */} + +
+
+
+
+

We would like to hear your feedback

+
+
+ +