diff --git a/src/components/extensive/BlurContainer/BlurContainer.tsx b/src/components/extensive/BlurContainer/BlurContainer.tsx
index 84bacd87d..a99c82929 100644
--- a/src/components/extensive/BlurContainer/BlurContainer.tsx
+++ b/src/components/extensive/BlurContainer/BlurContainer.tsx
@@ -6,7 +6,7 @@ import Text from "@/components/elements/Text/Text";
export interface BlurContainerProps {
isBlur: boolean;
- textInformation?: string;
+ textInformation?: string | React.ReactNode;
children: React.ReactNode;
className?: string;
}
@@ -16,6 +16,21 @@ const BlurContainer = ({ isBlur, textInformation, children, className, ...props
return <>{children}>;
}
+ const LoginText = () => (
+ <>
+
+ Login to view.
+ {" "}
+ If you are a funder or representing a government agency, please{" "}
+
+ click here to request an account.
+
+ >
+ );
+
return (
-
+
- {textInformation}
+ {typeof textInformation === "string" ? textInformation : }
diff --git a/src/components/extensive/PageElements/Card/PageCard.tsx b/src/components/extensive/PageElements/Card/PageCard.tsx
index 3bd4faf1e..4336ad5ac 100644
--- a/src/components/extensive/PageElements/Card/PageCard.tsx
+++ b/src/components/extensive/PageElements/Card/PageCard.tsx
@@ -8,6 +8,7 @@ import EmptyField, { EmptyFieldProps } from "@/components/elements/Field/EmptyFi
import Paper from "@/components/elements/Paper/Paper";
import Text from "@/components/elements/Text/Text";
import ToolTip from "@/components/elements/Tooltip/Tooltip";
+import { useMyUser } from "@/connections/User";
import { NO_DATA_INFORMATION } from "@/constants/dashboardConsts";
import { withFrameworkShow } from "@/context/framework.provider";
import { TextVariants } from "@/types/common";
@@ -55,6 +56,7 @@ const PageCard = ({
const [collapseSubtile, setCollapseSubtile] = useState(true);
const [subtitleText, setSubtitleText] = useState(subtitle);
const t = useT();
+ const [, { user }] = useMyUser();
const maxLength = 278;
@@ -68,7 +70,7 @@ const PageCard = ({
return (
-
+ >}>
diff --git a/src/middleware.page.ts b/src/middleware.page.ts
index 08af842f4..632f643da 100644
--- a/src/middleware.page.ts
+++ b/src/middleware.page.ts
@@ -14,6 +14,10 @@ export async function middleware(request: NextRequest) {
const accessToken = request.cookies.get("accessToken")?.value;
const middlewareCache = request.cookies.get(MiddlewareCacheKey)?.value;
+ if (request.nextUrl.pathname.startsWith("/dashboard")) {
+ return NextResponse.next();
+ }
+
if (!!accessToken && !!middlewareCache) {
// Skip middleware for dashboard routes to prevent redirect loop
if (request.nextUrl.pathname.startsWith("/dashboard")) {
@@ -37,7 +41,9 @@ export async function middleware(request: NextRequest) {
matcher.startWith("/auth")?.next();
matcher.exact("/")?.next();
- matcher.redirect("/auth/login");
+ if (!matcher.hasMatch()) {
+ matcher.redirect("/auth/login");
+ }
},
async () => {
// The redux store isn't available yet at this point, so we do a quick manual users/me fetch
diff --git a/src/pages/dashboard/index.page.tsx b/src/pages/dashboard/index.page.tsx
index 975577eca..2f1f91679 100644
--- a/src/pages/dashboard/index.page.tsx
+++ b/src/pages/dashboard/index.page.tsx
@@ -8,6 +8,7 @@ import BlurContainer from "@/components/extensive/BlurContainer/BlurContainer";
import Icon, { IconNames } from "@/components/extensive/Icon/Icon";
import PageCard from "@/components/extensive/PageElements/Card/PageCard";
import PageRow from "@/components/extensive/PageElements/Row/PageRow";
+import { useMyUser } from "@/connections/User";
import {
CHART_TYPES,
JOBS_CREATED_CHART_TYPE,
@@ -57,6 +58,7 @@ export interface GraphicLegendProps {
const Dashboard = () => {
const t = useT();
+ const [, { user }] = useMyUser();
const { filters, setFilters, frameworks } = useDashboardContext();
const {
dashboardHeader,
@@ -283,7 +285,7 @@ const Dashboard = () => {
>}
>
{dashboardHeader.map((item, index) => (
diff --git a/src/utils/MiddlewareMatcher.ts b/src/utils/MiddlewareMatcher.ts
index e8f431317..604c203fb 100644
--- a/src/utils/MiddlewareMatcher.ts
+++ b/src/utils/MiddlewareMatcher.ts
@@ -6,6 +6,7 @@ type CallbackInterface = () => Response | null;
export class MiddlewareMatcher {
private request: NextRequest;
private result?: Response | null;
+ private hasMatchOccurred: boolean = false;
constructor(request: NextRequest) {
this.request = request;
@@ -27,17 +28,20 @@ export class MiddlewareMatcher {
this.cache(_url);
}
+ this.hasMatchOccurred = true;
return output;
} else {
return null;
}
}
+
/**
* Continue response without any change
* @returns Next response
*/
next() {
this.setResult(() => NextResponse.next());
+ this.hasMatchOccurred = true;
return this;
}
@@ -96,6 +100,14 @@ export class MiddlewareMatcher {
return this.when(this.request.nextUrl.pathname !== url);
}
+ /**
+ * Check if any matches have occurred
+ * @returns boolean indicating if any matches have occurred
+ */
+ hasMatch(): boolean {
+ return this.hasMatchOccurred;
+ }
+
/**
* set matcher result if there is none
* @param callback response handler