Skip to content

Commit ff763e8

Browse files
authored
Merge pull request #677 from dOrgTech/develop
Merge Develop To Master
2 parents c535061 + 94e414b commit ff763e8

File tree

18 files changed

+302
-330
lines changed

18 files changed

+302
-330
lines changed

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"prepare": "husky install"
1616
},
1717
"dependencies": {
18-
"@airgap/beacon-sdk": "^3.3.0",
18+
"@airgap/beacon-sdk": "^4.0.10",
1919
"@craco/craco": "^7.1.0",
2020
"@date-io/dayjs": "1.x",
2121
"@emotion/react": "^11.10.4",
@@ -27,13 +27,13 @@
2727
"@microsoft/signalr": "^5.0.9",
2828
"@mui/material": "^5.10.6",
2929
"@mui/x-date-pickers": "^5.0.2",
30-
"@taquito/beacon-wallet": "^17.0.0",
31-
"@taquito/signer": "^17.0.0",
32-
"@taquito/taquito": "^17.0.0",
30+
"@taquito/beacon-wallet": "^17.3.1",
31+
"@taquito/signer": "^17.3.1",
32+
"@taquito/taquito": "^17.3.1",
3333
"@taquito/tezbridge-signer": "^14.2.0",
3434
"@taquito/tezbridge-wallet": "^14.2.0",
35-
"@taquito/tzip12": "^17.0.0",
36-
"@taquito/tzip16": "^17.0.0",
35+
"@taquito/tzip12": "^17.3.1",
36+
"@taquito/tzip16": "^17.3.1",
3737
"@types/mixpanel-browser": "^2.35.7",
3838
"@types/prismjs": "^1.26.0",
3939
"@types/react-router-hash-link": "^2.4.5",
@@ -133,4 +133,4 @@
133133
"yarn lint:check"
134134
]
135135
}
136-
}
136+
}

src/modules/lite/creator/components/UploadAvatar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const UploadAvatar: React.FC<any> = ({ setFieldValue, values, disabled })
4242
return (
4343
<AvatarCardContainer container direction={"column"}>
4444
<AvatarBox item>
45-
<Typography color="textSecondary">Avatar</Typography>
45+
<Typography color="textSecondary">Avatar - 5Kb Max</Typography>
4646
</AvatarBox>
4747
<AvatarContainer container item style={{ gap: 28 }} alignItems={"center"} direction={"column"}>
4848
<Grid item>
@@ -66,7 +66,7 @@ export const UploadAvatar: React.FC<any> = ({ setFieldValue, values, disabled })
6666
setAvatarPreview(fileReader.result)
6767
}
6868
}
69-
if (e.target && e.target.files && e.target.files?.length > 0) {
69+
if (e.target && e.target.files && e.target.files?.length > 0 && e.target.files[0].size < 5000) {
7070
fileReader.readAsDataURL(e.target.files[0])
7171
}
7272
}}

src/modules/lite/creator/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,23 +421,25 @@ export const CommunityCreator: React.FC = () => {
421421
}
422422

