Skip to content

Commit

Permalink
Merge branch 'OCD-4700' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
mattystank committed Mar 4, 2025
2 parents 58425c8 + ac6dede commit 0969568
Show file tree
Hide file tree
Showing 48 changed files with 368 additions and 124 deletions.
18 changes: 14 additions & 4 deletions src/app/components/change-request/change-requests.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react';
import { makeStyles } from '@material-ui/core';
import { arrayOf, string } from 'prop-types';

import ChplChangeRequestsView from './change-requests-view';
Expand All @@ -12,6 +13,12 @@ import {
} from 'components/filter';
import { AnalyticsContext, useAnalyticsContext } from 'shared/contexts';

const useStyles = makeStyles({
fixFooterSpacing: {
minHeight: 'calc(100vh - 283px)',
},
});

const staticFilters = [{
...defaultFilter,
key: 'currentStatusChangeDateTime',
Expand Down Expand Up @@ -58,6 +65,7 @@ function ChplChangeRequests(props) {
const { analytics } = useAnalyticsContext();
const [filters, setFilters] = useState(staticFilters);
const crtQuery = useFetchChangeRequestTypes();
const classes = useStyles();

useEffect(() => {
setFilters((f) => f.filter((filter) => !disallowedFilters.includes(filter.key)));
Expand Down Expand Up @@ -99,10 +107,12 @@ function ChplChangeRequests(props) {
filters={filters}
storageKey="storageKey-changeRequestsComponent"
>
<ChplChangeRequestsView
disallowedFilters={disallowedFilters}
bonusQuery={bonusQuery}
/>
<div className={classes.fixFooterSpacing}>
<ChplChangeRequestsView
disallowedFilters={disallowedFilters}
bonusQuery={bonusQuery}
/>
</div>
</FilterProvider>
</AnalyticsContext.Provider>
);
Expand Down
5 changes: 4 additions & 1 deletion src/app/components/listing/confirm/confirm-developer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ const useStyles = makeStyles({
gap: '16px',
flexDirection: 'column',
},
fixFooterSpacing: {
minHeight: 'calc(100vh - 257px)',
},
formSubContainer: {
display: 'grid',
gap: '16px',
Expand Down Expand Up @@ -232,7 +235,7 @@ function ChplConfirmDeveloper(props) {
});

return (
<Container maxWidth="md">
<Container className={classes.fixFooterSpacing} maxWidth="md">
<div className={classes.developerConfirm}>
<div className={classes.developerSubContainer}>
<Button
Expand Down
15 changes: 9 additions & 6 deletions src/app/components/listing/confirm/confirm-product.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { arrayOf, func } from 'prop-types';
import { useFormik } from 'formik';
import * as yup from 'yup';

import theme from '../../../themes/theme';
import { product as productProp } from '../../../shared/prop-types';
import { ChplTextField } from '../../util';
import theme from 'themes/theme';
import { product as productProp } from 'shared/prop-types';
import { ChplTextField } from 'components/util';

const useStyles = makeStyles(() => ({
const useStyles = makeStyles({
buttonCard: {
padding: '32px',
display: 'flex',
Expand All @@ -41,6 +41,9 @@ const useStyles = makeStyles(() => ({
flexDirection: 'column',
whiteSpace: 'pre-wrap',
},
fixFooterSpacing: {
minHeight: 'calc(100vh - 257px)',
},
developerConfirm: {
display: 'grid',
gridTemplateColumns: '1fr',
Expand Down Expand Up @@ -96,7 +99,7 @@ const useStyles = makeStyles(() => ({
verticalDivider: {
height: '25%',
},
}));
});

const validationSchema = yup.object({
name: yup.string()
Expand Down Expand Up @@ -162,7 +165,7 @@ function ChplConfirmProduct(props) {

return (
<ThemeProvider theme={theme}>
<Container maxWidth="md">
<Container maxWidth="md" className={classes.fixFooterSpacing}>
<div className={classes.developerConfirm}>
<div className={classes.developerSubContainer}>
<Button
Expand Down
1 change: 1 addition & 0 deletions src/app/components/listing/confirm/confirm-version.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const useStyles = makeStyles(() => ({
gap: '32px',
padding: '32px 0',
alignItems: 'start',
paddingBottom: '26vh',
},
developerSubContainer: {
display: 'grid',
Expand Down
18 changes: 14 additions & 4 deletions src/app/components/surveillance/complaints/complaints.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useContext, useEffect, useState } from 'react';
import { arrayOf, bool, string } from 'prop-types';
import { makeStyles } from '@material-ui/core';

import ChplComplaintsView from './complaints-view';

Expand All @@ -15,6 +16,12 @@ import {
} from 'components/filter/filters';
import { AnalyticsContext, useAnalyticsContext, UserContext } from 'shared/contexts';

const useStyles = makeStyles({
fixFooterSpacing: {
minHeight: 'calc(100vh - 283px)',
},
});

const staticFilters = [{
...defaultFilter,
key: 'closedDate',
Expand Down Expand Up @@ -116,6 +123,7 @@ function ChplComplaints(props) {
const [disallowedFilters, setDisallowedFilters] = useState([]);
const [filters, setFilters] = useState(staticFilters);
const acbQuery = useFetchAcbs();
const classes = useStyles();

useEffect(() => {
if (acbQuery.isLoading || !acbQuery.isSuccess) {
Expand Down Expand Up @@ -173,10 +181,12 @@ function ChplComplaints(props) {
filters={filters}
storageKey="storageKey-complaintsComponent"
>
<ChplComplaintsView
bonusQuery={bonusQuery}
canAdd={canAdd}
/>
<div className={classes.fixFooterSpacing}>
<ChplComplaintsView
bonusQuery={bonusQuery}
canAdd={canAdd}
/>
</div>
</FilterProvider>
</AnalyticsContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const useStyles = makeStyles({
gridRowGap: '16px',
gridTemplateColumns: '1fr 1fr',
backgroundColor: '#ffffff',
padding: '8px',
padding: '8px 8px 35vh 8px',
},
fullWidth: {
gridColumn: '1 / -1',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,57 @@
import React, { useEffect, useState } from 'react';
import {
Box,
Button,
Container,
IconButton,
Typography,
makeStyles,
} from '@material-ui/core';
import ArrowForwardIcon from '@material-ui/icons/ArrowForward';

import { palette } from 'themes';
import { useFetchAnnouncements } from 'api/announcements';
import { getAngularService } from 'services/angular-react-helper';

const useStyles = makeStyles({
announcementBox: {
color: palette.white,
display: 'flex',
flexDirection: 'row',
width: '90%',
alignItems: 'center',
gridGap: '8px',
},
nextButton: {
display: 'flex',
justifyContent: 'flex-end',
gap: '4px',
},
footerAnnouncement: {
display: 'flex !important',
flexDirection: 'row',
alignItems: 'center',
width: '100%',
borderBottom: '2px solid #001f57 !important',
boxShadow: 'none',
zIndex: 999,
paddingBottom: '4px',
},
counter: {
marginLeft: 'auto',
marginRight: 'auto',
},
readMore: {
fontSize: '1.2rem',
},
});

function ChplAnnouncementsDisplay() {
const classes = useStyles();
const { data, isLoading, isSuccess } = useFetchAnnouncements({ getFuture: false });
const [announcements, setAnnouncements] = useState([]);
const [currentAnnouncementIndex, setCurrentAnnouncementIndex] = useState(0);
const $state = getAngularService('$state');

useEffect(() => {
if (isLoading || !isSuccess) {
Expand All @@ -13,17 +60,50 @@ function ChplAnnouncementsDisplay() {
setAnnouncements(data.sort((a, b) => (a.startDateTime < b.startDateTime ? -1 : 1)));
}, [data, isLoading, isSuccess]);

if (announcements.length === 0) { return null; }
let currentAnnouncement = {};
if (announcements.length > 0) {
currentAnnouncement = announcements[currentAnnouncementIndex];
}
const handleNext = () => {
setCurrentAnnouncementIndex((prevIndex) => (prevIndex + 1) % announcements.length);
};

return (
<>
{ announcements
.map((item) => (
<p key={item.id} className="announcement nav-text spaced-out badge">
{ item.title }
{ item.text ? `: ${item.text}` : ''}
</p>
))}
{announcements.length > 0 && (
<Container disableGutters className={classes.footerAnnouncement} maxWidth="lg">
{currentAnnouncement.id && (
<>
<Box className={classes.announcementBox} key={currentAnnouncement.id}>
<strong>
{currentAnnouncement.title.length > 25
? `${currentAnnouncement.title.substring(0, 25)}...`
: currentAnnouncement.title}
</strong>
{`${currentAnnouncement.text.substring(0, 140)}...`}
</Box>
<Button className={classes.readMore} variant="text" color="secondary" size="small" onClick={() => { $state.go('resources.overview'); window.scrollTo(0, 0); }}>Read more</Button>
</>
)}
{announcements.length > 1 && (
<>
<Box className={classes.counter}>
<Typography color="secondary" variant="body2">
{currentAnnouncementIndex + 1}
{' '}
/
{announcements.length}
</Typography>
</Box>
<Box className={classes.nextButton}>
<IconButton size="small" onClick={handleNext}>
<ArrowForwardIcon size="small" color="secondary" />
</IconButton>
</Box>
</>
)}
</Container>
)}
</>
);
}
Expand Down
7 changes: 5 additions & 2 deletions src/app/components/user/cognito-user-edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const useStyles = makeStyles({
display: 'grid',
gap: '8px',
},
fixFooterSpacing: {
minHeight : 'calc(100vh - 188px)',
},
});

const validationSchema = yup.object({
Expand Down Expand Up @@ -83,7 +86,7 @@ function ChplCognitoUserEdit({
});

return (
<>
<div className={classes.fixFooterSpacing}>
<Card>
<CardHeader
title="Edit User"
Expand Down Expand Up @@ -128,7 +131,7 @@ function ChplCognitoUserEdit({
errors={errors}
isDisabled={!formik.isValid}
/>
</>
</div>
);
}

Expand Down
1 change: 1 addition & 0 deletions src/app/components/user/users-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const useStyles = makeStyles({
display: 'flex',
flexDirection: 'column',
gap: '16px',
minHeight: 'calc(100vh - 188px)',
},
header: {
padding: '16px',
Expand Down
Loading

0 comments on commit 0969568

Please sign in to comment.