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

[Publisher][Design Update] Agency Settings: Account Tab Modals (excluding Jurisdictions) (3/5) #1257 #1327

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e9ad215
made major changes to the settings page components and all that is co…
corypride Apr 8, 2024
7376e1d
[Publisher][Design Update] Agency Settings: Settings page + Account T…
corypride Apr 15, 2024
be555c4
ran yarn lint --fix
corypride Apr 15, 2024
30b261e
manually removed extra space in code on AgencySettings.styles.tsx
corypride Apr 15, 2024
060568e
removed unused code from AgencySettingsEmailNotifications and AgencyS…
corypride Apr 16, 2024
e49cc66
Removed all files that are in the .gitignore
corypride Apr 16, 2024
029c8e6
removed TODO notes from AccountSettings.tsx and added suggested styli…
corypride Apr 17, 2024
14195cb
removed unused code, replaced custom colors with colors from the pale…
corypride Apr 18, 2024
1dc0aac
removed custom color and used color from palette and adjusted spacing…
corypride Apr 18, 2024
f431685
created custom components in AgencySettings.Styles to replace divs an…
corypride Apr 18, 2024
d3938fd
removed div and added styling to custom component in AgencySettings.s…
corypride Apr 18, 2024
23e1612
created a AgencySettingActionRequiredIndicator component and applied …
corypride Apr 19, 2024
8498118
removed duplicate input component and used an existing one from the c…
corypride Apr 22, 2024
d80d048
Added flags to Input.tsx and new styles to Input.styled.tsx
corypride Apr 22, 2024
14aaa4b
Removed duplicate button componenet
corypride Apr 23, 2024
88956c7
used the checkboxOptions component to replace an input checkbox in Ag…
corypride Apr 24, 2024
a234b4e
removed unnecessary styling inheritance and made a meaningful name fo…
corypride Apr 24, 2024
a11e975
simplified logic on AgencySettingsActionRequiredIndicator in the Agen…
corypride Apr 25, 2024
6ca5aa5
changed a variable name
corypride Apr 25, 2024
c1ec59c
added settigsViewOptions object in prep for using common tabbed bar c…
corypride Apr 26, 2024
622cd3a
added TabbedBar component to Settings page
corypride Apr 26, 2024
67d7017
removed unused logic on Input.tsx
corypride Apr 29, 2024
1a360a1
removed unused logic on Input.tsx
corypride Apr 29, 2024
1010667
added close-icon-lg.svg to the assets folder
corypride Apr 30, 2024
8143663
refactored const SettigsViewOptions to use the tabOptions enum in the…
corypride Apr 30, 2024
8516451
removed log statement and removed const declaration from tabOptions …
corypride Apr 30, 2024
409c3ca
moved tabOptions enum outside of the Settings function
corypride Apr 30, 2024
df2d63a
modified label on settingViewOptions to remove underscore from Team_M…
corypride Apr 30, 2024
eceab5e
cleaned up logic statement in AgencySettingsSupervisions
corypride Apr 30, 2024
20f48af
added logic to DescriptionSection in the AgencySettingsEmailNotificat…
corypride Apr 30, 2024
a2a45fa
modified subpopulations modal by left-aligning options
corypride Apr 30, 2024
139fe9b
removed const systemsToDisplayInReadMode from AgencySettingSupervison…
corypride Apr 30, 2024
ea55ab9
renamed the SettingsTitle component -- SettingsTitleContainer and spl…
corypride Apr 30, 2024
27c4aff
updated the 'Learn More' link on the Settings page to point to the se…
corypride Apr 30, 2024
2946b4c
replaced styling to the NewInput component in Input.styled.tsx
corypride May 1, 2024
1252349
removed unused code in Input component
corypride May 1, 2024
d4bcb78
updated tabOptions enum on Settings page
corypride May 1, 2024
6742055
changed variable name on Settings page
corypride May 1, 2024
7cb95b2
updated initial value of the const currentSettingsView on the Setting…
corypride May 3, 2024
e9062d1
changed logic for the AgencySettingActionRequiredIndicator to depend …
corypride May 4, 2024
9abd1ba
added onClickClose function option to the Modal component, added the …
corypride May 2, 2024
4cc2114
added email edit modal to the AccountSetting page
corypride May 3, 2024
04a3087
updated Modal and Input to allow custom styling options
corypride May 4, 2024
7cf2f98
started adding custom styling to Modal and Input that will apply to t…
corypride May 6, 2024
27db178
started adding custom styling to Modal and Input that will apply to t…
corypride May 6, 2024
853bb58
added custom styling to AccountSettings Modal and the Modal input
corypride May 6, 2024
8db8314
updated styling for the modal on AgencySettingsDescription
corypride May 6, 2024
f8d2b9e
Merge branch 'cory/agency-settings-design-udpates-feature' into cory/…
corypride May 7, 2024
27fd311
updated styling on AgencySettingsURL edit modal
corypride May 7, 2024
d89c477
added email validation to AccountSettings page
corypride May 8, 2024
482c40f
added email url validation and styling to the AccountSettings page
corypride May 9, 2024
80b0f8e
updated the validateAgencyURL logic
corypride May 9, 2024
4dca8f9
removed unused logic in helperUtils
corypride May 9, 2024
b2dcac4
ran linting
corypride May 9, 2024
7134a8e
added url validation and styling to the AgencySettings page
corypride May 10, 2024
730cadd
ran linting
corypride May 10, 2024
5b36339
caught bug in validateURL logic that did not meet figma specs for val…
corypride May 10, 2024
1c27f6c
refactored regex on helpUtils validateAgencyURL function
corypride May 10, 2024
8cf4bf8
refactored validatAgencyURL function's regex
corypride May 10, 2024
d728b65
removed hover styling on button if the logic determines that there sh…
corypride May 10, 2024
410c3f5
made adjustments to AccountSettings AccountSettingsDescription and UR…
corypride May 13, 2024
c0b8658
removed unused logic from Modal.tsx. Adjusted AccountSettings and Age…
corypride May 13, 2024
14d712f
adjusted AccountSettings, AgencySettingsDescription, and AgencySettin…
corypride May 14, 2024
00f2e2a
removed uneccessary logic from validateEmail function in helperUtils …
corypride May 14, 2024
08ee377
updated AgencySettingSupervisions and UnsavedChanges modals according…
corypride May 15, 2024
849fbd4
ran linting
corypride May 15, 2024
a971236
refactored title and searchbar area of AgencySettingsJurisdictions page
corypride May 16, 2024
f6105d2
finished refactoring of searchbar for AgencySettingsJurisdictions page
corypride May 16, 2024
ca8f83d
finished refactoring of searchbar for AgencySettingsJurisdictions page
corypride May 16, 2024
277b5fc
removed opacity setting on Button component
corypride May 16, 2024
77f6d78
adjusted the logic in the onClickClose function on the AccountSetting…
corypride May 16, 2024
3bcc6cc
renamed editModeAndTypeUpdate function to resetEditModeTypeStates and…
corypride May 17, 2024
2418fe2
updated spacing to all agency and account settings modals
corypride May 20, 2024
a8f4501
updated validation of URL and Email to check validation on change
corypride May 20, 2024
e2c3d11
ran linting
corypride May 20, 2024
2261e03
cleaned up logic on AgencySettings pages removed unused code
corypride May 21, 2024
f579a7b
fixed bug in AgencySettingURL error checking logic and removed the ca…
corypride May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 16 additions & 3 deletions common/components/Button/Button.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Button = styled.div<{
noSidePadding?: boolean;
noTopBottomPadding?: boolean;
noHover?: boolean;
agencySettingsConfigs?: boolean;
}>`
${({ size }) => (size ? typography.sizeCSS[size] : typography.body)};
display: flex;
Expand All @@ -46,7 +47,8 @@ export const Button = styled.div<{
border-radius: 3px;
gap: 8px;
white-space: nowrap;
min-width: 80px;
min-width: ${({ agencySettingsConfigs }) =>
agencySettingsConfigs ? "unset" : "80px"};
pointer-events: ${({ disabled }) => disabled && "none"};
background-color: ${({ buttonColor, disabled }) => {
if (disabled) return palette.highlight.grey3;
Expand All @@ -66,7 +68,17 @@ export const Button = styled.div<{
}
return "none";
}};
padding: ${({ size }) => (size === "medium" ? "16px 32px" : "10px 15px")};

padding: ${({ size, agencySettingsConfigs }) => {
if (agencySettingsConfigs) {
return "0";
}
if (size) {
return "16px 32px";
}
return "10px 15px";
}};

${({ noSidePadding }) =>
noSidePadding && "padding-left: 0; padding-right: 0;"}
${({ noTopBottomPadding }) =>
Expand All @@ -79,8 +91,9 @@ export const Button = styled.div<{
return `color: ${palette.solid.darkblue}`;
}
}};
${({ buttonColor, noHover }) => {
${({ buttonColor, noHover, agencySettingsConfigs }) => {
if (buttonColor) return "opacity: 0.8;";
if (agencySettingsConfigs) return "opacity: unset";
return !noHover && `background-color: ${palette.solid.lightgrey2};`;
}}
a {
Expand Down
3 changes: 3 additions & 0 deletions common/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type ButtonProps = {
noTopBottomPadding?: boolean;
noHover?: boolean;
tooltipMsg?: string;
agencySettingsConfigs?: boolean;
};

export function Button({
Expand All @@ -54,6 +55,7 @@ export function Button({
noTopBottomPadding,
noHover,
tooltipMsg,
agencySettingsConfigs,
}: ButtonProps) {
return (
<Styled.ButtonWrapper id={id}>
Expand All @@ -67,6 +69,7 @@ export function Button({
noSidePadding={noSidePadding}
noTopBottomPadding={noTopBottomPadding}
noHover={noHover}
agencySettingsConfigs={agencySettingsConfigs}
>
{label}
</Styled.Button>
Expand Down
5 changes: 3 additions & 2 deletions common/components/Input/Input.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ export const NewInputLabel = styled.label<{ error: boolean }>`
`};
`;

export const ErrorMessage = styled.div`
export const ErrorMessage = styled.div<{ settingsCustomMargin?: boolean }>`
${typography.body}
color: ${palette.solid.red};
margin-top: -4px;
margin-top: ${({ settingsCustomMargin }) =>
settingsCustomMargin ? "-4px" : "8px"};
`;
12 changes: 10 additions & 2 deletions common/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as Styled from "./Input.styled";
import { InputTextSize, NotReportedIconTooltipProps } from "./types";

interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
label: string;
label?: string;
noBottomMargin?: boolean;
error?: FormError;
valueLabel?: string;
Expand All @@ -41,6 +41,8 @@ interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
textSize?: InputTextSize;
hideLabel?: boolean;
fullWidth?: boolean;
agencySettingsConfigs?: boolean;
settingsCustomMargin?: boolean;
}

export function Input({
Expand Down Expand Up @@ -197,6 +199,8 @@ export function NewInput({
metricKey,
hideLabel,
fullWidth,
agencySettingsConfigs,
settingsCustomMargin,
...props
}: InputProps) {
return (
Expand All @@ -219,7 +223,11 @@ export function NewInput({
error={Boolean(error)}
fullWidth={fullWidth}
/>
{error && <Styled.ErrorMessage>{error.message}</Styled.ErrorMessage>}
{error && (
<Styled.ErrorMessage settingsCustomMargin={settingsCustomMargin}>
{error.message}
</Styled.ErrorMessage>
)}
</Styled.NewInputWrapper>
);
}
62 changes: 57 additions & 5 deletions common/components/Modal/Modal.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const InnerWrapper = styled.div<{
modalType?: ModalType;
centerText?: boolean;
customPadding?: string;
noBottomDiv?: boolean;
}>`
background-color: ${palette.solid.white};
width: 100%;
Expand All @@ -71,6 +72,11 @@ export const InnerWrapper = styled.div<{
${({ centerText }) => centerText && `align-items: center;`};
border-radius: 3px;
${centerTextCSS}
${({ noBottomDiv }) => {
if (noBottomDiv) {
return `& > div:last-child {display: none;}`;
}
}};
`;

export const Icon = styled.img`
Expand All @@ -79,21 +85,45 @@ export const Icon = styled.img`
margin-bottom: 24px;
`;

export const Title = styled.div<{ mediumTitle?: boolean }>`
export const Title = styled.div<{
mediumTitle?: boolean;
}>`
${({ mediumTitle }) =>
mediumTitle ? typography.sizeCSS.medium : typography.sizeCSS.large};
mediumTitle
? `${typography.sizeCSS.medium}`
: `${typography.sizeCSS.large}`};
margin-top: 16px;
margin-bottom: 16px;
a {
color: ${palette.solid.blue};
text-decoration: none;
}
`;

export const AgencySettingsAndJurisdictionsTitle = styled.div`
${typography.bodyEmphasized}
margin-bottom: 16px;
margin-top: 16px;
a {
color: ${palette.solid.blue};
text-decoration: none;
}
`;

export const Description = styled.div<{ centerText?: boolean }>`
export const Description = styled.div<{
centerText?: boolean;
unsetTextAlignment?: boolean;
}>`
display: flex;
flex-direction: column;
align-items: center;
align-items: ${({ centerText, unsetTextAlignment }) => {
if (centerText) {
return `align-items: center;`;
}
if (unsetTextAlignment) {
return `align-items: unset;`;
}
}};
${typography.sizeCSS.normal};
`;

