next project scaffold

This commit is contained in:
Winzlieb - 2022-03-09 15:15:32 +01:00
parent cf6fe58760
commit 344d1a8d0a
19 changed files with 5565 additions and 10418 deletions

View File

@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}

View File

@ -1 +1,38 @@
node_modules
# 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
.env.development.local
.env.test.local
.env.production.local
# vercel
.vercel
# typescript
*.tsbuildinfo

View File

@ -1,3 +1,20 @@
TODO: A frontend for authorized NGO members, to search the database
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn 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.tsx`. 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.ts`.
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.
* [The submisison frontend](../submission/README.md) should be written first (since it is more simple / closer to the hello-world of jsonforms)

View File

@ -0,0 +1,14 @@
import * as React from 'react';
import {QueryClient, QueryClientProvider} from 'react-query'
import {ReactQueryDevtools} from 'react-query/devtools'
const queryClient = new QueryClient()
export default function MyQueryClientProvider({children}: {children: React.Component}) {
return (
<QueryClientProvider client={queryClient}>
{children}
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
)
}

View File

@ -0,0 +1,24 @@
import i18next from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import en from './en.json'
import de from './de.json'
export const resources = {
en: { translation: en },
de: { translation: de }
} as const
i18next
.use(initReactI18next)
.use(LanguageDetector)
.init({
resources,
//lng: "en", /* we use LanguageDetector instead */
fallbackLng: "en",
interpolation: {
escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
}
})

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,2 @@
{
}

5
frontend/search/next-env.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

View File

@ -0,0 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
module.exports = nextConfig

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,44 @@
{
"name": "beherbergung-search-frontend",
"version": "0.0.1",
"name": "beherbergung",
"version": "0.1.0",
"private": true,
"scripts": {
"generate": "cd codegen && graphql-codegen generate",
"dev": "next dev",
"build": "next build --no-lint",
"build": "next build",
"start": "next start",
"export": "next export"
"lint": "next lint"
},
"dependencies": {
"graphql-request": "^3.7.0",
"react-query": "^3.34.0"
"@emotion/react": "^11.8.1",
"@emotion/styled": "^11.8.1",
"@jsonforms/core": "3.0.0-alpha.3",
"@jsonforms/material-renderers": "3.0.0-alpha.3",
"@jsonforms/react": "3.0.0-alpha.3",
"@mui/icons-material": "^5.2.0",
"@mui/lab": "^5.0.0-alpha.71",
"@mui/material": "^5.2.2",
"@mui/styles": "^5.2.3",
"graphql-request": "^4.0.0",
"i18next": "^21.6.13",
"i18next-browser-languagedetector": "^6.1.3",
"lodash": "^4.17.21",
"next": "12.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "^11.15.5",
"react-query": "^3.34.16"
},
"devDependencies": {
"@graphql-codegen/cli": "^2.3.0",
"@graphql-codegen/typescript": "^2.4.1",
"@graphql-codegen/typescript-operations": "^2.2.1",
"@graphql-codegen/typescript-react-query": "^3.2.2",
"typescript": "4.5.2"
"@types/lodash": "^4.14.179",
"@types/node": "17.0.21",
"@types/react": "17.0.39",
"eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"typescript": "4.6.2"
}
}

View File

@ -0,0 +1,8 @@
import '../styles/globals.css'
import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp

View File

@ -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<Data>
) {
res.status(200).json({ name: 'John Doe' })
}

View File

@ -0,0 +1,21 @@
import type { NextPage } from 'next'
import Head from 'next/head'
import styles from '../styles/Home.module.css'
const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
</Head>
<main className={styles.main}>
Miau
</main>
</div>
)
}
export default Home

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,8 @@
.container {
padding: 0 2rem;
}
.main {
min-height: 100vh;
padding: 4rem 4rem;
}

View File

@ -0,0 +1,16 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}

View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

5338
frontend/search/yarn.lock Normal file

File diff suppressed because it is too large Load Diff