Skip to content

Commit

Permalink
Merge branch 'main' into feature/draw-transparency
Browse files Browse the repository at this point in the history
# Conflicts:
#	shared/locales/de/website-common.json
#	shared/locales/en/website-common.json
#	website/src/components/navbar/navbar.tsx
  • Loading branch information
mkue committed Oct 28, 2023
2 parents 9830b58 + 44bdcef commit 237af85
Show file tree
Hide file tree
Showing 301 changed files with 9,559 additions and 4,392 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
working-directory: functions
run: |
echo POSTFINANCE_EMAIL_PASSWORD=${{ secrets.POSTFINANCE_EMAIL_PASSWORD }} > .env
echo POSTFINANCE_PAYMENTS_FILES_BUCKET=${{ (inputs.project == 'social-income-prod' && vars.POSTFINANCE_PAYMENTS_FILES_BUCKET) || vars.POSTFINANCE_PAYMENTS_FILES_BUCKET_STAGING }} >> .env
echo STRIPE_API_READ_KEY=${{ (inputs.project == 'social-income-prod' && secrets.STRIPE_API_READ_KEY) || secrets.STRIPE_API_READ_KEY_STAGING }} >> .env
echo STRIPE_WEBHOOK_SECRET=${{ (inputs.project == 'social-income-prod' && secrets.STRIPE_WEBHOOK_SECRET) || secrets.STRIPE_WEBHOOK_SECRET_STAGING }} >> .env
echo NOTIFICATION_EMAIL_USER=${{ secrets.NOTIFICATION_EMAIL_USER }} >> .env
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/execute-draw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: mkdir -p draws

