Skip to content

Commit

Permalink
Merge pull request #2955 from Giveth/hotfix-2.17.1
Browse files Browse the repository at this point in the history
Hotfix 2.17.1
  • Loading branch information
MohammadPCh authored Jul 18, 2023
2 parents 8757471 + b8299fb commit 2105657
Show file tree
Hide file tree
Showing 19 changed files with 406 additions and 353 deletions.
326 changes: 156 additions & 170 deletions lang/ca.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"community": "Community",
"community_desc": "Support community projects with a focus on grassroots initiatives, housing, inclusion, social services, water & santitation, family & children and more.",
"component.archive_cover.archived": "ARCHIVED",
"component.button.activate_project": "ACTIVATE PROJECT",
"component.button.complete_profile": "COMPLETE PROFILE",
"component.button.connect_wallet": "Connect Wallet",
"component.button.create_project": "CREATE A PROJECT",
Expand Down Expand Up @@ -98,7 +97,7 @@
"label.about": "About",
"label.accepts_funds_on": "Accepts funds on",
"label.actions": "Actions",
"label.activate_project": "ACTIVATE PROJECT",
"label.activate_project": "Activate project",
"label.activity_and_milestones": "Goals, Activities and Impact",
"label.add_address": "Add address",
"label.add_an_image_to_your_project": "Add an image to your project",
Expand Down Expand Up @@ -221,6 +220,7 @@
"label.connect_your_wallet_or_check_an_eth_address": "Connect your wallet or check an ethereum address to see your rewards. Ends December 24, 2022.",
"label.connet_your_wallet_and_sign_in_to_get_your_referral": "Connect your wallet and sign in to get your <strong>referral link</strong> and start earning.",
"label.continue": "Continue",
"label.continue_creation": "Continue Creation",
"label.continue_verification": "Continue verification",
"label.continue_with_donorbox": "Continue with Donorbox",
"label.contract": "Contract",
Expand Down Expand Up @@ -594,7 +594,7 @@
"label.our_vision.desc": "Giving is effortless and people all around the world are rewarded for creating positive change.",
"label.overview": "Overview",
"label.participate_in_giveth_governance_using_the": "Participate in Giveth governance using the",
"label.passport.eligible": "You donations are eligible to be matched!",
"label.passport.eligible": "Your donations are eligible to be matched!",
"label.passport.ended": "This round has ended. Thank you for your support.",
"label.passport.error": "An error occurred while loading your Gitcoin Passport. Please try again later.",
"label.passport.invalid": "Passport Profile not detected. Please open Passport to troubleshoot.",
Expand Down Expand Up @@ -934,7 +934,7 @@
"label.verify_your_project.modal.two": "This simple ",
"label.view": "View",
"label.view_more": "View more",
"label.view_on_etherscan": "View on Etherscan",
"label.view_on_block_explorer": "View on block explorer",
"label.view_project": "View Project",
"label.view_projects": "View Projects",
"label.view_similar_projects": "View similar projects",
Expand Down Expand Up @@ -1072,7 +1072,7 @@
"page.donate.bank_fees": "Bank Fees",
"page.donate.matching_toast.bottom": "Matching funds will be sent to the selected project after the round ends.",
"page.donate.matching_toast.upper": "Estimated matching",
"page.donate.passport_toast.description.eligible": "Your donation is eligible to be matched! After QF Round",
"page.donate.passport_toast.description.eligible": "Your donation is eligible to be matched! After the",
"page.donate.passport_toast.description.eligible_2": ", all donations will be reviewed for fraud protection and matching funds will be sent to the projects. Stay tuned for notifications :)",
"page.donate.passport_toast.description.non_eligible": "Get your donation matched with quadratic funding!\nIncrease your Gitcoin Passport score before",
"page.donate.passport_toast.description.not_connected": "Get your donation matched with quadratic funding!\nVerify your Gitcoin Passport before",
Expand Down
259 changes: 123 additions & 136 deletions lang/es.json

Large diffs are not rendered by default.

