Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.33.0 #4798

Merged
merged 170 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
1fc1d99
fix/recurring donation amount display
kkatusic Aug 30, 2024
3928ac2
Modify some changes in the lock modal for not started farms
mohammadranjbarz Sep 8, 2024
c4b4150
text change min character count
divine-comedian Sep 9, 2024
a39b561
fix: network modal showing while the page is loading
HrithikSampson Sep 10, 2024
d305aaa
keep the sanctions modal until the page has redirected to all pages
HrithikSampson Sep 10, 2024
7d78930
fix: run linter
HrithikSampson Sep 10, 2024
1ccdbd9
Merge pull request #4695 from Giveth/4673_change_bridge_giv_tokens_color
mohammadranjbarz Sep 10, 2024
b8ef757
adding safe back to connectors
mateodaza Sep 10, 2024
adb612b
Merge pull request #4720 from Giveth/multisig-connection-bug
mateodaza Sep 10, 2024
9020bb9
Merge pull request #4654 from Giveth/fix/donation_amount_display
kkatusic Sep 10, 2024
a6fea23
Modify givbacks page to be compatible with givback v2
mohammadranjbarz Sep 12, 2024
db131da
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix_…
HrithikSampson Sep 12, 2024
69eaf28
fix: multiple donation modal shown together
HrithikSampson Sep 12, 2024
ff6405e
add OFAC Sanction Modal
HrithikSampson Sep 12, 2024
d4d6584
moving from verified to vouches
mateodaza Sep 12, 2024
c263d97
Update ProjectGIVbackToast.tsx
mateodaza Sep 12, 2024
ba8c404
Show allocatedGivTokens in givbacks page
mohammadranjbarz Sep 13, 2024
c2a17b0
Fix build error
mohammadranjbarz Sep 13, 2024
9020f35
Remove console.log
mohammadranjbarz Sep 13, 2024
600b1cf
disabling caching from apolloClient to provide correct boost value fr…
HrithikSampson Sep 16, 2024
c5e8710
first pass text fixes
divine-comedian Sep 16, 2024
9343a9d
Merge branch 'fix-GIVbacks-eligiblity-text' into 4679_modify_givback_…
divine-comedian Sep 16, 2024
5591923
Merge pull request #4739 from Giveth/4679_modify_givback_change_to_be…
divine-comedian Sep 16, 2024
816b59e
added loading spinner and wallet Connect check
lovelgeorge99 Sep 16, 2024
c88579a
clear linting errors
divine-comedian Sep 16, 2024
30879fd
chore: add image for environment and energy
HrithikSampson Sep 17, 2024
3c5d173
to resolve adding wallet to project on creation
HrithikSampson Sep 17, 2024
8a82739
Merge pull request #4744 from Giveth/endaoment_banner
HrithikSampson Sep 17, 2024
050ca02
Merge branch 'develop' into verified-migration
mateodaza Sep 17, 2024
022ace4
Merge branch 'develop' into fix-GIVbacks-eligiblity-text
divine-comedian Sep 17, 2024
f172380
Merge pull request #4742 from Giveth/fix-GIVbacks-eligiblity-text
divine-comedian Sep 17, 2024
395de5d
Merge remote-tracking branch 'origin/develop' into verified-migration
mateodaza Sep 17, 2024
fc54246
Merge pull request #4729 from Giveth/verified-migration
mateodaza Sep 17, 2024
8d20f86
Merge branch 'develop' into fix-tokenBalance-loading
lovelgeorge99 Sep 17, 2024
03db3ac
Merge pull request #4741 from Giveth/fix-tokenBalance-loading
lovelgeorge99 Sep 17, 2024
fedce36
add condition for https://github.com/Giveth/giveth-dapps-v2/issues/4747
divine-comedian Sep 17, 2024
8c775db
decentralized verification QA feedback
mateodaza Sep 18, 2024
8563de6
missing punctuation
divine-comedian Sep 18, 2024
6fa8012
text improvements for givbacks eligible
divine-comedian Sep 18, 2024
b2f516e
capitalization fix
divine-comedian Sep 18, 2024
8ce244d
Update SuccessView.tsx
mateodaza Sep 18, 2024
e0d5be8
Merge branch 'develop' into devouch-feedback
mateodaza Sep 18, 2024
5804966
Merge pull request #4756 from Giveth/devouch-feedback
MohammadPCh Sep 19, 2024
2e783de
add governance section in community
divine-comedian Sep 20, 2024
d502cec
fix; Donate Modals glitching effect
HrithikSampson Sep 21, 2024
edaa8a5
chore: fix build errors
HrithikSampson Sep 21, 2024
34829fe
fix: OFAC Sanction Modal Check
HrithikSampson Sep 21, 2024
984ccbd
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into feat…
HrithikSampson Sep 23, 2024
751a03a
Merge pull request #4738 from Giveth/feat_4724_givpower_so_buggy
HrithikSampson Sep 23, 2024
4d8e054
update translations
MohammadPCh Sep 23, 2024
a719ae6
add best match to EProjectsSortBy
MohammadPCh Sep 23, 2024
8e9d519
add best match to sortMap
MohammadPCh Sep 23, 2024
dca6c01
add best match to sort if there is sort term
MohammadPCh Sep 23, 2024
02e572a
handle sort on search
MohammadPCh Sep 23, 2024
2691a57
Merge pull request #4761 from Giveth/feat/add-best-match-sort-item
MohammadPCh Sep 23, 2024
61a1634
adding underline to copy
mateodaza Sep 23, 2024
d56ab9c
Merge pull request #4762 from Giveth/feedback-after-release-decverifi…
mateodaza Sep 23, 2024
e3c8303
changed mogoDb connection and insertOne method
lovelgeorge99 Sep 23, 2024
3c6e005
fix: coderabbitai suggestions
HrithikSampson Sep 23, 2024
76c0908
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix_…
HrithikSampson Sep 23, 2024
7114135
badge tooltips
mateodaza Sep 23, 2024
f1fe063
manually revet coderabbit suggestions as it is causing glitching again
HrithikSampson Sep 23, 2024
a842504
run linter
HrithikSampson Sep 23, 2024
e803c77
fix: timeout to add check of the modals later
HrithikSampson Sep 24, 2024
fcb8d75
update giveth ui package
MohammadPCh Sep 24, 2024
accfdd1
handle error message
MohammadPCh Sep 24, 2024
bbf99fe
Merge pull request #4769 from Giveth/fix/givbacks-verification-form
MohammadPCh Sep 24, 2024
fcd28df
isGivbackEligible filter
mateodaza Sep 24, 2024
4ed94ba
Merge branch 'develop' into fixes-on-decentralized-verification
mateodaza Sep 24, 2024
928fd41
Merge pull request #4765 from Giveth/fixes-on-decentralized-verification
mateodaza Sep 24, 2024
bc9a866
copy change on metadata title for givbacks form
divine-comedian Sep 24, 2024
ffaa43d
made requested ui changes
lovelgeorge99 Sep 24, 2024
d0eaa92
Merge branch 'develop' of https://github.com/Giveth/giveth-dapps-v2 i…
lovelgeorge99 Sep 24, 2024
8d3a59e
remove empty link and change justifyConent
lovelgeorge99 Sep 24, 2024
ea79fe0
fixed build errors
lovelgeorge99 Sep 24, 2024
6656b03
wrong badge status fix
mateodaza Sep 24, 2024
d556de8
Merge pull request #4774 from Giveth/devouch-last-fix
mateodaza Sep 24, 2024
13938f5
givbacks eligiblity translations
divine-comedian Sep 24, 2024
afa3732
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into develop
divine-comedian Sep 24, 2024
241dbb1
fix: issue 4539, qf shown in donation success page for donations abov…
HrithikSampson Sep 25, 2024
184fe9d
run linter
HrithikSampson Sep 25, 2024
6109061
chore: add catalan translations
HrithikSampson Sep 25, 2024
9d24c23
Merge branch 'develop' of https://github.com/Giveth/giveth-dapps-v2 i…
lovelgeorge99 Sep 25, 2024
3c2bf5b
fixed typo
lovelgeorge99 Sep 25, 2024
4417654
Merge pull request #4764 from Giveth/remove-mongoDB-inserOne
lovelgeorge99 Sep 25, 2024
7392555
Merge branch 'main' into develop
RamRamez Sep 25, 2024
2fe98b6
fix eslint errors
RamRamez Sep 25, 2024
92b64fe
run yarn
RamRamez Sep 25, 2024
51bc941
replace verified with isGivbackEligible
RamRamez Sep 25, 2024
f96d0e8
copy changes
divine-comedian Sep 25, 2024
592b467
Merge pull request #4782 from Giveth/merge-main-2-develop
RamRamez Sep 25, 2024
3da468b
fixing givback eligibility form
mateodaza Sep 26, 2024
5b7467f
Merge pull request #4784 from Giveth/deverification-givbacks-form
mateodaza Sep 26, 2024
e3e6970
Add mainnet and sepolia to network selector
mohammadranjbarz Sep 26, 2024
a12b027
Merge pull request #4786 from Giveth/add_mainnet_to_network_Selector
mohammadranjbarz Sep 26, 2024
b9e5907
Hide giv power rank in not givback eligible projects
mohammadranjbarz Sep 26, 2024
c6711da
Fix lint errors
mohammadranjbarz Sep 26, 2024
79e3066
add types to apolloClient
MohammadPCh Sep 26, 2024
75b5ae7
add DELETE_DRAFT_PROJECT
MohammadPCh Sep 26, 2024
7436b76
init handleRemoveProject
MohammadPCh Sep 26, 2024
3122236
separate fetchUserProjects as a service
MohammadPCh Sep 26, 2024
56a0dd6
use react query for fetching proejcts
MohammadPCh Sep 26, 2024
e48a477
add userProjectsPerPage
MohammadPCh Sep 26, 2024
ccd1255
delete project
MohammadPCh Sep 26, 2024
8bf50df
fix project card style
MohammadPCh Sep 26, 2024
73c22b4
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix_…
HrithikSampson Sep 26, 2024
d0ba7ce
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix_…
HrithikSampson Sep 26, 2024
969417a
run linter:
HrithikSampson Sep 26, 2024
db71b97
Merge pull request #4788 from Giveth/3667_hide_givpower_rank_for_not_…
mohammadranjbarz Sep 26, 2024
593d3d4
fix: for non-endaoment project modal
HrithikSampson Sep 26, 2024
c7854e2
run linter
HrithikSampson Sep 26, 2024
3b90b81
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix_…
HrithikSampson Sep 26, 2024
2feb18e
Merge pull request #4711 from Giveth/fix_issue_4449_network_modal
HrithikSampson Sep 26, 2024
315e949
add @tanstack/react-query-devtools
MohammadPCh Sep 26, 2024
b781b06
move types to type
MohammadPCh Sep 26, 2024
69cf94e
move projectsOrder to constants
MohammadPCh Sep 26, 2024
e8eb28c
add fetch policy to fetchUserProjects
MohammadPCh Sep 26, 2024
84cda35
delete project and update projects
MohammadPCh Sep 26, 2024
cfdd496
Merge branch 'develop' into deverification-fixes-laurensfeedback
divine-comedian Sep 26, 2024
19de1b4
fix missing translation in catalan
divine-comedian Sep 26, 2024
12045c5
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into 4539…
HrithikSampson Sep 26, 2024
41a5a30
typos on GIVbacks
divine-comedian Sep 26, 2024
a38210b
Update VerificationBadge.tsx
mateodaza Sep 26, 2024
4f8fb2c
Merge pull request #4791 from Giveth/admin-actions-bug
mateodaza Sep 26, 2024
00459c3
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into 4539…
HrithikSampson Sep 27, 2024
9643a5e
final touches on logic mess
mateodaza Sep 27, 2024
91956a3
Merge pull request #4792 from Giveth/admin-actions-fix-2
mateodaza Sep 27, 2024
204517b
fix copy
divine-comedian Sep 27, 2024
dd33339
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into develop
divine-comedian Sep 27, 2024
42ab80e
Merge branch 'develop' into feat/delete-draft-projec
MohammadPCh Sep 28, 2024
c7902d6
update projects count
MohammadPCh Sep 28, 2024
c4cec86
remove comment
MohammadPCh Sep 28, 2024
b8891aa
fix loading
MohammadPCh Sep 28, 2024
2527b3f
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into 4539…
HrithikSampson Sep 30, 2024
3b54119
Merge pull request #4775 from Giveth/4539_user_donates_less_than_mini…
HrithikSampson Sep 30, 2024
90a6c55
fix comments
divine-comedian Sep 30, 2024
3ce892c
Merge branch 'develop' into deverification-fixes-laurensfeedback
divine-comedian Sep 30, 2024
e0d4ab0
Merge branch 'main' into develop
MohammadPCh Oct 1, 2024
57e5558
update version
MohammadPCh Oct 1, 2024
274f6b8
update packages
MohammadPCh Oct 1, 2024
7190a01
Revert "fix: issue 4539, qf shown in donation success page for estima…
HrithikSampson Oct 1, 2024
8054945
Merge branch 'develop' into fix-ui-issues#4726
lovelgeorge99 Oct 1, 2024
a993921
update imports
MohammadPCh Oct 1, 2024
1d559c8
fix prettier
MohammadPCh Oct 1, 2024
78554a2
Merge branch 'main' into develop
MohammadPCh Oct 1, 2024
3ae4467
Merge branch 'develop' into release-2.33.0
MohammadPCh Oct 1, 2024
a54076c
Merge pull request #4799 from Giveth/revert-4775-4539_user_donates_le…
MohammadPCh Oct 1, 2024
9e9582c
Merge branch 'develop' into release-2.33.0
MohammadPCh Oct 1, 2024
9368772
update translations
MohammadPCh Oct 1, 2024
a5c7688
Merge branch 'develop' into fix-ui-issues#4726
lovelgeorge99 Oct 1, 2024
14c4b07
Merge pull request #4793 from Giveth/feat/delete-draft-projec
MohammadPCh Oct 1, 2024
00a3627
Merge pull request #4790 from Giveth/deverification-fixes-laurensfeed…
divine-comedian Oct 1, 2024
bfa59fa
Merge branch 'develop' into fix-ui-issues#4726
lovelgeorge99 Oct 1, 2024
a3fc152
Merge pull request #4771 from Giveth/fix-ui-issues#4726
lovelgeorge99 Oct 1, 2024
2bcbfe0
final touches on logic mess
mateodaza Sep 27, 2024
e2ae6be
added qfEligible icons
lovelgeorge99 Oct 1, 2024
ac02e2d
Merge branch 'develop' into add-qfEligible-icons
lovelgeorge99 Oct 1, 2024
3af9de8
Merge remote-tracking branch 'origin/develop' into release-2.33.0
mateodaza Oct 1, 2024
db0cc6f
build errors
mateodaza Oct 1, 2024
a9c8be3
Update QFDonorEligibilityCard.tsx
mateodaza Oct 1, 2024
76f1130
Merge pull request #4804 from Giveth/add-qfEligible-icons
lovelgeorge99 Oct 2, 2024
f6ab0a9
Merge branch 'develop' into release-2.33.0
MohammadPCh Oct 2, 2024
9e24079
fix network issue
HrithikSampson Oct 2, 2024
397f061
Merge branch 'develop' of github.com:Giveth/giveth-dapps-v2 into fix-…
HrithikSampson Oct 2, 2024
cfd786f
run linter
HrithikSampson Oct 2, 2024
4692a2e
Merge pull request #4807 from Giveth/fix-network-modal-issue
MohammadPCh Oct 2, 2024
30c10dc
Merge branch 'develop' into release-2.33.0
MohammadPCh Oct 2, 2024
759740e
Update VerificationBadge.tsx
mateodaza Oct 2, 2024
0219db6
Merge pull request #4811 from Giveth/verification--badge-fix
mateodaza Oct 2, 2024
008ddb3
Merge branch 'main' into release-2.33.0
mateodaza Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 67 additions & 62 deletions lang/ca.json

Large diffs are not rendered by default.

150 changes: 77 additions & 73 deletions lang/en.json

Large diffs are not rendered by default.

132 changes: 70 additions & 62 deletions lang/es.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion lang/t_ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
"page.project.preview_hint": "Aquesta és una previsualització del teu projecte.",
"project.givback_toast.description.non_verified_owner": "Pots demostrar que el teu projecte està proporcionant un bé públic? La verificació et dóna accés a una gran quantitat de beneficis com recompenses per a donants, major visibilitat i formes addicionals d'obtenir fons!",
"project.givback_toast.description.non_verified_public": "Actualment, els GIVbacks només es concedeixen per donacions fetes a projectes verificats. La teva contribució encara és important, encara que no generi GIVbacks!",
"project.givback_toast.description.verified_owner": "Impulsa el teu projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!",
"project.givback_toast.description.verified_public": "Els donants de projectes verificats són recompensats amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!",
"project.givback_toast.title.non_verified_owner": "Porta el teu projecte al següent nivell amb la Verificació!",
"project.givback_toast.title.non_verified_public": "Per què no hi ha GIVbacks?",
Expand Down
1 change: 0 additions & 1 deletion lang/t_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@
"page.project.preview_hint": "Esta es una vista previa de tu proyecto.",
"project.givback_toast.description.non_verified_owner": "¿Puedes demostrar que tu proyecto está proporcionando un bien público? ¡La verificación te da acceso a una gran cantidad de beneficios como recompensas para los donantes, mayor visibilidad y formas adicionales de recaudar fondos!",
"project.givback_toast.description.non_verified_public": "Los GIVbacks se otorgan actualmente solo por donaciones realizadas a proyectos verificados. ¡Tu contribución sigue siendo importante, incluso si no genera GIVbacks!",
"project.givback_toast.description.verified_owner": "¡Impulsa tu proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!",
"project.givback_toast.description.verified_public": "Los donantes a proyectos verificados son recompensados con GIV. ¡Impulsa este proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!",
"project.givback_toast.title.non_verified_owner": "¡Lleva tu proyecto al siguiente nivel con la Verificación!",
"project.givback_toast.title.non_verified_public": "¿Por qué no hay GIVbacks?",
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const moduleExports = withBundleAnalyzer({
{ protocol: 'https', port: '', hostname: 'images.unsplash.com' },
{ protocol: 'https', port: '', hostname: 'unicorn.mypinata.cloud' },
{ protocol: 'https', port: '', hostname: 'images.ctfassets.net' },
{ protocol: 'https', port: '', hostname: 'giveth.io' },
{
protocol: 'https',
port: '',
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "givethdapp",
"version": "2.32.2",
"version": "2.33.0",
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -17,7 +17,7 @@
"@types/react-dom": "^18.0.6"
},
"dependencies": {
"@apollo/client": "^3.10.4",
"@apollo/client": "^3.11.8",
"@giveth/ui-design-system": "^1.11.36",
"@next/third-parties": "^14.2.5",
"@react-google-maps/api": "^2.19.3",
Expand Down Expand Up @@ -45,7 +45,8 @@
"graphql": "^16.8.1",
"lodash.isequal": "^4.5.0",
"lottie-react": "^2.4.0",
"next": "^14.2.3",
"mongodb": "6.9.0",
"next": "^14.2.13",
"nprogress": "^0.2.0",
"posthog-js": "^1.147.0",
"qrcode": "^1.5.3",
Expand All @@ -71,12 +72,13 @@
"styled-components": "^6.1.12",
"swiper": "^11.1.3",
"unsplash-js": "^7.0.19",
"viem": "^2.16.1",
"wagmi": "^2.12.10"
"viem": "^2.21.16",
"wagmi": "^2.12.16"
},
"devDependencies": {
"@babel/preset-typescript": "^7.23.3",
"@next/bundle-analyzer": "^14.1.0",
"@tanstack/react-query-devtools": "^5.58.0",
"@testing-library/cypress": "^10.0.1",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
Expand Down
62 changes: 23 additions & 39 deletions pages/api/donation-backup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { captureException } from '@sentry/nextjs';
import { getNowUnixMS } from '@/helpers/time';
import { SENTRY_URGENT } from '@/configuration';
import { getMongoDB } from '@/lib/mongoDb/db';

const handler = (req, res) => {
const handler = async (req, res) => {
const { body, method, headers } = req;
const now = getNowUnixMS();
body.saveTimestamp = now;
Expand All @@ -13,46 +14,29 @@ const handler = (req, res) => {
}
try {
if (method === 'POST') {
fetch(process.env.MONGO_DONATION_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Request-Headers': '*',
'api-key': process.env.MONGO_DONATION_API_KEY,
},
body: JSON.stringify({
collection: process.env.MONGO_DONATION_COLLECTION,
database: process.env.MONGO_DONATION_DATABASE,
dataSource: process.env.MONGO_DONATION_DATA_SOURCE,
document: body,
}),
})
.then(response => response.json())
.then(data => {
console.log(data);
res.status(200).json({
message: 'Successfully saved',
id: data.insertedId,
});
})
.catch(error => {
captureException(
{
data: body,
authorization: headers.authorization,
error,
},
{
tags: {
section: SENTRY_URGENT,
},
},
);
res.status(200).json('Sent to sentry');
});
console.log('body', body);
const db = await getMongoDB();
const response = await db.collection('failed_donation').insertOne({
...body,
});
res.status(200).json({
message: 'Successfully saved',
id: response.insertedId,
});
}
} catch (error) {
console.log('Error in saving donation to DB', error);
captureException(
{
data: body,
authorization: headers.authorization,
error,
},
{
tags: {
section: SENTRY_URGENT,
},
},
);
res.status(500).json();
}
};
Expand Down
2 changes: 1 addition & 1 deletion pages/verification/[slug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const VerificationRoute = () => {
return (
<VerificationProvider>
<Head>
<title>Verify a Project | Giveth</title>
<title>GIVbacks Eligibility Application | Giveth</title>
</Head>
<VerificationIndex />
</VerificationProvider>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 37 additions & 13 deletions src/apollo/apolloClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { useMemo } from 'react';
import { ApolloClient, InMemoryCache, ApolloLink } from '@apollo/client';
import {
ApolloClient,
InMemoryCache,
ApolloLink,
NormalizedCacheObject,
} from '@apollo/client';
import { RetryLink } from '@apollo/client/link/retry';
import { setContext } from '@apollo/client/link/context';
import { onError } from '@apollo/client/link/error';
Expand All @@ -14,20 +19,21 @@ import { signOut } from '@/features/user/user.thunks';
import config from '@/configuration';
import { setShowSignWithWallet } from '@/features/modal/modal.slice';

let apolloClient: any;
let apolloClient: ApolloClient<NormalizedCacheObject> | undefined;

const ssrMode = isSSRMode;

export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__';

const parseHeaders = (rawHeaders: any) => {
// Parses headers into the Headers object
const parseHeaders = (rawHeaders: string) => {
const headers = new Headers();
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
// https://tools.ietf.org/html/rfc7230#section-3.2
const preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
preProcessedHeaders.split(/\r?\n/).forEach((line: any) => {
preProcessedHeaders.split(/\r?\n/).forEach((line: string) => {
const parts = line.split(':');
const key = parts.shift().trim();
const key = parts.shift()?.trim();
if (key) {
const value = parts.join(':').trim();
headers.append(key, value);
Expand All @@ -36,6 +42,7 @@ const parseHeaders = (rawHeaders: any) => {
return headers;
};

// Custom fetch logic with file upload handling
const uploadFetch = (url: string, options: any) =>
new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
Expand All @@ -49,8 +56,11 @@ const uploadFetch = (url: string, options: any) =>
'responseURL' in xhr
? xhr.responseURL
: opts.headers.get('X-Request-URL');
// TypeScript fix: Explicitly cast `xhr` to `XMLHttpRequest` to access responseText
const body =
'response' in xhr ? xhr.response : (xhr as any).responseText;
'response' in xhr
? xhr.response
: (xhr as XMLHttpRequest).responseText;
resolve(new Response(body, opts));
};
xhr.onerror = () => {
Expand All @@ -76,26 +86,30 @@ const uploadFetch = (url: string, options: any) =>
xhr.send(options.body);
});

const customFetch = (uri: any, options: any) => {
// Custom fetch function to determine when to use upload fetch or standard fetch
const customFetch = (uri: string, options: any) => {
if (options.useUpload) {
return uploadFetch(uri, options);
}
return fetch(uri, options);
};

function createApolloClient() {
// Creates the Apollo Client with the custom link setup
function createApolloClient(): ApolloClient<NormalizedCacheObject> {
let userWalletAddress: string | null;
if (!ssrMode) {
userWalletAddress = localStorage.getItem(StorageLabel.USER);
}

const retryLink = new RetryLink();

// Custom link for handling file uploads
const httpLink = createUploadLink({
uri: config.BACKEND_LINK,
fetch: customFetch as any,
});

// Auth link to add Authorization and locale headers
const authLink = setContext((_, { headers }) => {
let locale: string | null = !ssrMode
? localStorage.getItem(StorageLabel.LOCALE)
Expand All @@ -117,12 +131,13 @@ function createApolloClient() {
};
});

// Error handling link
const errorLink = onError(({ graphQLErrors, networkError, operation }) => {
if (graphQLErrors) {
console.log('operation', operation);
graphQLErrors.forEach(err => {
console.error('err', JSON.stringify(err));
const { message, locations, path } = err;
const { message } = err;
if (message.toLowerCase().includes('authentication required')) {
console.log(Date.now(), 'sign out from graphQL');
// removes token and user from store
Expand Down Expand Up @@ -190,7 +205,10 @@ function createApolloClient() {
});
}

export function initializeApollo(initialState = null) {
// Initialize Apollo Client for SSR and client-side rendering
export function initializeApollo(
initialState: any = null,
): ApolloClient<NormalizedCacheObject> {
const _apolloClient = apolloClient ?? createApolloClient();

// If your page has Next.js data fetching methods that use Apollo Client, the initial state
Expand All @@ -202,7 +220,7 @@ export function initializeApollo(initialState = null) {
// Merge the existing cache into data passed from getStaticProps/getServerSideProps
const data = merge(initialState, existingCache, {
// combine arrays using object equality (like in sets)
arrayMerge: (destinationArray, sourceArray) => [
arrayMerge: (destinationArray: any[], sourceArray: any[]) => [
...sourceArray,
...destinationArray.filter(d =>
sourceArray.every(s => !isEqual(d, s)),
Expand All @@ -221,18 +239,24 @@ export function initializeApollo(initialState = null) {
return _apolloClient;
}

export function addApolloState(client: any, pageProps: any) {
// Adds Apollo Client's state to pageProps
export function addApolloState(
client: ApolloClient<NormalizedCacheObject>,
pageProps: any,
) {
if (pageProps?.props) {
pageProps.props[APOLLO_STATE_PROP_NAME] = client.cache.extract();
}

return pageProps;
}

// Custom React hook to use Apollo Client
export function useApollo(pageProps: any) {
const state = pageProps[APOLLO_STATE_PROP_NAME];

return useMemo(() => initializeApollo(state), [state]);
}

export const client = initializeApollo();
// Export the client instance
export const client: ApolloClient<NormalizedCacheObject> = initializeApollo();
10 changes: 10 additions & 0 deletions src/apollo/gql/gqlProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const PROJECT_CORE_FIELDS = gql`
image
slug
verified
isGivbackEligible
totalDonations
qfRounds {
id
Expand Down Expand Up @@ -142,6 +143,7 @@ export const FETCH_PROJECT_BY_SLUG_DONATION = gql`
slug
descriptionSummary
verified
isGivbackEligible
totalDonations
sumDonationValueUsdForActiveQfRound
countUniqueDonorsForActiveQfRound
Expand Down Expand Up @@ -211,6 +213,7 @@ export const FETCH_PROJECT_BY_SLUG_SINGLE_PROJECT = gql`
image
slug
verified
isGivbackEligible
totalDonations
description
addresses {
Expand Down Expand Up @@ -595,6 +598,7 @@ export const ADD_RECIPIENT_ADDRESS_TO_PROJECT = gql`
listed
reviewStatus
verified
isGivbackEligible
slugHistory
creationDate
adminUserId
Expand Down Expand Up @@ -800,3 +804,9 @@ export const FETCH_RECURRING_DONATIONS_BY_DATE = gql`
}
}
`;

export const DELETE_DRAFT_PROJECT = gql`
mutation ($projectId: Float!) {
deleteDraftProject(projectId: $projectId)
}
`;
1 change: 1 addition & 0 deletions src/apollo/types/gqlEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum EProjectsSortBy {
INSTANT_BOOSTING = 'InstantBoosting',
ActiveQfRoundRaisedFunds = 'ActiveQfRoundRaisedFunds',
EstimatedMatching = 'EstimatedMatching',
BestMatch = 'BestMatch',
}

export enum EQFRoundsSortBy {
Expand Down
3 changes: 3 additions & 0 deletions src/apollo/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface IProject {
impactLocation?: string;
qualityScore?: number;
verified?: boolean;
isGivbackEligible?: boolean;
verificationStatus?: EProjectVerificationStatus;
listed?: boolean | null;
categories: ICategory[];
Expand Down Expand Up @@ -88,6 +89,7 @@ export interface IProject {
export enum EProjectsFilter {
ACCEPT_GIV = 'AcceptGiv',
VERIFIED = 'Verified',
IS_GIVBACK_ELIGIBLE = 'IsGivbackEligible',
BOOSTED_WITH_GIVPOWER = 'BoostedWithGivPower',
GIVING_BLOCK = 'GivingBlock',
Endaoment = 'Endaoment',
Expand All @@ -114,6 +116,7 @@ export enum ECampaignType {

export enum ECampaignFilterField {
Verified = 'verified',
IsGivbackEligible = 'isGivbackEligible',
AcceptGiv = 'givingBlocksId',
GivingBlock = 'fromGivingBlock',
Endaoment = 'fromEndaoment',
Expand Down
2 changes: 1 addition & 1 deletion src/components/DonateSocialBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface ISocialBox {
const DonateSocialBox: FC<ISocialBox> = props => {
const [showModal, setShowModal] = useState<boolean>(false);
const { project, isDonateFooter } = props;
const { slug, verified } = project;
const { slug } = project;
const { isMobile } = useDetectDevice();
const { formatMessage } = useIntl();
const { isActive } = useProjectContext();
Expand Down
Loading
Loading