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

Fix dashboard items #1007

Merged
merged 12 commits into from
Nov 11, 2023
68 changes: 62 additions & 6 deletions src/screens/OrganizationDashboard/OrganizationDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ import { toast } from 'react-toastify';
import { useHistory } from 'react-router-dom';
import CardItemLoading from 'components/OrganizationDashCards/CardItemLoading';
import DashboardCardLoading from 'components/OrganizationDashCards/DashboardCardLoading';
import getOrganizationId from 'utils/getOrganizationId';

function organizationDashboard(): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'dashboard' });
document.title = t('title');
const currentUrl = window.location.href.split('=')[1];
const organizationId = getOrganizationId(window.location.href);
const peopleLink: string = `/orgpeople/id=${organizationId}`;
const postsLink: string = `/orgpost/id=${organizationId}`;
const eventsLink: string = `/orgevents/id=${organizationId}`;
const blockUserLink: string = `/blockuser/id=${organizationId}`;
const requestLink: string = '/requests';

const history = useHistory();
const [upcomingEvents, setUpcomingEvents] = useState<
InterfaceQueryOrganizationEventListItem[]
Expand Down Expand Up @@ -120,42 +128,90 @@ function organizationDashboard(): JSX.Element {
</Row>
) : (
<Row style={{ display: 'flex' }}>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${peopleLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={data?.organizations[0].members?.length}
title={t('members')}
icon={<UsersIcon fill="var(--bs-primary)" />}
/>
</Col>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${peopleLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={data?.organizations[0].admins?.length}
title={t('admins')}
icon={<AdminsIcon fill="var(--bs-primary)" />}
/>
</Col>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${postsLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={postData?.postsByOrganization?.length}
title={t('posts')}
icon={<PostsIcon fill="var(--bs-primary)" />}
/>
</Col>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${eventsLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={eventData?.eventsByOrganization?.length}
title={t('events')}
icon={<EventsIcon fill="var(--bs-primary)" />}
/>
</Col>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${blockUserLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={data?.organizations[0].blockedUsers?.length}
title={t('blockedUsers')}
icon={<BlockedUsersIcon fill="var(--bs-primary)" />}
/>
</Col>
<Col xs={6} sm={4} className="mb-4">
<Col
xs={6}
sm={4}
role="button"
className="mb-4"
onClick={(): void => {
history.push(`${requestLink}`);
beingnoble03 marked this conversation as resolved.
Show resolved Hide resolved
}}
>
<DashBoardCard
count={data?.organizations[0].membershipRequests?.length}
title={t('requests')}
Expand Down