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

Website: small cleanups #1046

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions shared/src/types/recipient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export type Recipient = {
successor?: string;
};

export const recipientNGOs = ['aurora', 'jamil', 'reachout', 'equal-rights', 'united-polio', 'slaes'];

export const toPaymentDate = (dateTime: DateTime) => {
return dateTime.set({
day: 15,
Expand Down
4 changes: 1 addition & 3 deletions shared/src/utils/stats/RecipientStatsCalculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export type TotalRecipientsByStatus = {
[status in RecipientProgramStatus]?: number;
} & { total: number };

export type OrganisationRecipientsByStatus = {
[orgId: string]: TotalRecipientsByStatus;
};
export type OrganisationRecipientsByStatus = Partial<Record<string, TotalRecipientsByStatus>> & { total: number };

export class RecipientStatsCalculator {
constructor(readonly recipients: _.Collection<Pick<Recipient, 'progr_status' | 'organisation'>>) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
NgoHoverCardType,
} from '@/app/[lang]/[region]/(website)/partners/(types)/PartnerCards';
import { firestoreAdmin } from '@/firebase-admin';
import { recipientNGOs, RecipientProgramStatus } from '@socialincome/shared/src/types/recipient';
import { RecipientProgramStatus } from '@socialincome/shared/src/types/recipient';
import { Translator } from '@socialincome/shared/src/utils/i18n';
import {
OrganisationRecipientsByStatus,
Expand All @@ -36,12 +36,8 @@ export async function NgoList({ lang, region }: DefaultParams) {
});
const image_base_path = '/assets/partners/';

const ngos: string[] = recipientNGOs;
const ngoArray: NgoEntryJSON[] = [];
ngos.forEach((slug: string) => {
const ngo: NgoEntryJSON = translator.t(slug);
ngoArray.push(ngo);
});
const ngos = ['aurora', 'jamil', 'reachout', 'equal-rights', 'united-polio', 'slaes'];
const ngoArray: NgoEntryJSON[] = ngos.map((slug: string) => translator.t(slug));
const ngoCardPropsArray: NgoCardProps[] = [];

const recipientCalculator = await RecipientStatsCalculator.build(firestoreAdmin);
Expand All @@ -50,6 +46,8 @@ export async function NgoList({ lang, region }: DefaultParams) {

for (let i = 0; i < ngoArray.length; ++i) {
const currentOrgRecipientStats = recipientStats[ngos[i]];
if (!currentOrgRecipientStats) continue;

const recipientsBadge: RecipientsBadgeType = {
hoverCardOrgName: ngoArray[i]['org-long-name'],
hoverCardTotalRecipients: currentOrgRecipientStats['total'] ?? 0,
Expand Down
8 changes: 3 additions & 5 deletions website/src/components/navbar/navbar-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,15 @@ const DesktopNavigation = ({ lang, region, languages, regions, currencies, navig
</div>
<SIIcon className="-mb-2.5 block h-9 pr-20 lg:hidden" />
</Link>
<div className="absolute left-0 mt-[50px] hidden flex-col justify-start space-y-2 overflow-visible whitespace-nowrap group-hover/navbar:flex group-active/navbar:flex">
<NavbarLink href={`/${lang}/${region}/journal`}>{translations.journal}</NavbarLink>
<NavbarLink className="mt-auto" href={`/${lang}/${region}/me`}>
{translations.myProfile}
</NavbarLink>
<div className="absolute left-0 mt-[50px] hidden flex-col justify-start overflow-visible whitespace-nowrap group-hover/navbar:flex group-active/navbar:flex">
<NavbarLink href={`/${lang}/${region}/me`}>{translations.myProfile}</NavbarLink>
<div className="flex-inline mt-auto flex items-center space-x-2">
<DonateIcon className="h-4 w-4" />
<NavbarLink href={`/${lang}/${region}/donate/individual`} className="text-accent">
{translations.donate}
</NavbarLink>
</div>
<NavbarLink href={`/${lang}/${region}/journal`}>{translations.journal}</NavbarLink>
</div>
</div>
<div className="flex flex-row items-center justify-evenly gap-x-10 overflow-visible">
Expand Down
Loading