diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 9420738..10ee34f 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -31,6 +31,9 @@ jobs: NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ vars.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }} NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }} NEXT_PUBLIC_USER_ACCOUNT_ENABLED=${{ vars.NEXT_PUBLIC_USER_ACCOUNT_ENABLED }} + NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=${{ vars.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }} + NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=${{ vars.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID }} + NEXT_PUBLIC_SITE_URL=${{ vars.NEXT_PUBLIC_SITE_URL }} EOF - name: Cache Next.js build diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 45f17e4..a061d61 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -33,6 +33,9 @@ jobs: NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=${{ vars.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }} NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }} NEXT_PUBLIC_USER_ACCOUNT_ENABLED=${{ vars.NEXT_PUBLIC_USER_ACCOUNT_ENABLED }} + NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=${{ vars.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }} + NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID=${{ vars.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID }} + NEXT_PUBLIC_SITE_URL=${{ vars.NEXT_PUBLIC_SITE_URL }} EOF - name: Cache Next.js build diff --git a/next-env.d.ts b/next-env.d.ts index 52e831b..254b73c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/package.json b/package.json index 29c99d9..d89e811 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ }, "dependencies": { "@apollo/client": "^3.13.9", + "@next/third-parties": "^15.5.2", "@portabletext/react": "^3.2.1", "@radix-ui/react-dialog": "^1.1.14", "@sanity/client": "^7.8.1", @@ -32,7 +33,7 @@ "graphql": "^16.11.0", "graphql-request": "^7.2.0", "graphql-tag": "^2.12.6", - "next": "^15.1", + "next": "^15.5.2", "next-sitemap": "^4.2.3", "react": "^19", "react-dom": "^19", diff --git a/pages/_document.tsx b/pages/_document.tsx index 8e737c6..1ee7550 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -1,5 +1,10 @@ import { Html, Head, Main, NextScript } from "next/document"; import Script from "next/script"; +import { GoogleAnalytics, GoogleTagManager } from "@next/third-parties/google"; +import { + GOOGLE_ANALYTICS_ID, + GOOGLE_TAG_MANAGER_ID, +} from "@/utils/constant/general"; export default function Document() { return ( @@ -8,10 +13,18 @@ export default function Document() {
- -
+
+ {GOOGLE_ANALYTICS_ID && } + {GOOGLE_TAG_MANAGER_ID && ( + + )} ); diff --git a/pages/donate.tsx b/pages/donate/index.tsx similarity index 100% rename from pages/donate.tsx rename to pages/donate/index.tsx diff --git a/pages/donate/thank-you.tsx b/pages/donate/thank-you.tsx new file mode 100644 index 0000000..96a9bca --- /dev/null +++ b/pages/donate/thank-you.tsx @@ -0,0 +1,76 @@ +import React from "react"; +import PageHeader from "@/components/PageHeader"; +import SEO from "@/components/SEO"; +import CTASection from "@/components/CTASection"; +import Link from "next/link"; + +const ThankYou: React.FC = () => { + return ( +
+ + + +
+

+ Thank You for Sharing Christ’s Love! +

+ +

+ Your generous gift to the Archdiocesan Nourishment Center (ANC) is + more than a donation — it is a meal for a hungry child, a step toward + healing, and a sign of hope for families in our most vulnerable + communities. +

+ +

+ Since 2014, ANC has worked to nourish lives, restore dignity, and walk + with the poor, guided by our mission to serve with compassion and + faith. Your support strengthens this mission and helps us care not + only for the body but also for the mind and spirit. +

+ +

+ "For I was hungry and you gave me food, I was thirsty and you + gave me drink, I was a stranger and you welcomed me." – Matthew + 25:35 +

+ +

+ We are deeply grateful for your generosity. Be assured that you and + your loved ones will be remembered in our prayers and in the Holy + Masses celebrated for our benefactors. +

+ +

+ May the Lord bless you abundantly for being His instrument of mercy + and love. +

+
+ + Learn More About Our Mission + + + Make Another Donation + +
+
+ +
+ ); +}; + +export default ThankYou; diff --git a/public/robots.txt b/public/robots.txt index 305b38c..9cfd0cb 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -3,7 +3,7 @@ User-agent: * Allow: / # Host -Host: https://ancdavao.com +Host: https://www.ancdavao.com # Sitemaps -Sitemap: https://ancdavao.com/sitemap.xml +Sitemap: https://www.ancdavao.com/sitemap.xml diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml index cef5807..a5b04b2 100644 --- a/public/sitemap-0.xml +++ b/public/sitemap-0.xml @@ -1,45 +1,42 @@ -https://ancdavao.com/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/about/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/auth/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/auth/forgot-password/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/auth/login/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/auth/register/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/blog/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/causes/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/cms/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/contact-us/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/donate/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/events/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/faq/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/get-involved/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/history/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/how-to-help/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/moments-of-hope/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/account/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/account/edit/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/donations/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/feeding-sponsorships/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/onboarding/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/my/pledges/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/our-centers/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/partnerships/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/privacy-policy/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/share/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/stories-impact/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/terms-conditions/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/volunteer/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/feeding-program/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/educational-assistance/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/medical-and-dental-services/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/spiritual-formation/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/parent-collaboration/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/programs-and-services/livelihood-program/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/blog/nourishing-hope-one-child-at-a-time/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/blog/nourishing-bodies-uplifting-souls-a-day-at-the-anc-feeding-program/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/causes/support-for-children/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/causes/uganda-education/2025-08-31T12:38:27.083Zdaily0.7 -https://ancdavao.com/causes/food-for-syrian/2025-08-31T12:38:27.083Zdaily0.7 +https://www.ancdavao.com/2025-09-01T08:25:13.755Zdaily0.7 +https://www.ancdavao.com/about/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/auth/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/auth/forgot-password/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/auth/login/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/auth/register/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/blog/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/cms/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/contact-us/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/donate/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/donate/thank-you/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/events/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/faq/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/get-involved/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/history/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/how-to-help/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/moments-of-hope/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/account/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/account/edit/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/donations/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/feeding-sponsorships/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/onboarding/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/my/pledges/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/our-centers/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/partnerships/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/privacy-policy/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/share/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/stories-impact/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/terms-conditions/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/volunteer/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/feeding-program/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/educational-assistance/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/medical-and-dental-services/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/spiritual-formation/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/parent-collaboration/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/programs-and-services/livelihood-program/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/blog/nourishing-hope-one-child-at-a-time/2025-09-01T08:25:13.756Zdaily0.7 +https://www.ancdavao.com/blog/nourishing-bodies-uplifting-souls-a-day-at-the-anc-feeding-program/2025-09-01T08:25:13.756Zdaily0.7 \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml index 36f7748..cbd556a 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -1,4 +1,4 @@ -https://ancdavao.com/sitemap-0.xml +https://www.ancdavao.com/sitemap-0.xml \ No newline at end of file diff --git a/src/components/CTASection/index.tsx b/src/components/CTASection/index.tsx index 12e1cd8..e1b9705 100644 --- a/src/components/CTASection/index.tsx +++ b/src/components/CTASection/index.tsx @@ -16,7 +16,7 @@ const CTASection: React.FC = () => {

From daily feeding programs to scholarships and medical missions, ANC - has reached over 20,000 lives in Davao City with + has reached over 2,000 lives in Davao City with compassion and care.
Be part of a mission that transforms communities. diff --git a/src/components/DonationFormSection/OnlineDonationForm.tsx b/src/components/DonationFormSection/OnlineDonationForm.tsx index bd8e5bb..777b814 100644 --- a/src/components/DonationFormSection/OnlineDonationForm.tsx +++ b/src/components/DonationFormSection/OnlineDonationForm.tsx @@ -1,4 +1,5 @@ import { presetAmounts } from "@/utils/constant/donation"; +import { SITE_URL } from "@/utils/constant/general"; import { slugify } from "@/utils/helper/slugify"; import React, { useState } from "react"; @@ -48,6 +49,8 @@ const OnlineDonationForm: React.FC = () => { email: formData.email, mobile_number: formData.phone, }, + success_redirect_url: `${SITE_URL}/donate/thank-you`, + failure_redirect_url: `${SITE_URL}/donate`, }), }, ); diff --git a/src/components/DonationHistoryContent/DonationsList.tsx b/src/components/DonationHistoryContent/DonationsList.tsx index daaf7aa..34731b3 100644 --- a/src/components/DonationHistoryContent/DonationsList.tsx +++ b/src/components/DonationHistoryContent/DonationsList.tsx @@ -3,37 +3,36 @@ import { getInvoicesByUid } from "@/services/invoiceService"; import { Invoice } from "@/types/invoice"; import React, { useEffect, useState } from "react"; import Loading from "../Loading"; +import { PaymentCard } from "./PaymentCard"; export const DonationsList = () => { + const { user } = useAuth(); + const [loading, setLoading] = useState(true); + const [invoices, setInvoices] = useState([]); - const { user } = useAuth(); - const [loading, setLoading] = useState(true); - const [invoices, setInvoices] = useState([]); - - useEffect(() => { - const fetchInvoices = async () => { - setLoading(true); - const invoices = await getInvoicesByUid(user?.uid || ""); - setInvoices(invoices); - setLoading(false); - }; - fetchInvoices(); - }, [user]); + useEffect(() => { + const fetchInvoices = async () => { + setLoading(true); + const invoices = await getInvoicesByUid(user?.uid || ""); + setInvoices(invoices); + setLoading(false); + }; + fetchInvoices(); + }, [user]); - if(loading) return ; -console.log(invoices) - return ( -

- {invoices.length === 0 ? ( + if (loading) return ; + + return ( +
+ {invoices.length === 0 ? ( +

No invoices found.

- ) : ( - invoices.map((invoice) => ( -
-

Date: {new Date(invoice.updated).toLocaleDateString()}

-

Amount: ₱{invoice.amount.toLocaleString()}

-
- )) - )} -
- ); -}; \ No newline at end of file +
+ ) : ( + invoices.map((invoice) => ( + + )) + )} +
+ ); +}; diff --git a/src/components/DonationHistoryContent/OnlineDonationForm.tsx b/src/components/DonationHistoryContent/OnlineDonationForm.tsx index 837b57a..b710afb 100644 --- a/src/components/DonationHistoryContent/OnlineDonationForm.tsx +++ b/src/components/DonationHistoryContent/OnlineDonationForm.tsx @@ -1,5 +1,6 @@ import { useMy } from "@/context/MyContext"; import { presetAmounts } from "@/utils/constant/donation"; +import { SITE_URL } from "@/utils/constant/general"; import React, { useState } from "react"; const OnlineDonationForm: React.FC = () => { @@ -30,6 +31,8 @@ const OnlineDonationForm: React.FC = () => { email: userProfile?.email, mobile_number: userProfile?.phoneNumber, }, + success_redirect_url: `${SITE_URL}/my/donations`, + failure_redirect_url: `${SITE_URL}/my/donations`, }), }, ); diff --git a/src/components/DonationHistoryContent/PaymentCard.tsx b/src/components/DonationHistoryContent/PaymentCard.tsx new file mode 100644 index 0000000..8bcf7d3 --- /dev/null +++ b/src/components/DonationHistoryContent/PaymentCard.tsx @@ -0,0 +1,31 @@ +import { Invoice } from "@/types/invoice"; +import { Timestamp } from "firebase/firestore"; +import { PaymentChannel } from "./PaymentChannel"; + +interface PaymentCardProps { + invoice: Invoice; +} + +export const PaymentCard = ({ invoice }: PaymentCardProps) => { + const paidAt = new Date( + (invoice.paid_at as unknown as Timestamp).seconds * 1000 + + (invoice.paid_at as unknown as Timestamp).nanoseconds / 1e6, + ); + return ( +
+

+ Donation Date:{" "} + {paidAt.toISOString().replace("T", " ").replace("Z", "")} +

+

+ Amount: ₱{invoice.paid_amount.toLocaleString()} +

+

+ +

+
+ ); +}; diff --git a/src/components/DonationHistoryContent/PaymentChannel.tsx b/src/components/DonationHistoryContent/PaymentChannel.tsx new file mode 100644 index 0000000..36aa62a --- /dev/null +++ b/src/components/DonationHistoryContent/PaymentChannel.tsx @@ -0,0 +1,94 @@ +import Image from "next/image"; + +interface PaymentChannelProps { + channel?: string; +} + +const paymentChannelLogo = { + "7ELEVEN": "https://cdn.ancdavao.com/payment-channels/7eleven-logo.svg", + "7ELEVEN_CLIQQ": "https://cdn.ancdavao.com/payment-channels/7eleven-logo.svg", + BDO_EPAY: + "https://cdn.ancdavao.com/payment-channels/dd_bdo_online_banking-logo.svg", + DD_BDO_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/dd_bdo_online_banking-logo.svg", + BILLEASE: "https://cdn.ancdavao.com/payment-channels/billease-logo.svg", + DD_BOC_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/boc_online_bank-logo.svg", + BPI_DIRECT_DEBIT: + "https://cdn.ancdavao.com/payment-channels/dd_bpi_online_banking-logo.svg", + DD_BPI_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/dd_bpi_online_banking-logo.svg", + BPI_RECURRING: + "https://cdn.ancdavao.com/payment-channels/dd_bpi_online_banking-logo.svg", + BANK_TRANSFER: + "https://cdn.ancdavao.com/payment-channels/bank_transfer-logo.svg", + CARDS: "https://cdn.ancdavao.com/payment-channels/cards-logo.svg", + CEBUANA: "https://cdn.ancdavao.com/payment-channels/cebuana-logo.svg", + CHINABANK_DIRECT_DEBIT: + "https://cdn.ancdavao.com/payment-channels/chinabank_direct_debit-logo.svg", + DD_CHINABANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/chinabank_online_banking-logo.svg", + CVM: "https://cdn.ancdavao.com/payment-channels/cvm-logo.svg", + DP_ECPAY_LOAN: "https://cdn.ancdavao.com/payment-channels/ecpay-logo.svg", + ECPAY_DRAGONLOAN: "https://cdn.ancdavao.com/payment-channels/ecpay-logo.svg", + ECPAY_SCHOOL: "https://cdn.ancdavao.com/payment-channels/ecpay-logo.svg", + GCASH: "https://cdn.ancdavao.com/payment-channels/gcash-logo.svg", + GRABPAY: "https://cdn.ancdavao.com/payment-channels/grabpay-logo.svg", + DD_INSTAPAY_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/instapay_online_banking-logo.svg", + DD_LANDBANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/landbank_online_banking-logo.svg", + LBC: "https://cdn.ancdavao.com/payment-channels/lbc-logo.svg", + DD_MAYBANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/maybank_online_banking-logo.svg", + DD_METROBANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/metrobank_online_banking-logo.svg", + DP_MLHUILLIER: + "https://cdn.ancdavao.com/payment-channels/mlhuillier-logo.svg", + DP_PALAWAN: "https://cdn.ancdavao.com/payment-channels/palawan-logo.svg", + PAYMAYA: "https://cdn.ancdavao.com/payment-channels/paymaya-logo.svg", + DD_PESONET_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/pesonet_online_banking-logo.svg", + DD_PNB_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/pnb_online_bank-logo.svg", + DD_PSBANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/psbank_online_bank-logo.svg", + QRPH: "https://cdn.ancdavao.com/payment-channels/qrph-logo.svg", + RCBC_DIRECT_DEBIT: + "https://cdn.ancdavao.com/payment-channels/rcbc_direct_debit-logo.svg", + DD_RCBC_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/rcbc_online_banking-logo.svg", + RD_PAWNSHOP: "https://cdn.ancdavao.com/payment-channels/rd_pawnshop-logo.svg", + DD_ROBINSONS_BANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/robinsons_bank_online_banking-logo.svg", + ROBINSONS_BILLS_PAYMENT: + "https://cdn.ancdavao.com/payment-channels/robinsons_bills_payment-logo.svg", + DD_SECURITY_BANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/security_bank_online_banking-logo.svg", + SHOPEEPAY: "https://cdn.ancdavao.com/payment-channels/shopeepay-logo.svg", + SM_BILLS_PAYMENT: + "https://cdn.ancdavao.com/payment-channels/sm_bills_payment-logo.svg", + DD_UBP: "https://cdn.ancdavao.com/payment-channels/ubp-logo.svg", + UBP_EADA: "https://cdn.ancdavao.com/payment-channels/ubp-logo.svg", + DD_UNIONBANK_ONLINE_BANKING: + "https://cdn.ancdavao.com/payment-channels/unionbank_online_banking-logo.svg", + USSC: "https://cdn.ancdavao.com/payment-channels/ussc-logo.svg", +}; + +export const PaymentChannel = ({ channel }: PaymentChannelProps) => { + const logo = paymentChannelLogo[channel as keyof typeof paymentChannelLogo]; + + if (!logo) return null; + + return ( + <> + {channel} + + ); +}; diff --git a/src/components/DonationHistoryContent/index.tsx b/src/components/DonationHistoryContent/index.tsx index f9be572..db576e9 100644 --- a/src/components/DonationHistoryContent/index.tsx +++ b/src/components/DonationHistoryContent/index.tsx @@ -2,19 +2,16 @@ import React, { useState } from "react"; import OnlineDonationForm from "./OnlineDonationForm"; import { DonationsList } from "./DonationsList"; - const DonationHistoryContent = () => { const [show, setShow] = useState(false); - - return (
-
+

My Donations

diff --git a/src/components/FacebookSignInButton/index.tsx b/src/components/FacebookSignInButton/index.tsx index f8f2307..ffacfae 100644 --- a/src/components/FacebookSignInButton/index.tsx +++ b/src/components/FacebookSignInButton/index.tsx @@ -15,11 +15,12 @@ const FacebookSignInButton: React.FC = ({ const handleFacebookLogin = async () => { try { + onError(""); const provider = new FacebookAuthProvider(); await signInWithPopup(auth, provider); router.push("/my/account"); - } catch (err: unknown) { - onError((err as Error).message); + } catch { + onError("Unable to login. Please try again."); } }; diff --git a/src/components/GoogleSignInButton/index.tsx b/src/components/GoogleSignInButton/index.tsx index 3489ecc..1ee5491 100644 --- a/src/components/GoogleSignInButton/index.tsx +++ b/src/components/GoogleSignInButton/index.tsx @@ -13,11 +13,12 @@ const GoogleSignInButton: React.FC = ({ onError }) => { const handleGoogleLogin = async () => { try { + onError(""); const provider = new GoogleAuthProvider(); await signInWithPopup(auth, provider); router.push("/my/account"); - } catch (err: unknown) { - onError((err as Error).message); + } catch { + onError("Unable to login. Please try again."); } }; diff --git a/src/components/Loading/index.tsx b/src/components/Loading/index.tsx index dfcec90..4dbe26f 100644 --- a/src/components/Loading/index.tsx +++ b/src/components/Loading/index.tsx @@ -1,10 +1,10 @@ import React from "react"; type LoadingProps = { - className?: string; -} + className?: string; +}; -const Loading = ({className}: LoadingProps) => { +const Loading = ({ className }: LoadingProps) => { return (
{ setError(null); await signInWithEmailAndPassword(auth, email, password); router.push("/my/account"); - } catch (err: unknown) { - setError((err as Error).message); + } catch { + setError("Unable to login. Please try again."); } }; diff --git a/src/components/Logo/index.tsx b/src/components/Logo/index.tsx index 1314bdc..a1637a1 100644 --- a/src/components/Logo/index.tsx +++ b/src/components/Logo/index.tsx @@ -10,7 +10,11 @@ const Logo: React.FC<{ version: "v1" | "v2" }> = ({ version }) => { alt="ANC Davao Logo" width={332} height={53} - className="w-auto" + className={ + version === "v1" + ? "w-[332px] h-[53px]" + : "w-full h-full object-contain" + } /> Archdiocesan Nourishment Center diff --git a/src/context/MyContext.tsx b/src/context/MyContext.tsx index e5eaa64..9301108 100644 --- a/src/context/MyContext.tsx +++ b/src/context/MyContext.tsx @@ -42,6 +42,10 @@ export const MyProvider: React.FC<{ children: React.ReactNode }> = ({ router.push("/my/onboarding"); } } + } else { + setUserProfile(null); + setOnboarded(false); + router.push("/auth/login"); } setLoading(false); }); diff --git a/src/services/invoiceService.ts b/src/services/invoiceService.ts index 2cd25b8..100ad13 100644 --- a/src/services/invoiceService.ts +++ b/src/services/invoiceService.ts @@ -1,10 +1,14 @@ import { db } from "@/lib/firebase"; -import { collection, getDocs, query, where } from "firebase/firestore"; +import { collection, getDocs, orderBy, query, where } from "firebase/firestore"; import { Invoice } from "@/types/invoice"; export const getInvoicesByUid = async (uid: string): Promise => { const invoicesRef = collection(db, "invoices"); - const q = query(invoicesRef, where("external_id", "==", uid)); + const q = query( + invoicesRef, + where("external_id", "==", uid), + orderBy("paid_at", "desc"), + ); const snapshot = await getDocs(q); const invoices: Invoice[] = snapshot.docs.map((d) => { const data = d.data() as Invoice; @@ -12,4 +16,4 @@ export const getInvoicesByUid = async (uid: string): Promise => { return { ...data, id: d.id }; }); return invoices; -}; \ No newline at end of file +}; diff --git a/src/types/invoice.ts b/src/types/invoice.ts index 6c21fa8..f9e1347 100644 --- a/src/types/invoice.ts +++ b/src/types/invoice.ts @@ -1,19 +1,19 @@ export interface Invoice { - id: string; - amount: number; - status: string; - created: string; // ISO 8601 timestamp string - updated: string; // ISO 8601 timestamp string - user_id: string; - currency: string; - description: string; - external_id: string; - paid_amount: number; - payer_email: string; - merchant_name: string; - payment_method: string; - payment_channel: string; - payment_id: string; - is_high: boolean; - paid_at: string; // ISO 8601 timestamp string -} \ No newline at end of file + id: string; + amount: number; + status: string; + created: string; // ISO 8601 timestamp string + updated: string; // ISO 8601 timestamp string + user_id: string; + currency: string; + description: string; + external_id: string; + paid_amount: number; + payer_email: string; + merchant_name: string; + payment_method: string; + payment_channel: string; + payment_id: string; + is_high: boolean; + paid_at: string; // ISO 8601 timestamp string +} diff --git a/src/utils/constant/general.ts b/src/utils/constant/general.ts new file mode 100644 index 0000000..a743cf4 --- /dev/null +++ b/src/utils/constant/general.ts @@ -0,0 +1,5 @@ +export const SITE_URL = + process.env.NEXT_PUBLIC_SITE_URL ?? "https://www.ancdavao.com"; +export const GOOGLE_ANALYTICS_ID = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID; +export const GOOGLE_TAG_MANAGER_ID = + process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID; diff --git a/yarn.lock b/yarn.lock index a67297d..7e637ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3055,10 +3055,10 @@ "@emnapi/runtime" "^1.4.3" "@tybys/wasm-util" "^0.10.0" -"@next/env@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/env/-/env-15.4.5.tgz" - integrity sha512-ruM+q2SCOVCepUiERoxOmZY9ZVoecR3gcXNwCYZRvQQWRjhOiPJGmQ2fAiLR6YKWXcSAh7G79KEFxN3rwhs4LQ== +"@next/env@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/env/-/env-15.5.2.tgz#0c6b959313cd6e71afb69bf0deb417237f1d2f8a" + integrity sha512-Qe06ew4zt12LeO6N7j8/nULSOe3fMXE4dM6xgpBQNvdzyK1sv5y4oAP3bq4LamrvGCZtmRYnW8URFCeX5nFgGg== "@next/env@^13.4.3": version "13.5.11" @@ -3072,45 +3072,52 @@ dependencies: fast-glob "3.3.1" -"@next/swc-darwin-arm64@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.4.5.tgz" - integrity sha512-84dAN4fkfdC7nX6udDLz9GzQlMUwEMKD7zsseXrl7FTeIItF8vpk1lhLEnsotiiDt+QFu3O1FVWnqwcRD2U3KA== - -"@next/swc-darwin-x64@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.4.5.tgz#d6aa667458e5985223178575a2ba34847a9a8171" - integrity sha512-CL6mfGsKuFSyQjx36p2ftwMNSb8PQog8y0HO/ONLdQqDql7x3aJb/wB+LA651r4we2pp/Ck+qoRVUeZZEvSurA== - -"@next/swc-linux-arm64-gnu@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.4.5.tgz#7cdca590400ba8b9b303e0981ca5a1f4a81f7799" - integrity sha512-1hTVd9n6jpM/thnDc5kYHD1OjjWYpUJrJxY4DlEacT7L5SEOXIifIdTye6SQNNn8JDZrcN+n8AWOmeJ8u3KlvQ== - -"@next/swc-linux-arm64-musl@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.4.5.tgz#353497a57ab39c754a6aec49adce3c758a2c360a" - integrity sha512-4W+D/nw3RpIwGrqpFi7greZ0hjrCaioGErI7XHgkcTeWdZd146NNu1s4HnaHonLeNTguKnL2Urqvj28UJj6Gqw== - -"@next/swc-linux-x64-gnu@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.4.5.tgz#6a0fafe5083dbb2e18b7d51972f1e750379a786e" - integrity sha512-N6Mgdxe/Cn2K1yMHge6pclffkxzbSGOydXVKYOjYqQXZYjLCfN/CuFkaYDeDHY2VBwSHyM2fUjYBiQCIlxIKDA== - -"@next/swc-linux-x64-musl@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.4.5.tgz#90509b168edb3f33754a03b0699727ef144839cd" - integrity sha512-YZ3bNDrS8v5KiqgWE0xZQgtXgCTUacgFtnEgI4ccotAASwSvcMPDLua7BWLuTfucoRv6mPidXkITJLd8IdJplQ== - -"@next/swc-win32-arm64-msvc@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.4.5.tgz#30dbddae862317d0cddc8f775bb03fa352517b6e" - integrity sha512-9Wr4t9GkZmMNcTVvSloFtjzbH4vtT4a8+UHqDoVnxA5QyfWe6c5flTH1BIWPGNWSUlofc8dVJAE7j84FQgskvQ== - -"@next/swc-win32-x64-msvc@15.4.5": - version "15.4.5" - resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.4.5.tgz#7c4350773a186482ab0cab7e3b61eb2f145512a0" - integrity sha512-voWk7XtGvlsP+w8VBz7lqp8Y+dYw/MTI4KeS0gTVtfdhdJ5QwhXLmNrndFOin/MDoCvUaLWMkYKATaCoUkt2/A== +"@next/swc-darwin-arm64@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.5.2.tgz#f69713326fc08f2eff3726fe19165cdb429d67c7" + integrity sha512-8bGt577BXGSd4iqFygmzIfTYizHb0LGWqH+qgIF/2EDxS5JsSdERJKA8WgwDyNBZgTIIA4D8qUtoQHmxIIquoQ== + +"@next/swc-darwin-x64@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.5.2.tgz#560a9da4126bae75cbbd6899646ad7a2e4fdcc9b" + integrity sha512-2DjnmR6JHK4X+dgTXt5/sOCu/7yPtqpYt8s8hLkHFK3MGkka2snTv3yRMdHvuRtJVkPwCGsvBSwmoQCHatauFQ== + +"@next/swc-linux-arm64-gnu@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.5.2.tgz#80b2be276e775e5a9286369ae54e536b0cdf8c3a" + integrity sha512-3j7SWDBS2Wov/L9q0mFJtEvQ5miIqfO4l7d2m9Mo06ddsgUK8gWfHGgbjdFlCp2Ek7MmMQZSxpGFqcC8zGh2AA== + +"@next/swc-linux-arm64-musl@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.5.2.tgz#68cf676301755fd99aca11a7ebdb5eae88d7c2e4" + integrity sha512-s6N8k8dF9YGc5T01UPQ08yxsK6fUow5gG1/axWc1HVVBYQBgOjca4oUZF7s4p+kwhkB1bDSGR8QznWrFZ/Rt5g== + +"@next/swc-linux-x64-gnu@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.5.2.tgz#209d9a79d0f2333544f863b0daca3f7e29f2eaff" + integrity sha512-o1RV/KOODQh6dM6ZRJGZbc+MOAHww33Vbs5JC9Mp1gDk8cpEO+cYC/l7rweiEalkSm5/1WGa4zY7xrNwObN4+Q== + +"@next/swc-linux-x64-musl@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.5.2.tgz#d4ad1cfb5e99e51db669fe2145710c1abeadbd7f" + integrity sha512-/VUnh7w8RElYZ0IV83nUcP/J4KJ6LLYliiBIri3p3aW2giF+PAVgZb6mk8jbQSB3WlTai8gEmCAr7kptFa1H6g== + +"@next/swc-win32-arm64-msvc@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.5.2.tgz#070e10e370a5447a198c2db100389646aca2c496" + integrity sha512-sMPyTvRcNKXseNQ/7qRfVRLa0VhR0esmQ29DD6pqvG71+JdVnESJaHPA8t7bc67KD5spP3+DOCNLhqlEI2ZgQg== + +"@next/swc-win32-x64-msvc@15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.5.2.tgz#9237d40b82eaf2efc88baeba15b784d4126caf4a" + integrity sha512-W5VvyZHnxG/2ukhZF/9Ikdra5fdNftxI6ybeVKYvBPDtyx7x4jPPSNduUkfH5fo3zG0JQ0bPxgy41af2JX5D4Q== + +"@next/third-parties@^15.5.2": + version "15.5.2" + resolved "https://registry.npmjs.org/@next/third-parties/-/third-parties-15.5.2.tgz#0fa9b96f5aa71386275ef45b4dc06870de22926c" + integrity sha512-WkAP39cP5FMqrIq6CjnsTGO7A49Acliqmu1TytWMCOoCv57MN25a0+htKE5VRwm9vzAwSXKHSNnRso6nKLrKKg== + dependencies: + third-party-capital "1.0.20" "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -9731,25 +9738,25 @@ next-sitemap@^4.2.3: fast-glob "^3.2.12" minimist "^1.2.8" -next@^15.1: - version "15.4.5" - resolved "https://registry.npmjs.org/next/-/next-15.4.5.tgz" - integrity sha512-nJ4v+IO9CPmbmcvsPebIoX3Q+S7f6Fu08/dEWu0Ttfa+wVwQRh9epcmsyCPjmL2b8MxC+CkBR97jgDhUUztI3g== +next@^15.5.2: + version "15.5.2" + resolved "https://registry.npmjs.org/next/-/next-15.5.2.tgz#5e50102443fb0328a9dfcac2d82465c7bac93693" + integrity sha512-H8Otr7abj1glFhbGnvUt3gz++0AF1+QoCXEBmd/6aKbfdFwrn0LpA836Ed5+00va/7HQSDD+mOoVhn3tNy3e/Q== dependencies: - "@next/env" "15.4.5" + "@next/env" "15.5.2" "@swc/helpers" "0.5.15" caniuse-lite "^1.0.30001579" postcss "8.4.31" styled-jsx "5.1.6" optionalDependencies: - "@next/swc-darwin-arm64" "15.4.5" - "@next/swc-darwin-x64" "15.4.5" - "@next/swc-linux-arm64-gnu" "15.4.5" - "@next/swc-linux-arm64-musl" "15.4.5" - "@next/swc-linux-x64-gnu" "15.4.5" - "@next/swc-linux-x64-musl" "15.4.5" - "@next/swc-win32-arm64-msvc" "15.4.5" - "@next/swc-win32-x64-msvc" "15.4.5" + "@next/swc-darwin-arm64" "15.5.2" + "@next/swc-darwin-x64" "15.5.2" + "@next/swc-linux-arm64-gnu" "15.5.2" + "@next/swc-linux-arm64-musl" "15.5.2" + "@next/swc-linux-x64-gnu" "15.5.2" + "@next/swc-linux-x64-musl" "15.5.2" + "@next/swc-win32-arm64-msvc" "15.5.2" + "@next/swc-win32-x64-msvc" "15.5.2" sharp "^0.34.3" no-case@^3.0.4: @@ -12264,6 +12271,11 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" +third-party-capital@1.0.20: + version "1.0.20" + resolved "https://registry.npmjs.org/third-party-capital/-/third-party-capital-1.0.20.tgz#e218a929a35bf4d2245da9addb8ab978d2f41685" + integrity sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA== + through2@^2.0.3: version "2.0.5" resolved "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz"