Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 8 additions & 6 deletions app/src/WebsiteRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const BrandWritingPage = lazy(() => import('./pages/BrandWriting.page'));
const ClaudePluginsPage = lazy(() => import('./pages/ClaudePlugins.page'));
const DonatePage = lazy(() => import('./pages/Donate.page'));
const OrgLogosEmbedPage = lazy(() => import('./pages/embed/OrgLogosEmbed.page'));
const ModelPage = lazy(() => import('./pages/Model.page'));
const PrivacyPage = lazy(() => import('./pages/Privacy.page'));
const ResearchPage = lazy(() => import('./pages/Research.page'));
const SupportersPage = lazy(() => import('./pages/Supporters.page'));
Expand All @@ -38,6 +37,13 @@ function BlogRedirect() {
return <Navigate to={`../research/${postName}`} replace />;
}

// Full-page redirect to /model (handled by Vercel rewrite, not React Router)
function MethodologyRedirect() {
const { countryId } = useParams();
window.location.replace(`/${countryId}/model`);
return null;
}

const router = createBrowserRouter(
[
{
Expand Down Expand Up @@ -82,7 +88,7 @@ const router = createBrowserRouter(
},
{
path: 'methodology',
element: <Navigate to="../model" replace />,
element: <MethodologyRedirect />,
},
{
path: 'support',
Expand Down Expand Up @@ -120,10 +126,6 @@ const router = createBrowserRouter(
path: 'ai-inequality',
element: <AIGrowthResearchPage />,
},
{
path: 'model',
element: <ModelPage />,
},
{
path: 'claude-plugin',
element: <ClaudePluginsPage />,
Expand Down
6 changes: 4 additions & 2 deletions app/src/components/homeHeader/NavItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export interface NavItemSetup {
href?: string;
hasDropdown: boolean;
dropdownItems?: DropdownItem[];
/** Force full page load instead of SPA navigation (for Vercel-rewritten routes) */
reloadDocument?: boolean;
}

interface NavItemProps {
Expand Down Expand Up @@ -184,7 +186,7 @@ function AppleDropdown({
* Can be either a simple link or a dropdown menu.
*/
export default function NavItem({ setup }: NavItemProps) {
const { label, onClick, href, hasDropdown, dropdownItems } = setup;
const { label, onClick, href, hasDropdown, dropdownItems, reloadDocument } = setup;
const [dropdownOpen, setDropdownOpen] = useState(false);
const containerRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -259,7 +261,7 @@ export default function NavItem({ setup }: NavItemProps) {
// Relative paths use React Router's Link for SPA behavior
if (isInternalHref(href)) {
return (
<Link to={href} style={navItemStyle} {...hoverHandlers}>
<Link to={href} reloadDocument={reloadDocument} style={navItemStyle} {...hoverHandlers}>
{label}
</Link>
);
Expand Down
1 change: 1 addition & 0 deletions app/src/components/shared/HomeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function HeaderNavigation({ navbarOpened, onToggleNavbar }: Heade
label: 'Model',
href: getWebsitePath('/model'),
hasDropdown: false,
reloadDocument: true,
},
{
label: 'About',
Expand Down
4 changes: 4 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"source": "/us/taxsim/:path*",
"destination": "https://policyengine-taxsim-policy-engine.vercel.app/us/taxsim/:path*"
},
{
"source": "/:countryId/model",
"destination": "https://policyengine-model.vercel.app/?country=:countryId"
},
{ "source": "/(.*)", "destination": "/website.html" }
],
"headers": [
Expand Down