Skip to content

Commit

Permalink
Merge pull request #373 from USEPA/feature/post-vite-transition-updates
Browse files Browse the repository at this point in the history
Feature/post vite transition updates
  • Loading branch information
courtneymyers authored Oct 9, 2023
2 parents 824d8ce + 28abc2d commit c32f4a6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 44 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ jobs:

- name: Build front-end files and move to server
run: |
PUBLIC_URL="$SERVER_URL" \
VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \
VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \
VITE_CLOUD_SPACE="$CLOUD_SPACE" \
VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \
VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ jobs:

- name: Build front-end files and move to server
run: |
PUBLIC_URL="$SERVER_URL" \
VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \
VITE_SERVER_BASE_PATH="$SERVER_BASE_PATH" \
VITE_CLOUD_SPACE="$CLOUD_SPACE" \
VITE_FORMIO_BASE_URL="$FORMIO_BASE_URL" \
VITE_FORMIO_PROJECT_NAME="$FORMIO_PROJECT_NAME" \
Expand Down
26 changes: 1 addition & 25 deletions app/client/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,10 @@
/>
<meta property="DC.title" content="CSB Rebate Forms Application" />
<meta property="DC.type" content="Data and Tools" />
<meta property="og:site_name" content="US EPA" />
<meta property="og:type" content="website" />
<meta property="og:url" content="%PUBLIC_URL%/" />
<meta property="og:title" content="CSB Rebate Forms Application | US EPA" />
<meta
property="og:description"
content="U.S. EPA CSB Rebate Forms Application"
/>
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:updated_time" content="2022-03-01" />
<meta property="og:country_name" content="United States of America" />
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:description"
content="U.S. EPA CSB Rebate Forms Application"
/>
<meta
name="twitter:title"
content="CSB Rebate Forms Application | US EPA"
/>
<meta name="twitter:url" content="%PUBLIC_URL%/" />
<meta name="twitter:image:height" content="600" />
<meta name="twitter:image:width" content="1200" />
<meta name="msapplication-TileColor" content="#005ea2" />
<meta name="theme-color" content="#005ea2" />
<link rel="manifest" href="./manifest.json" />
<link rel="canonical" href="%PUBLIC_URL%/" />
<link rel="canonical" href="./" />
<link
rel="apple-touch-icon-precomposed"
sizes="196x196"
Expand Down
12 changes: 0 additions & 12 deletions app/client/src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,6 @@ function useInactivityDialog(callback: () => void) {
}, [dialogShown, heading, countdownSeconds, updateDialogDescription]);
}

/** Custom hook to check if user should have access to the helpdesk page */
export function useHelpdeskAccess() {
const user = useUserData();
const userRoles = user?.memberof.split(",") || [];

return !user
? "pending"
: userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk")
? "success"
: "failure";
}

function ProtectedRoute() {
const { pathname } = useLocation();

Expand Down
8 changes: 6 additions & 2 deletions app/client/src/components/userDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import uswds from "@formio/uswds";
import icons from "uswds/img/sprite.svg";
// ---
import { serverUrl, formioBaseUrl, formioProjectUrl } from "@/config";
import { useConfigQuery, useBapSamQuery, useBapSamData } from "@/utilities";
import { useHelpdeskAccess } from "@/components/app";
import {
useHelpdeskAccess,
useConfigQuery,
useBapSamQuery,
useBapSamData,
} from "@/utilities";
import { Loading } from "@/components/loading";
import { useDialogActions } from "@/contexts/dialog";

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/routes/helpdesk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
getData,
postData,
useContentData,
useHelpdeskAccess,
submissionNeedsEdits,
} from "@/utilities";
import { useHelpdeskAccess } from "@/components/app";
import { Loading } from "@/components/loading";
import { Message } from "@/components/message";
import { MarkdownContent } from "@/components/markdownContent";
Expand Down
12 changes: 12 additions & 0 deletions app/client/src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,18 @@ export function useUserData() {
return queryClient.getQueryData<UserData>(["user"]);
}

/** Custom hook to check if user should have access to the helpdesk page */
export function useHelpdeskAccess() {
const user = useUserData();
const userRoles = user?.memberof.split(",") || [];

return !user
? "pending"
: userRoles.includes("csb_admin") || userRoles.includes("csb_helpdesk")
? "success"
: "failure";
}

/** Custom hook to fetch CSB config */
export function useConfigQuery() {
return useQuery({
Expand Down

0 comments on commit c32f4a6

Please sign in to comment.