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

Set Login Year to 2023 #1899

Merged
merged 6 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions services/ui-src/src/views/AdminHome/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import * as CUI from "@chakra-ui/react";
import { stateAbbreviations } from "utils/constants";
import { useNavigate } from "react-router";
import config from "config";
import { useFlags } from "launchdarkly-react-client-sdk";

export const AdminHome = () => {
const [locality, setLocality] = useState("AL");
const releaseYearByFlag = useFlags()
ailZhou marked this conversation as resolved.
Show resolved Hide resolved
? config.currentReportingYear
: parseInt(config.currentReportingYear) - 1;
const navigate = useNavigate();
return (
<CUI.Container maxW="7xl" py="4">
Expand All @@ -26,9 +30,7 @@ export const AdminHome = () => {
</CUI.Select>
<CUI.Button
colorScheme="blue"
onClick={() =>
navigate(`/${locality}/${config.currentReportingYear}`)
}
onClick={() => navigate(`/${locality}/${releaseYearByFlag}`)}
isFullWidth
data-cy="Go To State Home"
>
Expand Down
6 changes: 5 additions & 1 deletion services/ui-src/src/views/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import * as CUI from "@chakra-ui/react";
import "./index.module.scss";
import * as QMR from "components";
import { useUser } from "hooks/authHooks";
import { useFlags } from "launchdarkly-react-client-sdk";

export function Home() {
const { userRole, userState } = useUser();
const releaseYearByFlag = useFlags()
ailZhou marked this conversation as resolved.
Show resolved Hide resolved
? config.currentReportingYear
: parseInt(config.currentReportingYear) - 1;
if (
userRole === UserRoles.HELP ||
userRole === UserRoles.ADMIN ||
Expand All @@ -27,5 +31,5 @@ export function Home() {
</CUI.Box>
);
}
return <Navigate to={`/${userState}/${config.currentReportingYear}`} />;
return <Navigate to={`/${userState}/${releaseYearByFlag}`} />;
}
Loading