diff --git a/README.md b/README.md index fb90840..cccaa25 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,19 @@ We are using serverless functions to serve our GraphQl endpoint to the client ap ## Running locally -First, you need to have a Postegre Database to store the data, then you need to put the connection string in an .env file in your project root directory. -The connection string will be of the format: -postgresql://username:password@server/database_name +To run the project locally with your own local DB, you will need to first put a few env variables in an env file that should be created in /envs/server directory, named `local.env` + +The required variables that needs to be put there are: + +``` +NODE_ENV = "development" +DATABASE_PROXY_URL = "YOUR DB CONNECTION STRING" +JWT_SECRET = "SOME RANDOM JWT SECRET" +LNURL_AUTH_HOST = "http://localhost:8888/dev/login" +CLOUDFLARE_IMAGE_ACCOUNT_ID = "FOR UPLOADING IMAGES" +CLOUDFLARE_IMAGE_API_KEY = "FOR UPLOADING IMAGES" +CLOUDFLARE_IMAGE_ACCOUNT_HASH = "FOR UPLOADING IMAGES" +``` Then you need to run the migrations against your database. use the command: diff --git a/src/features/Auth/pages/LoginPage/LoginPage.tsx b/src/features/Auth/pages/LoginPage/LoginPage.tsx index 5b4b37e..8840b32 100644 --- a/src/features/Auth/pages/LoginPage/LoginPage.tsx +++ b/src/features/Auth/pages/LoginPage/LoginPage.tsx @@ -182,7 +182,7 @@ export default function LoginPage() { color='gray' onClick={copyToClipboard} >{copied ? "Copied" : "Copy"} - What is a lightning wallet? diff --git a/src/features/Posts/pages/FeedPage/FeedPage.tsx b/src/features/Posts/pages/FeedPage/FeedPage.tsx index c887bcd..42dc82e 100644 --- a/src/features/Posts/pages/FeedPage/FeedPage.tsx +++ b/src/features/Posts/pages/FeedPage/FeedPage.tsx @@ -91,7 +91,7 @@ export default function FeedPage() {

Discover

- What is a lightning wallet?
diff --git a/src/utils/routing/routes.ts b/src/utils/routing/routes.ts index b471a30..7231f94 100644 --- a/src/utils/routing/routes.ts +++ b/src/utils/routing/routes.ts @@ -15,7 +15,7 @@ type RouteOptions = username?: string, } | { - type: "edit-story", + type: "write-story", id?: number, } | { @@ -66,6 +66,10 @@ export function createRoute(options: RouteOptions) { + (!onlyId ? "-" : "") + `${options.id}` } + + if (options.type === 'write-story') + return "/story/write?type=story" + if ((options.type === "post" && options.postType.toLowerCase() === 'bounty') || options.type === "bounty") return `/blog/post/bounty/${options.id}` diff --git a/src/utils/validation/misc.ts b/src/utils/validation/misc.ts index a13ad9e..1ad6308 100644 --- a/src/utils/validation/misc.ts +++ b/src/utils/validation/misc.ts @@ -1,4 +1,6 @@ import * as yup from "yup"; +import { FieldPath, RegisterOptions, UseFormRegister, UseFormRegisterReturn, UseFormTrigger } from 'react-hook-form' +import debounce from "lodash.debounce"; export const imageSchema = yup.object().shape({ id: yup.string().nullable(true), @@ -10,3 +12,25 @@ export const tagSchema = yup.object().shape({ title: yup.string().trim().min(2).required(), }); + + +export const registerDebounceValidation = ( + name: FieldPath, + delay: number, + trigger: UseFormTrigger, + register: UseFormRegister, + options?: RegisterOptions> +) => { + const useFormRegisterReturn: UseFormRegisterReturn = register(name, options) + const { onChange } = useFormRegisterReturn + const debouncedValidate = debounce(() => { + trigger(name) + }, delay) + return { + ...useFormRegisterReturn, + onChange: (e: any) => { + onChange(e) + debouncedValidate() + }, + } +} \ No newline at end of file