44 changes: 35 additions & 9 deletions lang/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,58 @@ function sort(data) {
return Object.fromEntries(dataArray);
}

function addMissingKeys(obj1, obj2) {
const newObj = { ...obj2 }; // Create a new object to avoid modifying obj2 directly
function addMissingKeys(obj) {
const newObj = { ...obj }; // Create a new object to avoid modifying obj directly

for (let key in obj1) {
if (obj1.hasOwnProperty(key) && !obj2.hasOwnProperty(key)) {
newObj[key] = '';
for (let key in en) {
if (en.hasOwnProperty(key) && !obj.hasOwnProperty(key)) {
newObj[key] = en[key];
}
}

return newObj;
}

function fillEmptyValues(obj) {
for (let key in obj) {
if (obj.hasOwnProperty(key) && obj[key] === '') {
obj[key] = en[key];
}
}

return obj;
}

function save(obj, name) {
// Write the sorted data back to the JSON file
fs.writeFileSync(name, JSON.stringify(obj, null, 2));

console.log('Saving completed!');
}

const updatedEs = addMissingKeys(en, es);
const updatedCa = addMissingKeys(en, ca);
function removeExtraKeys(obj) {
const newObj = {}; // Create a new object to avoid modifying obj directly
for (let key in obj) {
if (obj.hasOwnProperty(key) && en[key]) {
newObj[key] = obj[key];
}
}
return newObj;
}

const filteredEs = removeExtraKeys(es);
const filteredCa = removeExtraKeys(ca);

const updatedEs = addMissingKeys(filteredEs);
const updatedCa = addMissingKeys(filteredCa);

const sortedEn = sort(en);
const sortedEs = sort(updatedEs);
const sortedCa = sort(updatedCa);

const filledEs = fillEmptyValues(sortedEs);
const filledCa = fillEmptyValues(sortedCa);

save(sortedEn, 'en.json');
save(sortedEs, 'es.json');
save(sortedCa, 'ca.json');
save(filledEs, 'es.json');
save(filledCa, 'ca.json');
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "givethdapp",
"version": "2.17.0",
"version": "2.17.1",
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -21,7 +21,7 @@
"@ethersproject/contracts": "^5.5.0",
"@ethersproject/providers": "^5.5.0",
"@ethersproject/units": "^5.5.0",
"@giveth/ui-design-system": "^1.11.12",
"@giveth/ui-design-system": "^1.11.13",
"@gnosis.pm/safe-apps-web3-react": "^1.5.0",
"@reduxjs/toolkit": "^1.8.1",
"@segment/snippet": "^4.15.3",
Expand Down
Binary file removed public/images/banners/qfSponsors.png
Binary file not shown.
Binary file added public/images/banners/qfSponsors.webp
Binary file not shown.
5 changes: 5 additions & 0 deletions src/components/PassportBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export const PassportBannerData: IData = {
bg: EPBGState.ERROR,
icon: <IconAlertTriangleFilled24 color={semanticColors.punch[500]} />,
},
[EPassportState.NOT_STARTED]: {
content: 'label.passport.no_active_round',
bg: EPBGState.INFO,
icon: <IconAlertTriangleFilled24 color={semanticColors.golden[500]} />,
},
[EPassportState.NOT_ACTIVE_ROUND]: {
content: 'label.passport.no_active_round',
bg: EPBGState.INFO,
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/DonateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ const DonateModal: FC<IDonateModalProps> = props => {
firstTxHash,
)}
title={formatMessage({
id: 'label.view_on_etherscan',
id: 'label.view_on_block_explorer',
})}
color={brandColors.pinky[500]}
/>
Expand Down Expand Up @@ -338,7 +338,7 @@ const DonateModal: FC<IDonateModalProps> = props => {
secondTxHash,
)}
title={formatMessage({
id: 'label.view_on_etherscan',
id: 'label.view_on_block_explorer',
})}
color={brandColors.pinky[500]}
/>
Expand Down
9 changes: 8 additions & 1 deletion src/components/modals/FailedDonation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FC } from 'react';
import { Lead, semanticColors } from '@giveth/ui-design-system';
import styled from 'styled-components';
import Image from 'next/image';
import { useIntl } from 'react-intl';
import { Modal } from '@/components/modals/Modal';
import { mediaQueries } from '@/lib/constants/constants';
import { FlexCenter } from '@/components/styled-components/Flex';
Expand All @@ -25,6 +26,7 @@ interface IProps extends IModal {

const FailedDonation: FC<IProps> = ({ setShowModal, txUrl, type }) => {
const { isAnimating, closeModal } = useModalAnimation(setShowModal);
const { formatMessage } = useIntl();

const messageContent = () => {
switch (type) {
Expand Down Expand Up @@ -70,7 +72,12 @@ const FailedDonation: FC<IProps> = ({ setShowModal, txUrl, type }) => {
<Container>
<Content>{messageContent()}</Content>
{txUrl && (
<ExternalLink href={txUrl} title='View on Etherscan' />
<ExternalLink
href={txUrl}
title={formatMessage({
id: 'label.view_on_block_explorer',
})}
/>
)}
</Container>
</Modal>
Expand Down
13 changes: 8 additions & 5 deletions src/components/views/create/SuccessfulCreation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ const SuccessfulCreation = (props: {
id: 'label.your_project_is_being_reviewed',
})}
</SuccessMessage>
<CopyLink url={fullPath(projectPath)} />
<br />
<br />
<br />
<CopyBox>
<CopyLink url={fullPath(projectPath)} />
</CopyBox>
<SocialBox
project={project}
contentType={EContentType.ourProject}
Expand Down Expand Up @@ -115,7 +114,7 @@ const Wrapper = styled.div`
`;
const ContainerStyled = styled(Container)`
text-align: center;
padding-top: 214px;
padding-top: 114px;
> img:first-child {
top: 0;
right: 20px;
Expand Down Expand Up @@ -153,4 +152,8 @@ const ProjectsButton = styled(Button)`
margin: 20px auto;
`;

const CopyBox = styled.div`
max-height: 100px;
`;

export default SuccessfulCreation;
4 changes: 2 additions & 2 deletions src/components/views/donate/DonateIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ import { FlexCenter } from '@/components/styled-components/Flex';
const DonateIndex: FC = () => {
const { formatMessage } = useIntl();
const { isMobile } = useDetectDevice();
const { project, isSuccessDonation } = useDonateData();
const { project, isSuccessDonation, hasActiveQFRound } = useDonateData();
const { txHash = [] } = isSuccessDonation || {};
const hasMultipleTxs = txHash.length > 1;

return (
<>
<BigArc />
<PassportBanner />
{hasActiveQFRound && <PassportBanner />}
<Wrapper>
{/* <PurchaseXDAI /> */}
<NiceBanner />
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/donate/QFToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const QFToast = () => {
});

let description;
const roundNumber = currentRound?.id;
const endDate = new Date(currentRound?.endDate || '')
.toLocaleString(locale || 'en-US', {
day: 'numeric',
Expand All @@ -46,7 +45,7 @@ const QFToast = () => {
id: 'page.donate.passport_toast.description.eligible',
}) +
' ' +
roundNumber +
currentRound?.name +
' ' +
formatMessage({
id: 'label.ends_on',
Expand Down
24 changes: 24 additions & 0 deletions src/components/views/project/ProjectIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import {
Container,
neutralColors,
semanticColors,
Button,
} from '@giveth/ui-design-system';
import styled from 'styled-components';
import { Col, Row } from '@giveth/ui-design-system';

import { useIntl } from 'react-intl';
import { Flex } from '@/components/styled-components/Flex';
import ProjectHeader from './ProjectHeader';
import ProjectTabs from './ProjectTabs';
import InfoBadge from '@/components/badges/InfoBadge';
Expand All @@ -20,6 +22,7 @@ import SuccessfulCreation from '@/components/views/create/SuccessfulCreation';
import InlineToast, { EToastType } from '@/components/toasts/InlineToast';
import SimilarProjects from '@/components/views/project/SimilarProjects';
import { isSSRMode } from '@/lib/helpers';
import { idToProjectEdit } from '@/lib/routeCreators';
import { ProjectMeta } from '@/components/Metatag';
import ProjectGIVPowerIndex from '@/components/views/project/projectGIVPower';
import { useProjectContext } from '@/context/project.context';
Expand Down Expand Up @@ -153,7 +156,24 @@ const ProjectIndex: FC<IProjectBySlug> = () => {
{activeTab === 1 && <ProjectUpdates />}
{activeTab === 2 && <ProjectDonations />}
{activeTab === 3 && <ProjectGIVPowerIndex />}
{isDraft && (
<Flex justifyContent='flex-end'>
<ContinueCreationButton
label={formatMessage({
id: 'label.continue_creation',
})}
buttonType='primary'
type='submit'
onClick={() =>
router.push(
idToProjectEdit(projectData?.id || ''),
)
}
/>
</Flex>
)}
</Container>

<SimilarProjects slug={slug} />
</BodyWrapper>
</Wrapper>
Expand Down Expand Up @@ -188,4 +208,8 @@ const Separator = styled.hr`
margin: 40px 0;
`;

const ContinueCreationButton = styled(Button)`
align-self: flex-end;
`;

export default ProjectIndex;
2 changes: 1 addition & 1 deletion src/components/views/projects/QFProjectsBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const QFProjectsBanner = () => {
</StyledCol>
<StyledCol xs={12} md={6}>
<Image
src={'/images/banners/qfSponsors.png'}
src={'/images/banners/qfSponsors.webp'}
style={{ objectFit: 'contain' }}
fill
alt='QF Banner'
Expand Down
15 changes: 4 additions & 11 deletions src/context/donate.context.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createContext, FC, ReactNode, useContext, useState } from 'react';
import { IDonationProject } from '@/apollo/types/types';
import { hasActiveRound } from '@/helpers/qf';

interface ISuccessDonation {
txHash: string[];
Expand All @@ -25,20 +26,12 @@ const DonateContext = createContext<IDonateContext>({

DonateContext.displayName = 'DonateContext';

export const DonateProvider: FC<IProviderProps> = props => {
const { children, project } = props;

const { qfRounds } = project;
const activeQFRound = qfRounds?.find(r => r.isActive);
const qfBeginDate = activeQFRound?.beginDate;
const now = new Date().toISOString();
const hasRoundBegun = qfBeginDate ? qfBeginDate < now : false;
// It's impossible that a round is active and end date is passed, bc backend has a cron job. So, we only check the beginDate
const hasActiveQFRound = activeQFRound && hasRoundBegun;

export const DonateProvider: FC<IProviderProps> = ({ children, project }) => {
const [isSuccessDonation, setSuccessDonation] =
useState<ISuccessDonation>();

const hasActiveQFRound = hasActiveRound(project?.qfRounds);

return (
<DonateContext.Provider
value={{
Expand Down
4 changes: 4 additions & 0 deletions src/features/user/user.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ const initialState: {
isSignedIn: boolean;
balance: string | null;
isLoading: boolean;
isUserFullFilled: boolean;
} = {
userData: undefined,
token: undefined,
isEnabled: false,
isSignedIn: false,
balance: null,
isLoading: true,
isUserFullFilled: false,
};

type UserStateType = RootState['user'];
Expand Down Expand Up @@ -121,10 +123,12 @@ export const userSlice = createSlice({
signOutUser(state);
}
state.isLoading = false;
state.isUserFullFilled = true;
},
)
.addCase(fetchUserByAddress.rejected, state => {
state.isLoading = false;
state.isUserFullFilled = true;
})
.addCase(signToGetToken.fulfilled, (state, action) => {
state.token = action.payload;
Expand Down
Loading

1 comment on commit 2105657

@vercel
Copy link

@vercel vercel bot commented on 2105657 Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

giveth-dapps-v2 – ./

giveth.io
www.giveth.io
giveth-dapps-v2-git-main-givethio.vercel.app
giveth-dapps-v2-givethio.vercel.app

Please sign in to comment.