423423
const resp = await saveLiteCommunity(signature, publicKey, payloadBytes)
424-
424+
const data = await resp.json()
425425
if (resp.ok) {
426426
openNotification({
427-
message: "Community created!",
427+
message: "Community created! Checkout the DAO in explorer page",
428428
autoHideDuration: 3000,
429429
variant: "success"
430430
})
431431
navigate.push("/explorer")
432432
} else {
433+
console.log("Error: ", data.message)
433434
openNotification({
434-
message: "Community could not be created!",
435+
message: data.message,
435436
autoHideDuration: 3000,
436437
variant: "error"
437438
})
438439
return
439440
}
440441
} catch (error) {
442+
console.log("error: ", error)
441443
openNotification({
442444
message: "Community could not be created!",
443445
autoHideDuration: 3000,

src/modules/lite/explorer/components/DaoCardDetail.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ export const DaoCardDetail: React.FC<DaoCardDetailProps> = ({ community, setIsUp
6464
const updateCommunityCount = useCallback(
6565
async (count: number) => {
6666
if (community) {
67-
updateCount(community._id, count)
67+
try {
68+
const resp = await updateCount(community._id, count)
69+
const respData = await resp.json()
70+
71+
if (!resp.ok) {
72+
console.log(respData.message)
73+
}
74+
} catch (error) {
75+
console.log("Error: ", error)
76+
}
6877
}
6978
},
7079
[community]

src/modules/lite/explorer/components/ProposalList.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,38 @@ export const ProposalList: React.FC<{ polls: Poll[]; id: string | undefined; dao
6464

6565
useMemo(() => {
6666
async function getPollToken() {
67-
if (polls && polls.length > 0) {
68-
polls.forEach(async poll => {
69-
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/token/${communityId}`).then(async response => {
70-
if (!response.ok) {
71-
const data = await response.json()
72-
openNotification({
73-
message: data.message,
74-
autoHideDuration: 2000,
75-
variant: "error"
76-
})
67+
try {
68+
if (polls && polls.length > 0) {
69+
polls.forEach(async poll => {
70+
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/token/${communityId}`).then(async response => {
71+
if (!response.ok) {
72+
const data = await response.json()
73+
openNotification({
74+
message: data.message,
75+
autoHideDuration: 2000,
76+
variant: "error"
77+
})
78+
return
79+
}
80+
const record: CommunityToken = await response.json()
81+
if (!record) {
82+
return
83+
}
84+
poll.tokenAddress = record.tokenAddress
85+
poll.tokenSymbol = record.symbol
86+
poll.tokenDecimals = record.decimals
7787
return
78-
}
79-
const record: CommunityToken = await response.json()
80-
if (!record) {
81-
return
82-
}
83-
poll.tokenAddress = record.tokenAddress
84-
poll.tokenSymbol = record.symbol
85-
poll.tokenDecimals = record.decimals
86-
return
88+
})
8789
})
90+
}
91+
} catch (error: any) {
92+
console.log("error: ", error)
93+
openNotification({
94+
message: error.message,
95+
autoHideDuration: 2000,
96+
variant: "error"
8897
})
98+
return
8999
}
90100
}
91101
getPollToken()

src/modules/lite/explorer/hooks/useCommunity.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const useCommunity = (daoId: string, isUpdated?: number) => {
3030
}
3131
setCommunity(record)
3232
})
33-
} catch {
33+
} catch (error) {
34+
console.log("error: ", error)
3435
return
3536
}
3637
}

src/modules/lite/explorer/hooks/useCommunityToken.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@ export const useCommunityToken = (communityId: any) => {
66
const [token, setToken] = useState<CommunityToken>()
77
useEffect(() => {
88
async function fetchToken() {
9-
if (communityId !== undefined) {
10-
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/token/${String(communityId)}`).then(async response => {
11-
if (!response.ok) {
12-
const data = await response.json()
13-
const message = data.message
14-
return message
15-
}
9+
try {
10+
if (communityId !== undefined) {
11+
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/token/${String(communityId)}`).then(async response => {
12+
if (!response.ok) {
13+
const data = await response.json()
14+
const message = data.message
15+
return message
16+
}
1617

17-
const record: CommunityToken = await response.json()
18-
if (!record) {
19-
return
20-
}
18+
const record: CommunityToken = await response.json()
19+
if (!record) {
20+
return
21+
}
2122

22-
setToken(record)
23-
return
24-
})
23+
setToken(record)
24+
return
25+
})
26+
}
27+
} catch (error) {
28+
console.log("error: ", error)
29+
return
2530
}
2631
}
2732
fetchToken()

src/modules/lite/explorer/hooks/useHasVoted.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ export const useHasVoted = (refresh?: number) => {
4242
return
4343
}
4444
)
45-
} catch {
45+
} catch (error) {
46+
console.log("error: ", error)
4647
openNotification({
47-
message: "An error has occurred",
48+
message: "An error has occurred fetching vote status",
4849
autoHideDuration: 2000,
4950
variant: "error"
5051
})

src/modules/lite/explorer/hooks/usePoll.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export const useSinglePoll = (pollId: string | undefined, id?: any, community?:
3838
return
3939
})
4040
} catch (error) {
41-
setPoll(undefined)
41+
console.log("error: ", error)
4242
openNotification({
43-
message: "An error has occurred",
43+
message: "An error has occurred fetching poll",
4444
autoHideDuration: 2000,
4545
variant: "error"
4646
})

src/modules/lite/explorer/hooks/usePollChoices.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,26 @@ export const usePollChoices = (poll: Poll | undefined, refresh?: number) => {
1111

1212
useEffect(() => {
1313
async function fetchChoices() {
14-
if (poll) {
15-
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/choices/${poll._id}/find`).then(async response => {
16-
if (!response.ok) {
17-
const data = await response.json()
18-
openNotification({
19-
message: data.message,
20-
autoHideDuration: 2000,
21-
variant: "error"
22-
})
14+
try {
15+
if (poll) {
16+
await fetch(`${getEnv(EnvKey.REACT_APP_LITE_API_URL)}/choices/${poll._id}/find`).then(async response => {
17+
if (!response.ok) {
18+
const data = await response.json()
19+
openNotification({
20+
message: data.message,
21+
autoHideDuration: 2000,
22+
variant: "error"
23+
})
24+
return
25+
}
26+
const records: Choice[] = await response.json()
27+
setChoices(records)
2328
return
24-
}
25-
const records: Choice[] = await response.json()
26-
setChoices(records)
27-
return
28-
})
29+
})
30+
}
31+
} catch (error) {
32+
console.log("error: ", error)
33+
return
2934
}
3035
}
3136
fetchChoices()

0 commit comments

Comments
 (0)