Skip to content

Commit 41cd84e

Browse files
committed
hot fix for CodeEditor
1 parent 4a53866 commit 41cd84e

9 files changed

Lines changed: 113 additions & 56 deletions

File tree

packages/dapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"react-icons": "^4.3.1",
8989
"react-markdown": "^7.0.0",
9090
"react-parallax-tilt": "^1.5.73",
91-
"siwe": "^2.0.1",
91+
"siwe": "^1.1.6",
9292
"states-cities-db": "^1.4.1",
9393
"tiny-invariant": "^1.2.0",
9494
"uint8arrays": "^3.0.0",

packages/dapp/src/components/projects/CreateProjectForm.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import {
1414
InputGroup,
1515
InputLeftAddon,
1616
Text,
17+
Textarea,
1718
} from "@chakra-ui/react";
1819
import CodeEditorPreview from "components/custom/CodeEditorPreview";
19-
import useCustomColor from "core/hooks/useCustomColor";
20-
import dynamic from "next/dynamic";
20+
// import useCustomColor from "core/hooks/useCustomColor";
21+
// import dynamic from "next/dynamic";
2122
import { useEffect, useState } from "react";
2223
import { useFormContext } from "react-hook-form";
2324

@@ -29,12 +30,12 @@ import ControlledSelect from "../Inputs/ControlledSelect";
2930

3031
import LogoDropzone from "./LogoDropzone";
3132

32-
const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
33-
ssr: false,
34-
});
33+
// const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
34+
// ssr: false,
35+
// });
3536
const CreateProjectForm = () => {
3637
const [code, setCode] = useState<string>();
37-
const { codeEditorScheme } = useCustomColor();
38+
// const { codeEditorScheme } = useCustomColor();
3839
const { data, loading, error } = useQuery(ALL_TAGS_QUERY);
3940
const {
4041
register,
@@ -106,7 +107,8 @@ const CreateProjectForm = () => {
106107

107108
<FormControl isInvalid={errors.description}>
108109
<FormLabel htmlFor="description">Markdown Description</FormLabel>
109-
<CodeEditor
110+
{/* TODO: fix types for CodeEditor
111+
<CodeEditor
110112
value={code}
111113
language="markdown"
112114
placeholder="Project description"
@@ -123,6 +125,18 @@ const CreateProjectForm = () => {
123125
}}
124126
className={codeEditorScheme}
125127
padding={15}
128+
/>
129+
*/}
130+
<Textarea
131+
placeholder="Project description"
132+
{...register("description", {
133+
required: REQUIRED_FIELD_LABEL,
134+
})}
135+
onChange={(e) => {
136+
const { name } = e.target;
137+
setCode(e.target.value);
138+
setValue(name, e.target.value);
139+
}}
126140
/>
127141
<FormErrorMessage>
128142
{errors.description && errors.description.message}

packages/dapp/src/components/projects/EditProjectForm.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,27 @@ import {
1111
AlertIcon,
1212
AlertTitle,
1313
Spinner,
14+
Textarea,
1415
} from "@chakra-ui/react";
1516
import { useFormContext } from "react-hook-form";
16-
import dynamic from "next/dynamic";
17+
// import dynamic from "next/dynamic";
18+
// import useCustomColor from "core/hooks/useCustomColor";
1719
import { useState, useEffect } from "react";
1820

1921
import CodeEditorPreview from "components/custom/CodeEditorPreview";
20-
import useCustomColor from "core/hooks/useCustomColor";
2122
import { Tag } from "../../core/types";
2223
import { ALL_TAGS_QUERY } from "../../graphql/tags";
2324
import IconWithState from "../custom/IconWithState";
2425
import ControlledSelect from "../Inputs/ControlledSelect";
2526

2627
import LogoDropzone from "./LogoDropzone";
2728

28-
const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
29-
ssr: false,
30-
});
29+
// const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
30+
// ssr: false,
31+
// });
3132
const EditProjectForm: React.FunctionComponent = () => {
3233
const [code, setCode] = useState<string>();
33-
const { codeEditorScheme } = useCustomColor();
34+
// const { codeEditorScheme } = useCustomColor();
3435
const {
3536
register,
3637
setValue,
@@ -83,7 +84,16 @@ const EditProjectForm: React.FunctionComponent = () => {
8384

8485
<FormControl isInvalid={errors.description}>
8586
<FormLabel htmlFor="description">Description</FormLabel>
86-
<CodeEditor
87+
<Textarea
88+
placeholder="Project description"
89+
{...register("description")}
90+
onChange={(e) => {
91+
const { name } = e.target;
92+
setCode(e.target.value);
93+
setValue(name, e.target.value);
94+
}}
95+
/>
96+
{/* <CodeEditor
8797
value={code}
8898
language="markdown"
8999
placeholder="Project description"
@@ -103,7 +113,7 @@ const EditProjectForm: React.FunctionComponent = () => {
103113
}}
104114
className={codeEditorScheme}
105115
padding={15}
106-
/>
116+
/> */}
107117
<FormErrorMessage>
108118
{errors.description && errors.description.message}
109119
</FormErrorMessage>

packages/dapp/src/components/projects/pathways/PathwayForm.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ import {
1818
NumberInputStepper,
1919
Tag,
2020
Text,
21+
Textarea,
2122
VStack,
2223
} from "@chakra-ui/react";
2324
import { useWeb3React } from "@web3-react/core";
2425
import CodeEditorPreview from "components/custom/CodeEditorPreview";
25-
import useCustomColor from "core/hooks/useCustomColor";
26-
import dynamic from "next/dynamic";
26+
// import useCustomColor from "core/hooks/useCustomColor";
27+
// import dynamic from "next/dynamic";
2728
import { useEffect, useMemo, useState } from "react";
2829
import { useFormContext } from "react-hook-form";
2930
import {
@@ -34,13 +35,13 @@ import useTokenList from "../../../core/hooks/useTokenList";
3435
import ImageDropzone from "../../custom/ImageDropzone";
3536
import ControlledSelect from "../../Inputs/ControlledSelect";
3637

37-
const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
38-
ssr: false,
39-
});
38+
// const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
39+
// ssr: false,
40+
// });
4041

4142
export default function PathwayForm({ isWithRewards, withRewards }: any) {
4243
const [code, setCode] = useState<string>();
43-
const { codeEditorScheme } = useCustomColor();
44+
// const { codeEditorScheme } = useCustomColor();
4445

4546
const { chainId } = useWeb3React();
4647
const { tokens } = useTokenList();
@@ -161,7 +162,18 @@ export default function PathwayForm({ isWithRewards, withRewards }: any) {
161162

162163
<FormControl isInvalid={errors.description}>
163164
<FormLabel htmlFor="description">Description</FormLabel>
164-
<CodeEditor
165+
<Textarea
166+
placeholder="Pathway description"
167+
{...register("description", {
168+
required: REQUIRED_FIELD_LABEL,
169+
})}
170+
onChange={(e) => {
171+
const { name } = e.target;
172+
setCode(e.target.value);
173+
setValue(name, e.target.value);
174+
}}
175+
/>
176+
{/* <CodeEditor
165177
value={code}
166178
language="markdown"
167179
placeholder="Pathway description (markdown)"
@@ -178,7 +190,7 @@ export default function PathwayForm({ isWithRewards, withRewards }: any) {
178190
}}
179191
className={codeEditorScheme}
180192
padding={15}
181-
/>
193+
/> */}
182194
<FormErrorMessage>
183195
{errors.description && errors.description.message}
184196
</FormErrorMessage>

packages/dapp/src/components/projects/quests/QuestForm.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ import {
2323
useToast,
2424
VStack,
2525
Checkbox,
26+
Textarea,
2627
} from "@chakra-ui/react";
2728
import { useWeb3React } from "@web3-react/core";
2829
import CodeEditorPreview from "components/custom/CodeEditorPreview";
29-
import useCustomColor from "core/hooks/useCustomColor";
3030
import { Contract, ethers } from "ethers";
31-
import dynamic from "next/dynamic";
31+
// import useCustomColor from "core/hooks/useCustomColor";
32+
// import dynamic from "next/dynamic";
3233
import { useRouter } from "next/router";
3334
import { ChangeEvent, useContext, useEffect, useMemo, useState } from "react";
3435
import { useFormContext } from "react-hook-form";
@@ -92,17 +93,17 @@ const questTypeOptions = [
9293
},
9394
];
9495

95-
const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
96-
ssr: false,
97-
});
96+
// const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
97+
// ssr: false,
98+
// });
9899

99100
const CreateQuestForm: React.FunctionComponent = () => {
100101
const router = useRouter();
101102
const toast = useToast();
102103
const [code, setCode] = useState<string>();
103104
const [isWithRewards, setIsWithRewards] = useState<boolean>();
104105
const [submitStatus, setSubmitStatus] = useState<string>("Creating quest");
105-
const { codeEditorScheme } = useCustomColor();
106+
// const { codeEditorScheme } = useCustomColor();
106107
const { tokens } = useTokenList();
107108
const { library, chainId } = useWeb3React();
108109
const { self, account, contracts } = useContext(Web3Context);
@@ -498,7 +499,18 @@ const CreateQuestForm: React.FunctionComponent = () => {
498499

499500
<FormControl isInvalid={errors.description}>
500501
<FormLabel htmlFor="description">Description</FormLabel>
501-
<CodeEditor
502+
<Textarea
503+
placeholder="Quest description"
504+
{...register("description", {
505+
required: REQUIRED_FIELD_LABEL,
506+
})}
507+
onChange={(e) => {
508+
const { name } = e.target;
509+
setCode(e.target.value);
510+
setValue(name, e.target.value);
511+
}}
512+
/>
513+
{/* <CodeEditor
502514
value={code}
503515
language="markdown"
504516
placeholder="Quest description (markdown)"
@@ -515,7 +527,7 @@ const CreateQuestForm: React.FunctionComponent = () => {
515527
}}
516528
className={codeEditorScheme}
517529
padding={15}
518-
/>
530+
/> */}
519531
<FormErrorMessage>
520532
{errors.description && errors.description.message}
521533
</FormErrorMessage>

packages/dapp/src/components/projects/quests/bounty/BountyForm.tsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ import {
1111
Progress,
1212
Stack,
1313
Text,
14+
Textarea,
1415
useToast,
1516
VStack,
1617
} from "@chakra-ui/react";
17-
import { useWeb3React } from "@web3-react/core";
18+
1819
import CodeEditorPreview from "components/custom/CodeEditorPreview";
1920
import ImageDropzone from "components/custom/ImageDropzone";
2021
import { REQUIRED_FIELD_LABEL } from "core/constants";
2122
import { blobToDataURL } from "core/helpers";
2223
import useCustomColor from "core/hooks/useCustomColor";
2324
import { GET_APP_DID } from "graphql/app";
24-
import dynamic from "next/dynamic";
25+
// import dynamic from "next/dynamic";
2526
import { useContext, useState } from "react";
2627
import { useForm } from "react-hook-form";
2728
import { Web3Context } from "../../../../contexts/Web3Context";
@@ -31,9 +32,9 @@ import {
3132
SUBMIT_QUEST_SOLUTION_MUTATION,
3233
} from "../../../../graphql/quests";
3334

34-
const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
35-
ssr: false,
36-
});
35+
// const CodeEditor = dynamic(() => import("@uiw/react-textarea-code-editor"), {
36+
// ssr: false,
37+
// });
3738

3839
function BountyForm({ questId, pathwayId, successCallback }: any) {
3940
const toast = useToast();
@@ -46,7 +47,7 @@ function BountyForm({ questId, pathwayId, successCallback }: any) {
4647
const { self } = useContext(Web3Context);
4748

4849
const [code, setCode] = useState<string>();
49-
const { codeEditorScheme } = useCustomColor();
50+
// const { codeEditorScheme } = useCustomColor();
5051

5152
const [isLoading, setIsLoading] = useState(false);
5253

@@ -179,7 +180,18 @@ function BountyForm({ questId, pathwayId, successCallback }: any) {
179180
<VStack as="form">
180181
<FormControl isInvalid={errors.solution}>
181182
<FormLabel htmlFor="solution">Your Solution</FormLabel>
182-
<CodeEditor
183+
<Textarea
184+
placeholder="Quest solution"
185+
{...register("solution", {
186+
required: REQUIRED_FIELD_LABEL,
187+
})}
188+
onChange={(e) => {
189+
const { name } = e.target;
190+
setCode(e.target.value);
191+
setValue(name, e.target.value);
192+
}}
193+
/>
194+
{/* <CodeEditor
183195
value={code}
184196
language="markdown"
185197
placeholder="Quest solution (markdown)"
@@ -196,7 +208,7 @@ function BountyForm({ questId, pathwayId, successCallback }: any) {
196208
}}
197209
className={codeEditorScheme}
198210
padding={15}
199-
/>
211+
/> */}
200212
<FormErrorMessage>
201213
{errors.solution && errors.solution.message}
202214
</FormErrorMessage>

packages/dapp/src/pages/projects/create-project/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function CreateProjectStepper() {
296296
{activeStep === 2 && (
297297
<Button
298298
ml="0.5rem"
299-
// colorScheme="accent"
299+
// colorScheme="accentDark"
300300
isLoading={methods.formState.isSubmitting}
301301
type="submit"
302302
px="1.25rem"

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"reflect-metadata": "^0.1.13",
6464
"rimraf": "^3.0.2",
6565
"rxjs": "^7.2.0",
66-
"siwe": "^2.0.1",
66+
"siwe": "^1.1.6",
6767
"subscriptions-transport-ws": "^0.9.19",
6868
"swagger-ui-express": "^4.1.6",
6969
"uint8arrays": "^2.1.10",

yarn.lock

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6494,14 +6494,12 @@
64946494
dependencies:
64956495
antlr4ts "^0.5.0-alpha.4"
64966496

6497-
"@spruceid/siwe-parser@2.0.0":
6498-
version "2.0.0"
6499-
resolved "https://registry.yarnpkg.com/@spruceid/siwe-parser/-/siwe-parser-2.0.0.tgz#fb316b9115e9116bac528c5cbfed18787119bede"
6500-
integrity sha512-zXlPBRKaT9ecxhhLQqn/StAWlXvQBlFDFnIAlM7ceMVx/1NVZZ65GdW9A28tYGbhpesYxNYpsqegGsBcrWuASg==
6497+
"@spruceid/siwe-parser@^1.1.3":
6498+
version "1.1.3"
6499+
resolved "https://registry.yarnpkg.com/@spruceid/siwe-parser/-/siwe-parser-1.1.3.tgz#0eebe8bbd63c6de89cb44c06b6329b00b305df65"
6500+
integrity sha512-oQ8PcwDqjGWJvLmvAF2yzd6iniiWxK0Qtz+Dw+gLD/W5zOQJiKIUXwslHOm8VB8OOOKW9vfR3dnPBhHaZDvRsw==
65016501
dependencies:
65026502
apg-js "^4.1.1"
6503-
uri-js "^4.4.1"
6504-
valid-url "^1.0.9"
65056503

65066504
"@stablelib/aead@^1.0.1":
65076505
version "1.0.1"
@@ -31238,15 +31236,14 @@ sisteransi@^1.0.5:
3123831236
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
3123931237
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==
3124031238

31241-
siwe@^2.0.1:
31242-
version "2.0.1"
31243-
resolved "https://registry.yarnpkg.com/siwe/-/siwe-2.0.1.tgz#4c1c6762bf39a3100fee882c59a2114c525adc47"
31244-
integrity sha512-4zMQZSR9pp3BR7w8c8N/ofGI71QIVK2a1+cyBzkPNWr0/DV9APmRFdZtg0lkiEemGCFtFyTy/h6f90tG/GFH5w==
31239+
siwe@^1.1.6:
31240+
version "1.1.6"
31241+
resolved "https://registry.yarnpkg.com/siwe/-/siwe-1.1.6.tgz#b4b4fe7814654d5ea529171b2ede15f7ef7ef1ae"
31242+
integrity sha512-3WRdEil32Tc2vuNzqJ2/Z/MIvsvy0Nkzc2ov+QujmpHO7tM83dgcb47z0Pu236T4JQkOQCqQkq3AJ/rVIezniA==
3124531243
dependencies:
31246-
"@spruceid/siwe-parser" "2.0.0"
31244+
"@spruceid/siwe-parser" "^1.1.3"
3124731245
"@stablelib/random" "^1.0.1"
31248-
uri-js "^4.4.1"
31249-
valid-url "^1.0.9"
31246+
apg-js "^4.1.1"
3125031247

3125131248
size-limit@^6.0.1:
3125231249
version "6.0.4"
@@ -34218,7 +34215,7 @@ upper-case@^2.0.2:
3421834215
dependencies:
3421934216
tslib "^2.0.3"
3422034217

34221-
uri-js@^4.2.2, uri-js@^4.4.1:
34218+
uri-js@^4.2.2:
3422234219
version "4.4.1"
3422334220
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
3422434221
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==

0 commit comments

Comments
 (0)