diff --git a/.docker/kratos/kratos.yml b/.docker/kratos/kratos.yml index 4b29de3..7db6617 100644 --- a/.docker/kratos/kratos.yml +++ b/.docker/kratos/kratos.yml @@ -11,43 +11,42 @@ serve: base_url: http://kratos:4434/ selfservice: - default_browser_return_url: http://127.0.0.1:4455/ + default_browser_return_url: http://127.0.0.1:5173/ allowed_return_urls: - - http://127.0.0.1:4455 - + - http://127.0.0.1:5173/ methods: password: enabled: true flows: error: - ui_url: http://127.0.0.1:4455/error + ui_url: http://127.0.0.1:5173/error settings: - ui_url: http://127.0.0.1:4455/settings + ui_url: http://127.0.0.1:5173/settings privileged_session_max_age: 15m recovery: - enabled: true - ui_url: http://127.0.0.1:4455/recovery + enabled: false + ui_url: http://127.0.0.1:5173/recovery verification: enabled: false - ui_url: http://127.0.0.1:4455/verification + ui_url: http://127.0.0.1:5173/verification after: - default_browser_return_url: http://127.0.0.1:4455/ + default_browser_return_url: http://127.0.0.1:5173/ logout: after: - default_browser_return_url: http://127.0.0.1:4455/login + default_browser_return_url: http://127.0.0.1:5173/login login: - ui_url: http://127.0.0.1:4455/login + ui_url: http://127.0.0.1:5173/login lifespan: 10m registration: lifespan: 10m - ui_url: http://127.0.0.1:4455/registration + ui_url: http://127.0.0.1:5173/signup after: password: hooks: diff --git a/.env.sample b/.env.sample index 9a45d74..98f1b61 100644 --- a/.env.sample +++ b/.env.sample @@ -9,5 +9,5 @@ KRATOS_POSTGRES_PASSWORD=secret KRATOS_POSTGRES_DB=kratos # Ory Kratos secrets -KRATOS_COOKIE_SECRET=secret -KRATOS_CIPHER_SECRET=secret \ No newline at end of file +KRATOS_COOKIE_SECRET=dnIgMTQgb2t0IDIwMjIgMTI6Mzg6NTMg +KRATOS_CIPHER_SECRET=dnIgMTQgb2t0IDIwMjIgMTI6Mzg6NTMg diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs deleted file mode 100644 index 2596b2c..0000000 --- a/client/.eslintrc.cjs +++ /dev/null @@ -1,84 +0,0 @@ -module.exports = { - root: true, - env: { - node: true, - es6: true, - }, - parserOptions: { ecmaVersion: 8, sourceType: "module" }, - ignorePatterns: ["node_modules/*"], - extends: ["eslint:recommended"], - overrides: [ - { - files: ["**/*.ts", "**/*.tsx"], - parser: "@typescript-eslint/parser", - settings: { - react: { version: "detect" }, - "import/resolver": { - typescript: {}, - }, - }, - env: { - browser: true, - node: true, - es6: true, - }, - extends: [ - "eslint:recommended", - "plugin:import/errors", - "plugin:import/warnings", - "plugin:import/typescript", - "plugin:@typescript-eslint/recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:jsx-a11y/recommended", - "plugin:prettier/recommended", - "plugin:testing-library/react", - "plugin:jest-dom/recommended", - ], - rules: { - "react/display-name": "off", - "no-restricted-imports": [ - "error", - { - patterns: ["@/features/*/*"], - }, - ], - "linebreak-style": ["error", "unix"], - "react/prop-types": "off", - - "import/order": [ - "error", - { - groups: [ - "builtin", - "external", - "internal", - "parent", - "sibling", - "index", - "object", - ], - "newlines-between": "always", - alphabetize: { order: "asc", caseInsensitive: true }, - }, - ], - "import/default": "off", - "import/no-named-as-default-member": "off", - "import/no-named-as-default": "off", - - "react/react-in-jsx-scope": "off", - - "jsx-a11y/anchor-is-valid": "off", - - "@typescript-eslint/no-unused-vars": ["error"], - - "@typescript-eslint/explicit-function-return-type": ["off"], - "@typescript-eslint/explicit-module-boundary-types": ["off"], - "@typescript-eslint/no-empty-function": ["off"], - "@typescript-eslint/no-explicit-any": ["off"], - - "prettier/prettier": ["error", {}, { usePrettierrc: true }], - }, - }, - ], -}; diff --git a/client/.eslintrc.json b/client/.eslintrc.json new file mode 100644 index 0000000..bffb357 --- /dev/null +++ b/client/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/client/.gitignore b/client/.gitignore index a547bf3..db40496 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,24 +1,40 @@ -# Logs -logs -*.log +# 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* -lerna-debug.log* -node_modules -dist -dist-ssr -*.local +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? +# vercel +.vercel + +# typescript +*.tsbuildinfo + +cypress/screenshots +cypress/videos diff --git a/client/.package.json b/client/.package.json new file mode 100644 index 0000000..660c142 --- /dev/null +++ b/client/.package.json @@ -0,0 +1,54 @@ +{ + "name": "client", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build --outDir ../dist", + "preview": "vite preview", + "lint": "eslint --fix --ext .js,.ts,.tsx ./src --ignore-path .gitignore", + "prettier": "prettier --ignore-path .gitignore --write \"**/*.+(js|json|ts|tsx)\"", + "cypress": "cypress" + }, + "dependencies": { + "@headlessui/react": "^1.7.2", + "@heroicons/react": "^2.0.11", + "@hookform/resolvers": "^2.9.8", + "@ory/client": "0.2.0-alpha.48", + "axios": "^0.27.2", + "clsx": "^1.2.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-hook-form": "^7.36.1", + "react-router-dom": "^6.4.1", + "tailwind-scrollbar": "^2.0.1", + "zod": "^3.19.1" + }, + "devDependencies": { + "@testing-library/cypress": "^8.0.3", + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", + "@typescript-eslint/eslint-plugin": "^5.39.0", + "@typescript-eslint/parser": "^5.39.0", + "@vitejs/plugin-react": "^2.1.0", + "autoprefixer": "^10.4.12", + "cypress": "^10.9.0", + "eslint": "^8.24.0", + "eslint-config-prettier": "^8.5.0", + "eslint-import-resolver-typescript": "^3.5.1", + "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jest-dom": "^4.0.2", + "eslint-plugin-jsx-a11y": "^6.6.1", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-react": "^7.31.8", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-testing-library": "^5.7.2", + "postcss": "^8.4.16", + "prettier": "^2.7.1", + "tailwindcss": "^3.1.8", + "typescript": "^4.6.4", + "vite": "^3.1.0" + } +} \ No newline at end of file diff --git a/client/.prettierrc.js b/client/.prettierrc.js new file mode 100644 index 0000000..8cf5bc7 --- /dev/null +++ b/client/.prettierrc.js @@ -0,0 +1,6 @@ +module.exports = { + ...require('ory-prettier-styles'), + importOrder: ['^\\.\\./(?!.*\\.[a-z]+$)(.*)$', '^\\./(?!.*\\.[a-z]+$)(.*)$'], + importOrderSeparation: true, + experimentalBabelParserPluginsList: ['jsx', 'typescript'] +} diff --git a/client/src/components/BrowseLayout.tsx b/client/components/BrowseLayout.tsx similarity index 74% rename from client/src/components/BrowseLayout.tsx rename to client/components/BrowseLayout.tsx index 65777c8..d73e41e 100644 --- a/client/src/components/BrowseLayout.tsx +++ b/client/components/BrowseLayout.tsx @@ -1,12 +1,13 @@ import { ArrowLeftIcon } from '@heroicons/react/24/outline'; -import { Outlet, NavLink } from 'react-router-dom'; -import Button from '../components/Button'; -import NavBar from '../components/NavBar'; -import SideNavChannel from '../components/SideNavChannel'; +import Button from './Button'; +import NavBar from './NavBar'; +import SideNavChannel from './SideNavChannel'; import streamData from '../placeholder/GetStreams'; +import { NextPage } from 'next'; +import Link from 'next/link'; -function BrowseLayout() { +const BrowseLayout: NextPage = ({children}) => { return (
Browse
diff --git a/client/src/components/SideNavChannel.tsx b/client/components/SideNavChannel.tsx similarity index 100% rename from client/src/components/SideNavChannel.tsx rename to client/components/SideNavChannel.tsx diff --git a/client/src/components/SignupForm.tsx b/client/components/SignupForm.tsx similarity index 81% rename from client/src/components/SignupForm.tsx rename to client/components/SignupForm.tsx index c1b9715..634596f 100644 --- a/client/src/components/SignupForm.tsx +++ b/client/components/SignupForm.tsx @@ -1,8 +1,10 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { FC } from 'react'; +import { SelfServiceRegistrationFlow } from '@ory/client'; +import { FC, useEffect, useState } from 'react'; import { SubmitHandler, useForm } from 'react-hook-form'; import { z } from 'zod'; + import FormField from './FormField'; import InlineLink from './InlineLink'; import SubmitButton from './SubmitButton'; @@ -24,12 +26,15 @@ const SignupFormSchema = z type SignupFormValues = z.infer
By clicking Sign Up, you are agreeing to twitch-clone's{' '}
-