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

Towards web standards 🎖️ #3355

Draft
wants to merge 103 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
e55dfd7
cognito class
ap-justin Sep 15, 2024
6867443
oauth code flow
ap-justin Sep 15, 2024
29551ac
oauth in loader
ap-justin Sep 15, 2024
fb1d02c
remove aws-amplify
ap-justin Sep 15, 2024
aca1425
revert stringify
ap-justin Sep 15, 2024
5baaaca
temp:storage
ap-justin Sep 15, 2024
9dedc60
convert to query state
ap-justin Oct 10, 2024
8abebf6
remove log
ap-justin Oct 10, 2024
71aa924
convert loc state to state param
ap-justin Oct 10, 2024
5edfb87
use state helper
ap-justin Oct 10, 2024
96fefb2
state to params
ap-justin Oct 10, 2024
53eb738
marketplace native
ap-justin Oct 11, 2024
f855a8a
remove header links hook
ap-justin Oct 11, 2024
0422292
preserve scroll filter
ap-justin Oct 11, 2024
4334a88
different root headers
ap-justin Oct 11, 2024
e07495b
remove unused
ap-justin Oct 11, 2024
a1d6499
remove unused
ap-justin Oct 11, 2024
04f6122
revert Img
ap-justin Oct 11, 2024
a305a0d
remove unused
ap-justin Oct 11, 2024
a416d73
remove unused
ap-justin Oct 11, 2024
b3392ec
from values
ap-justin Oct 11, 2024
4b9ed0f
pagination
ap-justin Oct 12, 2024
c91cd49
profile loading
ap-justin Oct 12, 2024
88fcef1
handle oauth redirect
ap-justin Oct 13, 2024
fb4cbcf
move to auth
ap-justin Oct 13, 2024
92dad1b
persist auth
ap-justin Oct 13, 2024
8f6e526
custom attribute in signup + loader redirect
ap-justin Oct 13, 2024
c9cf9a6
signin redirect in loader
ap-justin Oct 13, 2024
9e5bc1d
remove unused
ap-justin Oct 13, 2024
5e59f57
bookmarks and endows
ap-justin Oct 13, 2024
b44228d
user user in reg
ap-justin Oct 13, 2024
d19b7b5
overwrite _s
ap-justin Oct 13, 2024
6e1044d
welcome
ap-justin Oct 13, 2024
3c60810
cache get user endows
ap-justin Oct 14, 2024
66a059d
home endows loader
ap-justin Oct 14, 2024
9f697ec
admin use load auth
ap-justin Oct 14, 2024
84ed0af
endow profile loader
ap-justin Oct 14, 2024
b92a1e3
use fetcher instead of exposing page param
ap-justin Oct 14, 2024
37f0e95
dashboard loader
ap-justin Oct 14, 2024
dc1734f
dashboard loader not deferred
ap-justin Oct 14, 2024
8a83475
settings loader
ap-justin Oct 14, 2024
cbf0674
charity donations loader
ap-justin Oct 15, 2024
3980ecf
temp disable App.test
ap-justin Oct 15, 2024
991f906
remove extra admin layout nesting
ap-justin Oct 15, 2024
17c1d8d
user loader and layout
ap-justin Oct 15, 2024
41fe3e8
widget configurer
ap-justin Oct 15, 2024
85adb38
donate widget fix
ap-justin Oct 15, 2024
cb008c2
seo is not needed in dashboards
ap-justin Oct 15, 2024
3a36c06
update tests
ap-justin Oct 15, 2024
389259e
single endow query
ap-justin Oct 15, 2024
0b7cc8f
banking applications
ap-justin Oct 15, 2024
1fb0066
endow banking
ap-justin Oct 15, 2024
a7f9371
determine when to use nextPage
ap-justin Oct 16, 2024
4e54dd0
remove search from url
ap-justin Oct 16, 2024
f0f58c0
limit root loader reloading
ap-justin Oct 16, 2024
5473739
revalidate logout action
ap-justin Oct 16, 2024
2b8c52f
admin mebmers query
ap-justin Oct 16, 2024
fac4bd5
cache bookmarks
ap-justin Oct 16, 2024
9696c1d
programs and media
ap-justin Oct 16, 2024
0a29413
home search fetcher
ap-justin Oct 16, 2024
a2d44ff
bookmark btn query
ap-justin Oct 16, 2024
8082825
move logout to root loader
ap-justin Oct 16, 2024
65e67b6
fix ts error
ap-justin Oct 17, 2024
ab17f9e
applications query
ap-justin Oct 17, 2024
92bfd33
applications query
ap-justin Oct 17, 2024
56e38d0
applications filter use params
ap-justin Oct 17, 2024
d33c532
remove unused
ap-justin Oct 17, 2024
88f7a68
query by ein
ap-justin Oct 17, 2024
20eace9
reg query and actions
ap-justin Oct 18, 2024
68885b1
sign error with fetcher
ap-justin Oct 18, 2024
5afb2e5
prompt routes
ap-justin Oct 18, 2024
b6a759d
remove review endpoint
ap-justin Oct 19, 2024
25dc0d3
bookmark actions
ap-justin Oct 19, 2024
2e35f60
settings update action
ap-justin Oct 19, 2024
eb9d334
edit endowment
ap-justin Oct 19, 2024
4ca3bbf
dashboard loaders and actions
ap-justin Oct 19, 2024
ad9156c
user donations
ap-justin Oct 19, 2024
e359008
program create delete
ap-justin Oct 19, 2024
532655f
remove unused
ap-justin Oct 19, 2024
3ea90a9
programs loader and actions
ap-justin Oct 19, 2024
1cfcede
no need to use ref
ap-justin Oct 19, 2024
090841f
milestone: conform
ap-justin Oct 21, 2024
ab38c44
temp:prompt container
ap-justin Oct 21, 2024
c5d7ed1
format icons
ap-justin Oct 28, 2024
7d2a03a
fix type error
ap-justin Oct 29, 2024
9ca1aa7
signin to action
ap-justin Oct 30, 2024
b3f5cf9
switch to valibot
ap-justin Oct 30, 2024
6703e23
toValibot
ap-justin Oct 30, 2024
dde3d3e
fixes
ap-justin Nov 8, 2024
1d4ab8d
signup fetcher
ap-justin Nov 8, 2024
caa5782
add grid containers
ap-justin Nov 8, 2024
c31b774
signup to actions
ap-justin Nov 9, 2024
fac0f9b
remove unused
ap-justin Nov 9, 2024
d335db4
wise out of rtk
ap-justin Nov 9, 2024
159debe
new banking to action
ap-justin Nov 9, 2024
89af3c2
remove unused
ap-justin Nov 9, 2024
1e38c1f
user payout method actions
ap-justin Nov 10, 2024
58dca6e
banking applications pagination
ap-justin Nov 10, 2024
c118bf6
remove unused
ap-justin Nov 10, 2024
0040f01
bank application to loader
ap-justin Nov 10, 2024
f237102
banking application update
ap-justin Nov 13, 2024
fdb8444
update react routerdom
ap-justin Nov 13, 2024
788e5a5
Merge branch 'master' into reg-state
ap-justin Nov 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
},
"dependencies": {
"@better-giving/assets": "1.0.18",
"@better-giving/endowment": "1.0.29",
"@better-giving/endowment": "1.0.31",
"@better-giving/registration": "1.0.24",
"@better-giving/schemas": "1.0.1",
"@better-giving/types": "1.0.1",
"@conform-to/dom": "1.2.2",
"@conform-to/react": "1.2.2",
"@gsap/react": "2.1.1",
"@headlessui/react": "2.1.0",
"@hookform/error-message": "2.0.1",
Expand All @@ -47,13 +49,15 @@
"@sentry/react": "8.22.0",
"@stripe/react-stripe-js": "2.7.1",
"@stripe/stripe-js": "3.5.0",
"aws-amplify": "6.3.6",
"conform-to-valibot": "1.11.0",
"cropperjs": "1.6.2",
"date-fns": "3.6.0",
"decimal.js": "10.4.3",
"framer-motion": "11.2.10",
"fuse.js": "7.0.0",
"gsap": "3.12.5",
"jose": "5.9.2",
"lodash": "4.17.21",
"lucide-react": "0.436.0",
"nprogress": "0.2.0",
"qrcode.react": "3.1.0",
Expand All @@ -69,9 +73,10 @@
"react-hook-form": "7.53.0",
"react-player": "2.16.0",
"react-redux": "9.1.2",
"react-router-dom": "6.23.0",
"react-router-dom": "6.24.0",
"sonner": "1.7.0",
"swiper": "11.1.4",
"swr": "2.2.5",
"type-fest": "4.20.0",
"valibot": "0.42.0",
"yup": "1.4.0"
Expand All @@ -86,6 +91,7 @@
"@testing-library/jest-dom": "6.4.6",
"@testing-library/react": "16.0.0",
"@testing-library/user-event": "14.5.2",
"@types/lodash": "4.17.10",
"@types/node": "18.18.13",
"@types/nprogress": "^0",
"@types/react": "18.2.62",
Expand Down
73 changes: 49 additions & 24 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import { appRoutes, donateWidgetRoutes } from "constants/routes";
import ModalContext from "contexts/ModalContext";
import { RouterErrorBoundary } from "errors/ErrorBoundary";
import useScrollTop from "hooks/useScrollTop";
import { ErrorElement } from "errors/ErrorElement";
import NProgress from "nprogress";
import { adminRoute } from "pages/Admin";
import { promptRoutes, reviewRoute } from "pages/Application/review-route";
import { bankApplicationRoute } from "pages/BankingApplication";
import { routes as blogRoutes } from "pages/Blog";
import { legalRoutes } from "pages/Legal";
import OAuthRedirector from "pages/OAuthRedirector";
import { profileRoute } from "pages/Profile";
import { route as regRoute } from "pages/Registration";
import { signUpRoute } from "pages/SignUp";
import { userDashboardRoute } from "pages/UserDashboard";
import { Component as Widget, loader as widgetLoader } from "pages/Widget";
import { infoRoutes } from "pages/informational";
import { useEffect } from "react";
import {
Navigate,
Outlet,
type RouteObject as RO,
useLocation,
ScrollRestoration,
useNavigation,
} from "react-router-dom";
import { Toaster } from "sonner";
import Layout from "./Layout";
import { rootAction } from "./root-action";
import { rootLoader } from "./root-loader";

const donateThanks = import("pages/DonateThanks");
const stripePaymentStatus = import("pages/StripePaymentStatus");
const widget = import("pages/Widget");

const widgetRoutes: RO[] = [
{ path: ":id", lazy: () => import("pages/DonateWidget") },
Expand All @@ -37,78 +41,87 @@ const widgetRoutes: RO[] = [

//routes between header/footer
const _appRoutes: RO[] = [
adminRoute,
regRoute,
userDashboardRoute,
...blogRoutes,
...legalRoutes,
...infoRoutes,
{
element: <Outlet context={true} />, //outlet-value: legacy
children: [{ path: appRoutes.profile + "/:id", ...profileRoute }],
},

{ path: appRoutes.profile + "/:id", ...profileRoute },
{
path: appRoutes.banking_applications,
children: [
{ path: ":id", lazy: () => import("pages/BankingApplication") },
bankApplicationRoute,
{ index: true, lazy: () => import("pages/BankingApplications") },
],
},
{
path: appRoutes.applications,
children: [
{ path: ":id", lazy: () => import("pages/Application") },
{
path: ":id",
lazy: () => import("pages/Application"),
errorElement: <ErrorElement />,
children: [reviewRoute, ...promptRoutes],
},
{ index: true, lazy: () => import("pages/Applications") },
],
},
{ path: appRoutes.donate_thanks, lazy: () => donateThanks },
{ path: appRoutes.stripe_payment_status, lazy: () => stripePaymentStatus },
{ path: appRoutes.signin, lazy: () => import("pages/Signin") },
{ path: appRoutes.signup, lazy: () => import("pages/SignUp") },
signUpRoute,
{ path: appRoutes.reset_password, lazy: () => import("pages/ResetPassword") },
{ path: appRoutes.auth_redirector, element: <OAuthRedirector /> },
{
path: appRoutes.marketplace,
lazy: () => import("pages/Marketplace"),
children: [
{ index: true, lazy: () => import("pages/Marketplace") },
{ path: ":id", ...profileRoute },
{ path: "filter", lazy: () => import("pages/Marketplace/Filter") },
],
},
{ path: appRoutes.marketplace + "/:id", ...profileRoute },
{
path: appRoutes.form_builder,
loader: widgetLoader,
// Widget.tsx is also used as one of the Admin pages and so
// where its styles depend on the width of the parent component;
// We copy/paste src/pages/Admin/Layout.tsx container setup & styles
// here so that Widget.tsx styles are applied correctly on both pages.
element: (
<div className="px-6 py-8 md:p-10 @container">
<Outlet />
<Widget />
</div>
),
children: [{ index: true, lazy: () => widget }],
},
{ index: true, lazy: () => import("pages/Home") },
];

const rootRoutes: RO[] = [
{ path: `${appRoutes.donate}/:id`, lazy: () => import("pages/Donate") },
{ index: true, lazy: () => import("pages/Home") },
{
path: `${appRoutes.donate}/:id`,
lazy: () => import("pages/Donate"),
},
adminRoute,
//outlet-value: isInWidget/widgetVersion
{ element: <Layout />, children: _appRoutes },
{
path: appRoutes.donate_widget,
element: <Outlet context={true} />, //outlet-value: isInWidget/widgetVersion
children: widgetRoutes,
},
{ path: "*", element: <Navigate to="/" /> },
];

export const routes: RO[] = [
{
id: "root",
path: "/",
element: <RootLayout />,
loader: rootLoader,
action: rootAction,
children: rootRoutes,
ErrorBoundary: RouterErrorBoundary,
ErrorBoundary: ErrorElement,
},
{ path: "*", element: <Navigate to="/" /> },
];

NProgress.configure({
Expand All @@ -125,12 +138,24 @@ function RootLayout() {
else NProgress.start();
}, [transition.state]);

const location = useLocation();
useScrollTop(location.pathname);
useEffect(() => {
console.log("reloaded");
return () => {
caches.open("bg").then((c) => {
c.keys().then((ks) => {
for (const k of ks) {
c.delete(k);
}
});
});
};
}, []);

return (
<ModalContext>
<ScrollRestoration />
<Outlet />
<Toaster richColors position="top-right" closeButton />
<Toaster richColors position="bottom-right" closeButton />
</ModalContext>
);
}
32 changes: 0 additions & 32 deletions src/App/Footer/Links.tsx

This file was deleted.

81 changes: 0 additions & 81 deletions src/App/Footer/Newsletter/SubscriptionForm.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/App/Footer/index.tsx

This file was deleted.

37 changes: 37 additions & 0 deletions src/App/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { NavDropdown, UserMenu } from "components/Header";
import { DappLogo } from "components/Image";
import { authRoutes } from "constants/routes";
import { useLocation, useRouteLoaderData } from "react-router-dom";
import type { DetailedUser } from "types/auth";

type Props = { classes?: string };

export default function Header({ classes }: Props) {
const user = useRouteLoaderData("root") as DetailedUser | null;
const location = useLocation();
const isInAuth = authRoutes.includes(location.pathname);

return (
<header
className={`${classes} bg-white`}
ref={(node) => {
if (!node) return;
const observer = new IntersectionObserver(
([e]) => {
const isIntersecting = e.intersectionRatio < 1;
e.target.classList.toggle("shadow-lg", isIntersecting);
},
{ threshold: [1] }
);
observer.observe(node);
}}
>
<div className="grid grid-cols-[1fr_auto_auto] items-center gap-4 padded-container py-2">
<DappLogo classes="w-48 h-12" />

{!isInAuth && <UserMenu classes="max-sm:hidden" />}
<NavDropdown isInAuth={isInAuth} user={user} />
</div>
</header>
);
}
Loading
Loading