diff --git a/src/actions/information.js b/src/actions/information.js index 39541dc0360..4066b65dc15 100644 --- a/src/actions/information.js +++ b/src/actions/information.js @@ -19,14 +19,28 @@ export const updateInfoSuccess = updatedInfo => ({ payload: updatedInfo, }); +export const fetchInfosBegin = () => ({ + type: actions.FETCH_INFOS_BEGIN, +}); + +export const fetchInfosError = () => ({ + type: actions.FETCH_INFOS_ERROR, +}) + // Get infoCollections -export const getInfoCollections = () => { - return async dispatch => { +export const getInfoCollections = (retrieveInfos=false) => { + return async (dispatch, getState) => { try { + const { infoCollections } = getState(); + if (!retrieveInfos && (infoCollections.loading || infoCollections.loaded)) { + return; + } + dispatch(fetchInfosBegin()) const response = await axios.get(ENDPOINTS.INFO_COLLECTIONS); dispatch(fetchInfosSuccess(response.data)); return response.data; } catch (error) { + dispatch(fetchInfosError) toast.error(error.message || 'Failed to fetch info collections.'); return null; } diff --git a/src/components/TeamMemberTasks/TeamMemberTask.jsx b/src/components/TeamMemberTasks/TeamMemberTask.jsx index 0030088fc55..28b65bf6476 100644 --- a/src/components/TeamMemberTasks/TeamMemberTask.jsx +++ b/src/components/TeamMemberTasks/TeamMemberTask.jsx @@ -171,6 +171,11 @@ const TeamMemberTask = React.memo( const canUnassignTask = dispatch(hasPermission(permissions.removeUserFromTask)); const numTasksToShow = isTruncated ? NUM_TASKS_SHOW_TRUNCATE : activeTasks.length; + const tableRowDarkMode = () => { + if (darkMode) return `${styles['table-row']} ${styles.darkMode} bg-yinmn-blue`; + return `${styles['table-row']}`; + }; + const colorsObjs = { 'Assistant Manager': '#849ced', // blue Manager: '#90e766', // green @@ -256,11 +261,7 @@ const TeamMemberTask = React.memo( }; return ( - +
{isTimeOffContentOpen && ( @@ -298,7 +299,7 @@ const TeamMemberTask = React.memo( )} - + {/* green if member has met committed hours for the week, red if not */} - +
@@ -416,7 +417,10 @@ const TeamMemberTask = React.memo( style={{ margin: '0 auto', width: '100%' }} >
{ - const { role, areaName, fontSize, isPermissionPage } = this.props; + const { role, areaName, fontSize, isPermissionPage, initialInfo } = this.props; let content = ''; let visible = '0'; @@ -101,13 +101,16 @@ export class EditableInfoModal extends Component { (visible === '2' && role !== 'Volunteer'); const CanEdit = role === 'Owner'; - + const contentToDisplay = () => { + if (content) return content; + return initialInfo ? this.sanitizeText(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, @@ -231,7 +234,7 @@ export class EditableInfoModal extends Component { if (saveResult === 200 || saveResult === 201) { await this.handleSaveSuccess(); // ✅ Refresh collections so UI is always in sync - this.props.getInfoCollections(); + this.props.getInfoCollections(true); } else { this.handleSaveError(); } @@ -241,7 +244,7 @@ export class EditableInfoModal extends Component { const { infoId } = this.handleChangeInInfos(); await this.props.deleteInfoCollectionById(infoId); // Refresh collections after delete - this.props.getInfoCollections(); + this.props.getInfoCollections(true); }; handleClose = () => { @@ -260,7 +263,7 @@ export class EditableInfoModal extends Component { const { darkMode } = this.props; const headerDarkClass = darkMode ? `${appStyles['bg-space-cadet']} text-light` : ''; - const sanitizedContent = infoContent; + const sanitizedContent = infoContent; return ( CanRead && ( @@ -269,9 +272,9 @@ export class EditableInfoModal extends Component { data-toggle="tooltip" data-placement="right" title="Click for information about this" - style={{ fontSize: fontSize, cursor: 'pointer', color: '#00CCFF', marginRight: '8px' }} + style={{ fontSize: fontSize }} aria-hidden="true" - className="fa fa-info-circle" + className={`fa fa-info-circle ${styles.infoIcon}`} onClick={() => this.setState({ editableModalOpen: true })} /> @@ -321,6 +324,7 @@ export class EditableInfoModal extends Component { Who can view this information? setNewWarningDescription(e.target.value)} + /> +