Skip to content

Commit

Permalink
Merge branch 'master' into grioux/changeCAPWATCHdownloadTime
Browse files Browse the repository at this point in the history
  • Loading branch information
grioux-neo committed Oct 4, 2023
2 parents 9f2b493 + 106cf63 commit ba80df4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/client/src/pages/admin/pages/EmailList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with EvMPlus.org. If not, see <http://www.gnu.org/licenses/>.
*/

import { Member, Maybe, Either, areMembersTheSame, getFullMemberName } from 'common-lib';
import { Member, Maybe, Either, areMembersTheSame, getFullMemberName, CAPMember } from 'common-lib';
import * as React from 'react';
import Button from '../../../components/Button';
import { InputProps } from '../../../components/form-inputs/Input';
Expand Down Expand Up @@ -308,6 +308,21 @@ export default class EmailList extends Page<PageProps, EmailListState> {
const currentSortFunction = sortFunctions[this.state.sortFunction];

const getSelector = (state: EmailListUIState & EmailListLoadedState): JSX.Element => {
const displayMember = (val: CAPMember): React.ReactChild => {
if (val.type === 'CAPNHQMember') {
const expires = +new Date(val.expirationDate);

if (expires < Date.now()) {
return <span style={{ color: 'red' }}>{ getFullMemberName(val) }</span>;
}

if (expires < Date.now() + 1000 * 60 * 60 * 24 * 30) {
return <span style={{ color: 'orange' }}>{ getFullMemberName(val) }</span>;
}
}
return getFullMemberName(val);
};

const selectorProps: Omit<
SelectorPropsMultiple<Member, any[]>,
'filters' | 'onFilterValuesChange' | 'filterValues'
Expand All @@ -322,7 +337,7 @@ export default class EmailList extends Page<PageProps, EmailListState> {
visibleItems: newVisibleItems,
}),
overflow: 750,
displayValue: getFullMemberName,
displayValue: displayMember,
};

return !state.displayAdvanced ? (
Expand Down

0 comments on commit ba80df4

Please sign in to comment.