- name: Draw 🎲
uses: drand/[email protected].8
uses: drand/[email protected].9
with:
inputDir: ./lists
outputDir: ./draws
Expand All @@ -36,4 +36,8 @@ jobs:
git config --global user.email $BOT_EMAIL
git add .
git commit -m "completed a recipient draw"
git push
- name: Raise PR
uses: peter-evans/create-pull-request@v5
with:
branch: draw/results
branch-suffix: timestamp
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ seed/
dist/
.next/
*.hbs
ui/src/react-daisyui/
ui/README.md
ui/storybook-static/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tailwind CSS independent of the website ([Readme](ui/README.md) /
our [Storybook](https://socialincome-san.github.io/public/).

\* The website socialincome.org is still on a private repo. In this
repo, we are rebuilding the existing website with Next.js, DaisyUI and
repo, we are rebuilding the existing website with Next.js, shadcn/ui and
Tailwind CSS. You can visit the website in the making on
[staging](https://staging.socialincome.org/) or
[production](https://prod.socialincome.org/).
Expand Down
32 changes: 16 additions & 16 deletions admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"test:playwright:emulator:update": "firebase emulators:exec --project social-income-staging --only firestore,auth --config ../firebase.json --import ../seed 'npm run test:playwright:local:update'"
},
"devDependencies": {
"@firebase/rules-unit-testing": "^3.0.0",
"@jest/globals": "^29.6.4",
"@playwright/test": "^1.37.1",
"@types/jest": "^29.5.4",
"@firebase/rules-unit-testing": "^3.0.1",
"@jest/globals": "^29.7.0",
"@playwright/test": "^1.38.1",
"@types/jest": "^29.5.5",
"@types/luxon": "^3.3.2",
"@types/node": "^20.5.7",
"@types/react": "^18.2.21",
"@types/node": "^20.7.0",
"@types/react": "^18.2.22",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"@vitejs/plugin-react": "^4.1.0",
"css-loader": "^6.8.1",
"jest": "^29.6.4",
"jest": "^29.7.0",
"process": "^0.11.10",
"style-loader": "^3.3.3",
"ts-jest": "^29.1.1",
Expand All @@ -37,17 +37,17 @@
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.7",
"@mui/lab": "^5.0.0-alpha.142",
"@mui/material": "^5.14.7",
"@mui/x-data-grid": "^6.12.1",
"@mui/x-date-pickers": "^6.12.1",
"@mui/icons-material": "^5.14.9",
"@mui/lab": "^5.0.0-alpha.145",
"@mui/material": "^5.14.10",
"@mui/x-data-grid": "^6.15.0",
"@mui/x-date-pickers": "^6.15.0",
"@socialincome/shared": "^1.0.0",
"algoliasearch": "^4.19.1",
"algoliasearch": "^4.20.0",
"firebase": "^9.23.0",
"firecms": "2.0.5",
"firecms": "2.1.0",
"lodash": "^4.17.21",
"luxon": "^3.4.2",
"luxon": "^3.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router": "^6.15.0",
Expand Down
4 changes: 1 addition & 3 deletions admin/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { AdminUser } from '@socialincome/shared/src/types/AdminUser';
import algoliasearch from 'algoliasearch';

import {
Authenticator,
CMSView,
FirebaseCMSApp,
FirestoreTextSearchController,
performAlgoliaTextSearch,
} from 'firecms';
import { AdminUser } from '../../shared/src/types';

import { adminsCollection } from './collections/Admins';
import { buildContributionsCollection } from './collections/Contributions';
import { operationalExpensesCollection } from './collections/OperationalExpenses';
Expand Down
8 changes: 4 additions & 4 deletions admin/src/actions/CreateDonationCertificatesAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
Select,
Typography,
} from '@mui/material';
import { CollectionActionsProps, useAuthController, useSnackbarController } from 'firecms';
import { User } from '../../../shared/src/types';

import { getFunctions, httpsCallable } from 'firebase/functions';
import { CollectionActionsProps, useAuthController, useSnackbarController } from 'firecms';
import _ from 'lodash';
import React from 'react';
import { CreateDonationCertificatesFunctionProps } from '../../../functions/src/webhooks/admin/donation-certificates/DonationCertificateHandler';
import { DEFAULT_REGION } from '../../../shared/src/firebase';
import { User } from '../../../shared/src/types/User';

const style = {
position: 'absolute' as 'absolute',
Expand All @@ -43,7 +43,7 @@ export function CreateDonationCertificatesAction({ selectionController }: Collec
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

const functions = getFunctions();
const functions = getFunctions(undefined, DEFAULT_REGION);
const createDonationCertificatesFunction = httpsCallable<CreateDonationCertificatesFunctionProps, string>(
functions,
'createDonationCertificates',
Expand Down
8 changes: 4 additions & 4 deletions admin/src/actions/InviteWhatsappAction.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Box, Button, Modal, Typography } from '@mui/material';
import { CollectionActionsProps, useAuthController, useSnackbarController } from 'firecms';
import { Recipient } from '../../../shared/src/types';

import { getFunctions, httpsCallable } from 'firebase/functions';
import { CollectionActionsProps, useAuthController, useSnackbarController } from 'firecms';
import React from 'react';
import { TwilioOutgoingMessageFunctionProps } from '../../../functions/src/webhooks/twilio/TwilioOutgoingMessageHandler';
import { DEFAULT_REGION } from '../../../shared/src/firebase';
import { Recipient } from '../../../shared/src/types/Recipient';

const STYLE = {
position: 'absolute' as 'absolute',
Expand All @@ -31,7 +31,7 @@ export function InviteWhatsappAction({ selectionController }: CollectionActionsP
};
const handleClose = () => setOpen(false);

const functions = getFunctions();
const functions = getFunctions(undefined, DEFAULT_REGION);
const twilioOutgoingMessage = httpsCallable<TwilioOutgoingMessageFunctionProps, string>(
functions,
'twilioOutgoingMessage',
Expand Down
20 changes: 10 additions & 10 deletions admin/src/actions/PaymentProcessAction.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Box, Button, CircularProgress, Modal, Tooltip, Typography } from '@mui/material';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { DEFAULT_REGION } from '@socialincome/shared/src/firebase';
import { PaymentProcessTaskType } from '@socialincome/shared/src/types/Payment';
import { toPaymentDate } from '@socialincome/shared/src/types/Recipient';
import { downloadStringAsFile } from '@socialincome/shared/src/utils/html';
import { getFunctions, httpsCallable } from 'firebase/functions';
import { useSnackbarController } from 'firecms';
import { DateTime } from 'luxon';
import { useState } from 'react';
import { PaymentProcessTaskType, toPaymentDate } from '../../..//shared/src/types';
import { PaymentProcessProps } from '../../../functions/src/webhooks/admin/payment-process';

const BOX_STYLE = {
Expand All @@ -18,7 +20,8 @@ const BOX_STYLE = {
p: 4,
};

const createNewPaymentsDescription = 'Set payment status to paid and create new payments for the upcoming month.';
const createNewPaymentsDescription =
'Update status of payments, create new payments for the upcoming month, and update status of recipients.';

export function PaymentProcessAction() {
const snackbarController = useSnackbarController();
Expand All @@ -33,7 +36,10 @@ export function PaymentProcessAction() {
};

const triggerFirebaseFunction = (task: PaymentProcessTaskType) => {
const runPaymentProcessTask = httpsCallable<PaymentProcessProps, string>(getFunctions(), 'runPaymentProcessTask');
const runPaymentProcessTask = httpsCallable<PaymentProcessProps, string>(
getFunctions(undefined, DEFAULT_REGION),
'runPaymentProcessTask',
);
setIsFunctionRunning(true);
runPaymentProcessTask({
type: task,
Expand Down Expand Up @@ -85,12 +91,6 @@ export function PaymentProcessAction() {
if (value) setPaymentDate(toPaymentDate(DateTime.fromJSDate(value)));
}}
/>
<Button
variant="outlined"
onClick={() => triggerFirebaseFunction(PaymentProcessTaskType.UpdateRecipients)}
>
Update Recipients
</Button>
<Button
variant="outlined"
onClick={() => triggerFirebaseFunction(PaymentProcessTaskType.GetRegistrationCSV)}
Expand All @@ -103,7 +103,7 @@ export function PaymentProcessAction() {
{!confirmCreateNewPayments && (
<Tooltip title={createNewPaymentsDescription}>
<Button variant="outlined" onClick={() => setConfirmCreateNewPayments(true)}>
Create new payments
Update Database
</Button>
</Tooltip>
)}
Expand Down
3 changes: 2 additions & 1 deletion admin/src/collections/Admins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ADMIN_USER_FIRESTORE_PATH, AdminUser } from '@socialincome/shared/src/types/AdminUser';
import { PARTNER_ORGANISATION_FIRESTORE_PATH } from '@socialincome/shared/src/types/PartnerOrganisation';
import { buildProperties } from 'firecms';
import { ADMIN_USER_FIRESTORE_PATH, AdminUser, PARTNER_ORGANISATION_FIRESTORE_PATH } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export const adminsCollection = buildAuditedCollection<AdminUser>({
Expand Down
8 changes: 7 additions & 1 deletion admin/src/collections/Contributions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import {
CONTRIBUTION_FIRESTORE_PATH,
Contribution,
ContributionSourceKey,
StatusKey,
} from '@socialincome/shared/src/types/Contribution';
import { buildProperties } from 'firecms';
import { EntityCollection } from 'firecms/dist/types/collections';
import { CONTRIBUTION_FIRESTORE_PATH, Contribution, ContributionSourceKey, StatusKey } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export function buildContributionsCollection(
Expand All @@ -26,6 +31,7 @@ export function buildContributionsCollection(
validation: { required: true },
},
created: {
// @ts-ignore
dataType: 'date',
name: 'Created',
mode: 'date',
Expand Down
5 changes: 4 additions & 1 deletion admin/src/collections/DonationCertificate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { DONATION_CERTIFICATE_FIRESTORE_PATH, DonationCertificate } from '@socialincome/shared/src/types';
import {
DONATION_CERTIFICATE_FIRESTORE_PATH,
DonationCertificate,
} from '@socialincome/shared/src/types/DonationCertificate';
import { AdditionalFieldDelegate, buildProperties } from 'firecms';
import { buildAuditedCollection } from './shared';

Expand Down
2 changes: 1 addition & 1 deletion admin/src/collections/Messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Email, MESSAGE_FIRESTORE_PATH, TwilioMessage } from '@socialincome/shared/src/types/Message';
import { buildProperties } from 'firecms';
import { Email, MESSAGE_FIRESTORE_PATH, TwilioMessage } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export const messagesCollection = buildAuditedCollection<Partial<TwilioMessage | Email>>({
Expand Down
5 changes: 4 additions & 1 deletion admin/src/collections/OperationalExpenses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {
OPERATIONAL_EXPENSE_FIRESTORE_PATH,
OperationalExpense,
} from '@socialincome/shared/src/types/OperationalExpense';
import { buildProperties } from 'firecms';
import { OPERATIONAL_EXPENSE_FIRESTORE_PATH, OperationalExpense } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export const operationalExpensesCollection = buildAuditedCollection<OperationalExpense>({
Expand Down
5 changes: 4 additions & 1 deletion admin/src/collections/PartnerOrganisations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {
PARTNER_ORGANISATION_FIRESTORE_PATH,
PartnerOrganisation,
} from '@socialincome/shared/src/types/PartnerOrganisation';
import { buildProperties } from 'firecms';
import { PARTNER_ORGANISATION_FIRESTORE_PATH, PartnerOrganisation } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export const buildPartnerOrganisationsCollection = () => {
Expand Down
3 changes: 2 additions & 1 deletion admin/src/collections/Payments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MESSAGE_FIRESTORE_PATH } from '@socialincome/shared/src/types/Message';
import { Payment, PAYMENT_FIRESTORE_PATH, PaymentStatus } from '@socialincome/shared/src/types/Payment';
import { buildProperties, EnumValues } from 'firecms';
import { MESSAGE_FIRESTORE_PATH, Payment, PAYMENT_FIRESTORE_PATH, PaymentStatus } from '../../../shared/src/types';
import { buildAuditedCollection } from './shared';

export const paymentStatusEnumValues: EnumValues = [
Expand Down
7 changes: 6 additions & 1 deletion admin/src/collections/Users.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { USER_FIRESTORE_PATH, User, UserReferralSource } from '@socialincome/shared/src/types/User';
import { AdditionalFieldDelegate, buildProperties } from 'firecms';
import { USER_FIRESTORE_PATH, User, UserReferralSource } from '../../../shared/src/types';
import { CreateDonationCertificatesAction } from '../actions/CreateDonationCertificatesAction';
import { buildContributionsCollection } from './Contributions';
import { donationCertificateCollection } from './DonationCertificate';
Expand Down Expand Up @@ -193,5 +193,10 @@ export const usersCollection = buildAuditedCollection<User>({
dataType: 'string',
readOnly: true,
},
payment_reference_id: {
name: 'Swiss QR-bill payment reference id',
dataType: 'number',
readOnly: true,
},
}),
});
7 changes: 3 additions & 4 deletions admin/src/collections/recipients/Recipients.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { AdditionalFieldDelegate, buildProperties } from 'firecms';
import { EntityCollection, PropertiesOrBuilders } from 'firecms/dist/types';

import { Chip, Tooltip } from '@mui/material';
import {
RECIPIENT_FIRESTORE_PATH,
Recipient,
calcFinalPaymentDate,
calcPaymentsLeft,
} from '@socialincome/shared/src/types';
} from '@socialincome/shared/src/types/Recipient';
import { toDateTime } from '@socialincome/shared/src/utils/date';
import { AdditionalFieldDelegate, buildProperties } from 'firecms';
import { EntityCollection, PropertiesOrBuilders } from 'firecms/dist/types';
import { messagesCollection } from '../Messages';
import { paymentsCollection } from '../Payments';
import { buildAuditedCollection } from '../shared';
Expand Down
3 changes: 2 additions & 1 deletion admin/src/collections/recipients/RecipientsPayments.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Payment, RECIPIENT_FIRESTORE_PATH, Recipient, RecipientProgramStatus } from '@socialincome/shared/src/types';
import { Payment } from '@socialincome/shared/src/types/Payment';
import { RECIPIENT_FIRESTORE_PATH, Recipient, RecipientProgramStatus } from '@socialincome/shared/src/types/Recipient';
import { getMonthIDs } from '@socialincome/shared/src/utils/date';
import {
AdditionalFieldDelegate,
Expand Down
7 changes: 2 additions & 5 deletions admin/src/collections/recipients/RecipientsProperties.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
PARTNER_ORGANISATION_FIRESTORE_PATH,
RecipientMainLanguage,
RecipientProgramStatus,
} from '@socialincome/shared/src/types';
import { PARTNER_ORGANISATION_FIRESTORE_PATH } from '@socialincome/shared/src/types/PartnerOrganisation';
import { RecipientMainLanguage, RecipientProgramStatus } from '@socialincome/shared/src/types/Recipient';
import { Property, StringProperty } from 'firecms/dist/types/properties';

export const programStatusProperty: Property = {
Expand Down
3 changes: 2 additions & 1 deletion admin/src/collections/surveys/Surveys.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityCollection } from 'firecms/dist/types/collections';
import { SURVEY_FIRETORE_PATH, Survey } from '../../../../shared/src/types';
import { SURVEY_FIRETORE_PATH, Survey } from '../../../../shared/src/types/Survey';
import { buildAuditedCollection } from '../shared';
import {
accessEmailProperty,
Expand Down Expand Up @@ -28,6 +28,7 @@ export function buildSurveysCollection(collectionProps?: Partial<EntityCollectio
questionnaire: surveyQuestionnaireProperty,
recipient_name: recipientNameProperty,
language: languageProperty,
// @ts-ignore
due_date_at: dueDateAtProperty,
sent_at: sentAtProperty,
completed_at: completedAtProperty,
Expand Down
3 changes: 2 additions & 1 deletion admin/src/collections/surveys/SurveysProperties.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RecipientMainLanguage, SurveyQuestionnaire, SurveyStatus } from '@socialincome/shared/src/types';
import { RecipientMainLanguage } from '@socialincome/shared/src/types/Recipient';
import { SurveyQuestionnaire, SurveyStatus } from '@socialincome/shared/src/types/Survey';
import { DateProperty, MapProperty, Property, StringProperty } from 'firecms/dist/types/properties';

export const surveyStatusProperty: StringProperty = {
Expand Down
3 changes: 2 additions & 1 deletion admin/src/views/NextSurveysView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Button, Link, Popover, Typography } from '@mui/material';
import { DataGrid } from '@mui/x-data-grid';
import { Recipient, Survey, SurveyStatus, getSurveyUrl } from '@socialincome/shared/src/types';
import { Recipient } from '@socialincome/shared/src/types/Recipient';
import { Survey, SurveyStatus, getSurveyUrl } from '@socialincome/shared/src/types/Survey';
import { toDate, toDateTime } from '@socialincome/shared/src/utils/date';
import {
QueryDocumentSnapshot,
Expand Down
3 changes: 2 additions & 1 deletion admin/src/views/PaymentsConfirmationView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Box, Button, Link, Popover, Typography } from '@mui/material';
import { DataGrid } from '@mui/x-data-grid';
import { Payment, PaymentStatus, Recipient } from '@socialincome/shared/src/types';
import { Payment, PaymentStatus } from '@socialincome/shared/src/types/Payment';
import { Recipient } from '@socialincome/shared/src/types/Recipient';
import { toDateTime } from '@socialincome/shared/src/utils/date';
import {
QueryDocumentSnapshot,
Expand Down
4 changes: 2 additions & 2 deletions admin/src/views/ScriptsView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Box, Button, Card, CardActions, CardContent, Container, Grid, Typography } from '@mui/material';

import { DEFAULT_REGION } from '@socialincome/shared/src/firebase';
import { getFunctions, httpsCallable } from 'firebase/functions';
import { useSnackbarController } from 'firecms';

export function ScriptsView() {
const functions = getFunctions();
const functions = getFunctions(undefined, DEFAULT_REGION);
const snackbarController = useSnackbarController();
const batchImportStripeCharges = () => {
snackbarController.open({
Expand Down
Loading

0 comments on commit 237af85

Please sign in to comment.