Expand All @@ -104,7 +134,6 @@ export const ButtonsContainer = styled.div<{
width: 100%;
display: flex;
gap: 12px;

${({ modalType, centerButtons }) => {
if (centerButtons) return "justify-content: center; margin-top: 72px;";
if (modalType) return "justify-content: space-between; margin-top: 72px;";
Expand All @@ -116,3 +145,26 @@ export const ButtonsContainer = styled.div<{
margin-left: auto;
}
`;

export const UnsavedChangesButtonsContainer = styled.div`
width: 100%;
display: flex;
justify-content: end;
gap: 16px;
margin-top: 24px;
& > div:first-child {
div {
border: none;
}
}
`;

export const ModalTitleWrapper = styled.div<{
typographyBodyEmphasized?: boolean;
}>`
display: flex;
flex-direction: row;
justify-content: space-between;
${({ typographyBodyEmphasized }) =>
typographyBodyEmphasized ? `${typography.bodyEmphasized}` : ""};
`;
83 changes: 67 additions & 16 deletions common/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import React, { useEffect } from "react";
import { createPortal } from "react-dom";

import alertIcon from "../../assets/alert-icon.png";
import xCloseLg from "../../assets/close-icon-lg.svg";
import successIcon from "../../assets/success-icon.png";
import warningIcon from "../../assets/warning-icon.svg";
import { Button, ButtonColor } from "../Button";
Expand All @@ -36,6 +37,12 @@ type ModalProps = Partial<{
mediumTitle: boolean;
customPadding?: string;
children?: React.ReactNode;
onClickClose?: () => void;
agencySettingsConfigs?: boolean;
unsavedChangesConfigs?: boolean;
jurisdictionsSettingsConfigs?: boolean;
agencySettingsAndJurisdictionsTitleConfigs?: boolean;
noBottomDiv?: boolean;
}>;

export function Modal({
Expand All @@ -49,6 +56,11 @@ export function Modal({
mediumTitle,
customPadding,
children,
onClickClose,
unsavedChangesConfigs,
jurisdictionsSettingsConfigs,
agencySettingsAndJurisdictionsTitleConfigs,
noBottomDiv,
}: ModalProps) {
const primaryButtonColor = (): ButtonColor => {
if (modalType === "alert") return "red";
Expand All @@ -71,28 +83,67 @@ export function Modal({
modalType={modalType}
centerText={centerText}
customPadding={customPadding}
noBottomDiv={noBottomDiv}
>
{modalType === "success" && <Styled.Icon src={successIcon} alt="" />}
{modalType === "warning" && <Styled.Icon src={warningIcon} alt="" />}
{modalType === "alert" && <Styled.Icon src={alertIcon} alt="" />}
<Styled.Title mediumTitle={mediumTitle}>{title}</Styled.Title>
<Styled.Description>{description}</Styled.Description>
<Styled.ButtonsContainer modalType={modalType}>
{buttons?.map((button, index) => (
<Styled.ModalTitleWrapper typographyBodyEmphasized>
{agencySettingsAndJurisdictionsTitleConfigs && (
<Styled.AgencySettingsAndJurisdictionsTitle>
{title}
</Styled.AgencySettingsAndJurisdictionsTitle>
)}
{!agencySettingsAndJurisdictionsTitleConfigs && (
<Styled.Title mediumTitle={mediumTitle}>{title}</Styled.Title>
)}
{onClickClose && (
<Button
label={button.label}
onClick={button.onClick}
borderColor={
index === buttons.length - 1 ? undefined : "lightgrey"
}
buttonColor={
index === buttons.length - 1
? primaryButtonColor()
: undefined
}
label={<img src={xCloseLg} alt="Close Button" />}
onClick={onClickClose}
agencySettingsConfigs
/>
))}
</Styled.ButtonsContainer>
)}
</Styled.ModalTitleWrapper>
<Styled.Description unsetTextAlignment={jurisdictionsSettingsConfigs}>
{description}
</Styled.Description>
{!unsavedChangesConfigs && (
<Styled.ButtonsContainer modalType={modalType}>
{buttons?.map((button, index) => (
<Button
label={button.label}
onClick={button.onClick}
borderColor={
index === buttons.length - 1 ? undefined : "lightgrey"
}
buttonColor={
index === buttons.length - 1
? primaryButtonColor()
: undefined
}
/>
))}
</Styled.ButtonsContainer>
)}
{unsavedChangesConfigs && (
<Styled.UnsavedChangesButtonsContainer>
{buttons?.map((button, index) => (
<Button
label={button.label}
onClick={button.onClick}
borderColor={
index === buttons.length - 1 ? undefined : "lightgrey"
}
buttonColor={
index === buttons.length - 1
? primaryButtonColor()
: undefined
}
/>
))}
</Styled.UnsavedChangesButtonsContainer>
)}
</Styled.InnerWrapper>
)}
</Styled.OuterWrapper>
Expand Down
5 changes: 5 additions & 0 deletions common/utils/helperUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ export const validateEmail = (email: string) => {
);
};

export const validateAgencyURL = (url: string) => {
const urlRegex = /^(?:(?:https?|ftp):\/\/)?[\w.-]+\.[a-zA-Z]{2,}(?:\/\S*)?$/;
return urlRegex.test(url);
};

/**
* Updates a set of selections by either adding or removing a specified item.
* @param prevSet - The previous set of selected items to update
Expand Down