From 5c114e9d4f9c708e40095bc30cc98f7b37b2a77f Mon Sep 17 00:00:00 2001 From: Anthony Weathers Date: Fri, 25 Sep 2026 17:31:28 -0700 Subject: [PATCH 1/5] Feature: Added textbox for initial description for new tracker in tracker list modal, added info modal for tracker list, and adjust infomodal to accept optional initial description if provided --- .../EditableModal/EditableInfoModal.jsx | 10 ++-- src/components/Warnings/Warnings.jsx | 16 +++++- .../Warnings/modals/WarningTrackerModal.jsx | 53 +++++++++++++------ 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/components/UserProfile/EditableModal/EditableInfoModal.jsx b/src/components/UserProfile/EditableModal/EditableInfoModal.jsx index aad4c037f33..3dc393eb256 100644 --- a/src/components/UserProfile/EditableModal/EditableInfoModal.jsx +++ b/src/components/UserProfile/EditableModal/EditableInfoModal.jsx @@ -77,7 +77,7 @@ export class EditableInfoModal extends Component { // ✅ Centralized: derive modal state from collections + props deriveFromCollections = infoCollections => { - const { role, areaName, fontSize, isPermissionPage } = this.props; + const { role, areaName, fontSize, isPermissionPage, initialInfo } = this.props; let content = ''; let visible = '0'; @@ -100,13 +100,16 @@ export class EditableInfoModal extends Component { (visible === '2' && role !== 'Volunteer'); const CanEdit = role === 'Owner'; - + const contentToDisplay = () => { + if (content) return content; + return initialInfo ? initialInfo : 'Please input information!'; + }; return { infoElements: Array.isArray(infoCollections) ? [...infoCollections] : [], fetchError: this.props.fetchError, loading: this.props.loading, infoName: areaName, - infoContent: content || 'Please input information!', + infoContent: contentToDisplay(), visibility: visible, CanRead, CanEdit, @@ -365,6 +368,7 @@ EditableInfoModal.propTypes = { areaName: PropTypes.string, fontSize: PropTypes.number, isPermissionPage: PropTypes.bool, + initialInfo: PropTypes.string, darkMode: PropTypes.bool, }; diff --git a/src/components/Warnings/Warnings.jsx b/src/components/Warnings/Warnings.jsx index 50c52e603f7..c0113e91ab1 100644 --- a/src/components/Warnings/Warnings.jsx +++ b/src/components/Warnings/Warnings.jsx @@ -3,7 +3,7 @@ import moment from 'moment'; import PropTypes from 'prop-types'; import { useEffect, useState } from 'react'; import { Alert, Button } from 'react-bootstrap'; -import { useDispatch } from 'react-redux'; +import { useDispatch, useSelector } from 'react-redux'; import { toast } from 'react-toastify'; import hasPermission from '~/utils/permissions'; import { ENDPOINTS } from '~/utils/URL'; @@ -18,6 +18,7 @@ import WarningTrackerModal from './modals/WarningTrackerModal'; import WarningIcons from './WarningIcons'; import styles from './Warnings.module.css'; import { permissions } from '../../utils/constants'; +import EditableInfoModal from '~/components/UserProfile/EditableModal/EditableInfoModal'; // Better Descriptions (“i” = ,ltd = Please be more specific in your time log descriptions.) // Log Time to Tasks (“i” = ,lttt = Please log all time working on specific tasks to those tasks rather than the general category. ) // Log Time as You Go (“i” = ,ltayg = Reminder to please log your time as you go. At a minimum, please log daily any time you work.) @@ -33,6 +34,7 @@ export default function Warning({ }) { const dispatch = useDispatch(); const [usersWarnings, setUsersWarnings] = useState([]); + const darkMode = useSelector(state => state.theme.darkMode); const [toggleWarningTrackerModal, setToggleWarningTrackerModal] = useState(false); const [toggle, setToggle] = useState(false); @@ -179,7 +181,17 @@ export default function Warning({ ? usersWarnings.map(warning => (
-

{warning.title}

+
+

{warning.title}

+ +
{ - setNewWarning(''); - if (res?.error) { - setError(res.error); - return; - } - if (res?.message) { - setError(res.message); - return; - } - setWarningDescriptions(res.newWarnings); - getUsersWarnings(); - setError(null); - setToggeleWarningInput(false); - }, - ); + dispatch( + postNewWarning({ + newWarning: trimmedWarning, + activeWarning: true, + isPermanent, + newWarningDescription, + }), + ).then(res => { + setNewWarning(''); + if (res?.error) { + setError(res.error); + return; + } + if (res?.message) { + setError(res.message); + return; + } + setWarningDescriptions(res.newWarnings); + getUsersWarnings(); + setError(null); + setToggeleWarningInput(false); + }); }; if (toggleDeleteModal) { @@ -500,6 +506,19 @@ function WarningTrackerModal({ value={isPermanent} />
+ + + setNewWarningDescription(e.target.value)} + /> +