8000 Update CreateCause.tsx by maryjaf · Pull Request #5154 · Giveth/giveth-dapps-v2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update CreateCause.tsx #5154

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

Merged
merged 3 commits into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion src/components/views/causes/create/CreateCause.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ const CreateCause: FC<ICreateCauseProps> = () => {
};

const cause = await addCauseMutation({ variables: causeData });

localStorage.setItem(
'causeProjectsCount',
String(cause.data.createCause.activeProjectsCount ?? 0),
);
clearStorage();

router.push(slugToSuccessCauseView(cause.data.createCause.slug));
Expand Down
23 changes: 20 additions & 3 deletions src/components/views/causes/create/SuccessfulCauseCreation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import {
brandColors,
Button,
Expand All @@ -13,6 +13,7 @@ import Link from 'next/link';
import Image from 'next/image';
import styled from 'styled-components';
import { useIntl } from 'react-intl';
import { useRouter } from 'next/router';
import { ICause } from '@/apollo/types/types';
import { slugToCauseView } from '@/lib/routeCreators';
import SocialBox from '@/components/SocialBox';
Expand All @@ -25,14 +26,24 @@ import CongratsAnimation from '@/animations/congrats.json';
import LottieControl from '@/components/LottieControl';
import { EContentType } from '@/lib/constants/shareContent';
import NotAvailableHandler from '@/components/NotAvailableHandler';
import ProjectCard from '@/components/project-card/ProjectCard';
import ProjectCard from '@/components/project-card/ProjectCardAlt';

interface IProps {
cause?: ICause;
isLoading?: boolean;
}

const SuccessfulCauseCreation = ({ cause, isLoading }: IProps) => {
const router = useRouter();
const [projectsCount, setProjectsCount] = useState(0);

useEffect(() => {
const count = localStorage.getItem('causeProjectsCount');
if (count) {
setProjectsCount(parseInt(count, 10));
//localStorage.removeItem('causeProjectsCount');
}
}, []);
const dispatch = useAppDispatch();
const { formatMessage } = useIntl();

Expand Down Expand Up @@ -68,7 +79,13 @@ const SuccessfulCauseCreation = ({ cause, isLoading }: IProps) => {

<Row>
<Left xs={12} md={6}>
<ProjectCard project={cause} />
<CardWrapper>
<ProjectCard
project={cause}
isNew={true}
projectsCount={projectsCount}
/>
</CardWrapper>
</Left>

<Right xs={12} md={6}>
Expand Down
Loading
0