From c9514602b10175219630275cb07c0aebc7cf78bb Mon Sep 17 00:00:00 2001 From: Johns Beharry Date: Tue, 20 Sep 2022 17:24:53 +0200 Subject: [PATCH 1/7] fix(login): use new link for "sign in with lightning" information --- src/features/Auth/pages/LoginPage/LoginPage.tsx | 2 +- .../OverviewPage/RegisterationModals/LoginModal/LoginModal.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/Tournaments/pages/OverviewPage/RegisterationModals/LoginModal/LoginModal.tsx b/src/features/Tournaments/pages/OverviewPage/RegisterationModals/LoginModal/LoginModal.tsx index 043091a..9617266 100644 --- a/src/features/Tournaments/pages/OverviewPage/RegisterationModals/LoginModal/LoginModal.tsx +++ b/src/features/Tournaments/pages/OverviewPage/RegisterationModals/LoginModal/LoginModal.tsx @@ -153,7 +153,7 @@ export default function LinkingAccountModal({ onClose, direction, tournamentId, color='gray' onClick={copyToClipboard} >{copied ? "Copied" : "Copy"} - What is a lightning wallet? From a8358de7600005d0ac25344c47e753be09c545a4 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Tue, 20 Sep 2022 18:38:24 +0300 Subject: [PATCH 2/7] fix: hide make on non-register --- src/features/Tournaments/pages/MakersPage/MakersPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/Tournaments/pages/MakersPage/MakersPage.tsx b/src/features/Tournaments/pages/MakersPage/MakersPage.tsx index ebdf5d4..c9dd9a5 100644 --- a/src/features/Tournaments/pages/MakersPage/MakersPage.tsx +++ b/src/features/Tournaments/pages/MakersPage/MakersPage.tsx @@ -20,7 +20,7 @@ export default function MakersPage() { {query.loading ? : - query.data?.me ? + (query.data?.me && !!query.data.tournamentParticipationInfo) ? : null } From 3f3786c076dd264278a2fb6d1bd7f3ed3cbe78c8 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Tue, 20 Sep 2022 18:48:12 +0300 Subject: [PATCH 3/7] fix: edit story link --- .../Components/StoryPageContent/useUpdateStory.tsx | 3 ++- src/utils/routing/routes.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx index 48b10e4..ac64108 100644 --- a/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx +++ b/src/features/Posts/pages/PostDetailsPage/Components/StoryPageContent/useUpdateStory.tsx @@ -8,6 +8,7 @@ import { NotificationsService } from "src/services/notifications.service"; import { useAppDispatch } from "src/utils/hooks"; import { useReduxEffect } from "src/utils/hooks/useReduxEffect"; import { openModal } from "src/redux/features/modals.slice"; +import { createRoute } from "src/utils/routing"; const CONFIRM_DELETE_STORY = createAction<{ confirmed?: boolean }>('DELETE_STORY_CONFIRMED')({}) @@ -31,7 +32,7 @@ export const useUpdateStory = (story: Story) => { cover_image: story.cover_image ? { id: null, name: null, url: story.cover_image } : null, })) - navigate("/blog/create-post?type=story") + navigate(createRoute({ type: "write-story" })) }; const onConfirmDelete = useCallback(({ payload: { confirmed } }: typeof CONFIRM_DELETE_STORY) => { diff --git a/src/utils/routing/routes.ts b/src/utils/routing/routes.ts index c53a03e..2e27f36 100644 --- a/src/utils/routing/routes.ts +++ b/src/utils/routing/routes.ts @@ -14,6 +14,10 @@ type RouteOptions = title?: string, username?: string, } + | { + type: "write-story", + id?: number, + } | { type: "bounty", id: string | number, @@ -51,6 +55,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}` From 9808ef3df9301dd159ceb7f89f97960c050bc1e7 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Sun, 25 Sep 2022 12:12:15 +0300 Subject: [PATCH 4/7] update: add DB env vars to README --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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: From 465f2a6ceecdbfa38084fe35f1c898f312539ea9 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Thu, 29 Sep 2022 17:03:40 +0300 Subject: [PATCH 5/7] update: making the validation of hashtag debounced --- .../ProjectDetailsTab/ProjectDetailsTab.tsx | 5 ++-- src/utils/validation/misc.ts | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/features/Projects/pages/ListProjectPage/Components/ProjectDetailsTab/ProjectDetailsTab.tsx b/src/features/Projects/pages/ListProjectPage/Components/ProjectDetailsTab/ProjectDetailsTab.tsx index 9fcdb01..15b1054 100644 --- a/src/features/Projects/pages/ListProjectPage/Components/ProjectDetailsTab/ProjectDetailsTab.tsx +++ b/src/features/Projects/pages/ListProjectPage/Components/ProjectDetailsTab/ProjectDetailsTab.tsx @@ -12,12 +12,13 @@ import { BsLightningChargeFill } from "react-icons/bs"; import InfoCard from "src/Components/InfoCard/InfoCard"; import TextInput from "src/Components/Inputs/TextInput/TextInput"; import TextareaInput from "src/Components/Inputs/TextareaInput/TextareaInput"; +import { registerDebounceValidation } from "src/utils/validation"; interface Props { } export default function ProjectDetailsTab(props: Props) { - const { register, formState: { errors, dirtyFields }, control, getValues } = useFormContext(); + const { register, formState: { errors, dirtyFields }, control, getValues, trigger } = useFormContext(); const isUpdating = !!getValues('id'); @@ -117,7 +118,7 @@ export default function ProjectDetailsTab(props: Props) { placeholder='my_project_name' inputClass="pl-8" renderBefore={() => #} - {...register("hashtag")} + {...registerDebounceValidation("hashtag", 1000, trigger, register)} /> {errors.hashtag &&

{errors.hashtag.message} 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 From c2b15274cadf7ad3af16e1ea6d7c1006ec3d2d84 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Fri, 30 Sep 2022 14:16:02 +0300 Subject: [PATCH 6/7] update (tournament): make profile image/name clickable on maker card --- .../Tournaments/pages/MakersPage/MakerCard/MakerCard.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/features/Tournaments/pages/MakersPage/MakerCard/MakerCard.tsx b/src/features/Tournaments/pages/MakersPage/MakerCard/MakerCard.tsx index b01a8d5..ed24506 100644 --- a/src/features/Tournaments/pages/MakersPage/MakerCard/MakerCard.tsx +++ b/src/features/Tournaments/pages/MakersPage/MakerCard/MakerCard.tsx @@ -62,10 +62,15 @@ export default function MakerCard({ maker, isMe }: Props) {

- + + +
-

{maker.user.name}

+ + +

{maker.user.name}

+ {maker.user.jobTitle ?

{maker.user.jobTitle}

:

No job title

} From f01c3c1127bb295be6ee9af95b2463ec6fdd2d1e Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Sun, 2 Oct 2022 10:19:07 +0300 Subject: [PATCH 7/7] update: Write a story btn link --- src/features/Posts/pages/FeedPage/FeedPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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