Skip to content

Commit

Permalink
Merge branch 'integration' into LF-4528/Hide_Created_in_Error_option_…
Browse files Browse the repository at this point in the history
…for_animals_with_completed_Tasks
  • Loading branch information
SayakaOno committed Dec 3, 2024
2 parents a6eb3c6 + e54dfd3 commit 0d60991
Show file tree
Hide file tree
Showing 34 changed files with 204 additions and 83 deletions.
5 changes: 5 additions & 0 deletions packages/api/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ API_HOST=localhost

#For sentry error logging
#SENTRY_DSN=?

# For displaying an OOO message in the emails sent out in response to help requests
OOO_MESSAGE_ENABLED=
# Format YYYY/MM/DD
OOO_END_DATE=
11 changes: 11 additions & 0 deletions packages/api/src/controllers/supportTicketController.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const supportTicketController = {
contact_method: capitalize(result.contact_method),
contact: result[result.contact_method],
locale: user.language_preference,
...getOOOMessageReplacements(user.language_preference),
};
const email = data.contact_method === 'email' && data.email;
if (email && email !== user.email) {
Expand All @@ -60,6 +61,16 @@ const supportTicketController = {
},
};

const getOOOMessageReplacements = (locale) => {
const ooo_message_enabled = process.env.OOO_MESSAGE_ENABLED === 'true';
let ooo_end_date = process.env.OOO_END_DATE;
if (ooo_message_enabled && ooo_end_date) {
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric' };
ooo_end_date = new Date(ooo_end_date).toLocaleDateString(locale, dateOptions);
}
return { ooo_message_enabled, ooo_end_date };
};

const capitalize = (string) => {
return string[0].toUpperCase() + string.slice(1);
};
Expand Down
43 changes: 24 additions & 19 deletions packages/api/src/templates/emails/help_request_email/html.pug
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
extends ../template

block content
.support-container
.support-content
.support-container
.support-content
#ooo_message_enabled
if ooo_message_enabled
span=`${t('HELP_REQUEST.OOO_RESPONSE', { oooEndDate: ooo_end_date })}`
else
span=`${t('HELP_REQUEST.RESPONSE')}`
.support-container
.support-header
span=`${t('HELP_REQUEST.TYPE_HEADER')}:`
.support-content
p=`${t('HELP_REQUEST.' + support_type.toUpperCase().replace(/\s/g, '_'))}`
.support-container
.support-header
span=`${t('HELP_REQUEST.MESSAGE_HEADER')}:`
.support-content
| #{message}
.support-container
.support-header
span=`${t('HELP_REQUEST.CONTACT_METHOD_HEADER')}:`
.support-content
| #{contact_method}
.support-content
| #{contact}
.support-container
.support-header
span=`${t('HELP_REQUEST.TYPE_HEADER')}:`
.support-content
p=`${t('HELP_REQUEST.' + support_type.toUpperCase().replace(/\s/g, '_'))}`
.support-container
.support-header
span=`${t('HELP_REQUEST.MESSAGE_HEADER')}:`
.support-content
| #{message}
.support-container
.support-header
span=`${t('HELP_REQUEST.CONTACT_METHOD_HEADER')}:`
.support-content
| #{contact_method}
.support-content
| #{contact}
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "Verbesserung vorschlagen",
"OTHER": "Anderes",
"CONTACT_METHOD_HEADER": "Bevorzugte Kontaktmethode",
"SUBJECT": "Deine LiteFarm-Anfrage um Unterstützung am"
"SUBJECT": "Deine LiteFarm-Anfrage um Unterstützung am",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "Die großartigen Leute von",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "Request a feature",
"OTHER": "Other",
"CONTACT_METHOD_HEADER": "Preferred contact method",
"SUBJECT": "Your LiteFarm request for help at"
"SUBJECT": "Your LiteFarm request for help at",
"OOO_RESPONSE": "Thanks for reaching out. Please note that our team is out of the office until {{oooEndDate}}. We will respond to your message as soon as possible after we return. Thank you for your understanding! A summary of your request is shown below."
},
"INVITE": {
"GREAT_FOLK": "The great folks at",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "Solicitar una característica",
"OTHER": "Otro",
"CONTACT_METHOD_HEADER": "Método de contacto preferido",
"SUBJECT": "Su solicitud de ayuda a LiteFarm a las"
"SUBJECT": "Su solicitud de ayuda a LiteFarm a las",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "Las personas de",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "Demander une fonctionnalité",
"OTHER": "Autre",
"CONTACT_METHOD_HEADER": "Méthode de contact préférée",
"SUBJECT": "Votre demande d'aide LiteFarm à"
"SUBJECT": "Votre demande d'aide LiteFarm à",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "Les gens formidables de",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "एक सुविधा का अनुरोध करें",
"OTHER": "कुछ और",
"CONTACT_METHOD_HEADER": "पसंदीदा संपर्क विधि",
"SUBJECT": "आपका लाइटफार्म सहायता के लिए अनुरोध"
"SUBJECT": "आपका लाइटफार्म सहायता के लिए अनुरोध",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "लाइटफार्म के उपयोगकर्ता",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "ഒരു സവിശേഷത അഭ്യർത്ഥിക്കുക",
"OTHER": "മറ്റെന്തെങ്കിലും",
"CONTACT_METHOD_HEADER": "തിരഞ്ഞെടുത്ത സമ്പർക്ക രീതി",
"SUBJECT": "ലൈറ്റ്ഫോം പിന്തുണയ്ക്കായുള്ള നിങ്ങളുടെ അഭ്യർത്ഥന"
"SUBJECT": "ലൈറ്റ്ഫോം പിന്തുണയ്ക്കായുള്ള നിങ്ങളുടെ അഭ്യർത്ഥന",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "മഹാന്മാർ",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/pa.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "ਫੀਚਰ ਦੀ ਬੇਨਤੀ ਕਰੋ",
"OTHER": "ਬਾਕੀ",
"CONTACT_METHOD_HEADER": "ਪਸੰਦੀਦਾ ਸੰਪਰਕ ਵਿਧੀ",
"SUBJECT": "ਲਾਈਟਫਾਰਮ ਸਹਾਇਤਾ ਲਈ ਤੁਹਾਡੀ ਬੇਨਤੀ"
"SUBJECT": "ਲਾਈਟਫਾਰਮ ਸਹਾਇਤਾ ਲਈ ਤੁਹਾਡੀ ਬੇਨਤੀ",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "ਲਾਈਟਫਾਰਮ ਦੀ ਟੀਮ",
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/templates/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"REQUEST_A_FEATURE": "Solicite um recurso",
"OTHER": "Outro",
"CONTACT_METHOD_HEADER": "Método de contato preferido",
"SUBJECT": "Seu pedido de ajuda para LiteFarm às"
"SUBJECT": "Seu pedido de ajuda para LiteFarm às",
"OOO_RESPONSE": "MISSING"
},
"INVITE": {
"GREAT_FOLK": "O grande pessoal da",
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "Verstanden",
"DESCRIPTION": "Jemand wird sich innerhalb von 48 Stunden mit Ihnen in Verbindung setzen.",
"DESCRIPTION": "MISSING",
"TITLE": "Anfrage abgeschickt"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "Got it",
"DESCRIPTION": "Someone will be in touch within 48 hours.",
"DESCRIPTION": "Someone will be in touch soon.",
"TITLE": "Help request submitted"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "Entendido",
"DESCRIPTION": "Alguien lo contactará dentro de 48 horas.",
"DESCRIPTION": "MISSING",
"TITLE": "Solicitud de ayuda enviada"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "J'ai compris",
"DESCRIPTION": "Vous serez contacté dans les 48 heures.",
"DESCRIPTION": "MISSING",
"TITLE": "Demande d'aide soumise"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "समझ लिया",
"DESCRIPTION": "कोई व्यक्ति 48 घंटों के भीतर आपसे संपर्क करेगा।",
"DESCRIPTION": "MISSING",
"TITLE": "सहायता अनुरोध सबमिट किया गया"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/ml/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "മനസ്സിലായി",
"DESCRIPTION": "48 മണിക്കൂറിനുള്ളിൽ ആരെങ്കിലും ബന്ധപ്പെടും.",
"DESCRIPTION": "MISSING",
"TITLE": "സഹായ അഭ്യർത്ഥന സമർപ്പിച്ചു"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pa/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "ਸਮਝ ਗਿਆ",
"DESCRIPTION": "ਕੋਈ ਵਿਅਕਤੀ 48 ਘੰਟਿਆਂ ਦੇ ਅੰਦਰ ਸੰਪਰਕ ਵਿੱਚ ਹੋਵੇਗਾ।",
"DESCRIPTION": "MISSING",
"TITLE": "ਮਦਦ ਦੀ ਬੇਨਤੀ ਸਪੁਰਦ ਕੀਤੀ ਗਈ"
},
"REVENUE": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@
},
"REQUEST_CONFIRMATION_MODAL": {
"BUTTON": "Entendi",
"DESCRIPTION": "Alguém entrará em contato em 48 horas.",
"DESCRIPTION": "MISSING",
"TITLE": "Pedido de ajuda enviado"
},
"REVENUE": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export type AnimalSingleViewHeaderProps = {
onEdit: () => void;
onRemove: () => void;
onBack: () => void;
animalOrBatch: (Animal | AnimalBatch) & { location?: string }; // TODO: LF-4481
animalOrBatch: Animal | AnimalBatch;
locationText?: string;
defaultTypes: DefaultAnimalType[];
customTypes: CustomAnimalType[];
defaultBreeds: DefaultAnimalBreed[];
Expand All @@ -140,6 +141,7 @@ const AnimalSingleViewHeader = ({
onRemove,
onBack,
animalOrBatch,
locationText,
defaultTypes,
customTypes,
defaultBreeds,
Expand All @@ -163,7 +165,7 @@ const AnimalSingleViewHeader = ({
<AnimalImageWithCount photoUrl={photo_url} count={count} isCompactView={isCompactView} />
);
const age = <Age birthDate={birth_date} t={t} />;
const location = <Location location={animalOrBatch.location} t={t} />;
const location = <Location location={locationText} t={t} />;

const menuOptions = [
{ label: <MenuItem iconName="EDIT" text={t('ADD_ANIMAL.EDIT_BASIC_INFO')} />, onClick: onEdit },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const HoverPillOverFlow = ({ items, noneText = '' }: HoverPillOverflowProps) =>
return (
<div className={clsx(styles.text)}>
{items.length === 0 ? (
<span className={styles.italics}>{noneText}</span>
<span>{noneText}</span>
) : (
<span className={styles.marginRight8px}>{items[0]}</span>
)}
Expand Down
10 changes: 3 additions & 7 deletions packages/webapp/src/components/Table/Cell/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
font-weight: 400;
}

.overflowText, .overflowText div {
.overflowText,
.overflowText div {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
Expand Down Expand Up @@ -45,7 +46,6 @@
width: 32px;
padding: 4px;
@include svgColorFill(var(--Colors-Primary-Primary-teal-300));

}

.withSubtextText {
Expand Down Expand Up @@ -73,7 +73,7 @@
padding: 4px;
border-radius: 2px;
background: var(--Colors-Accent---singles-Purple-light);
box-shadow: 1px 1px 0px 0px #FFF;
box-shadow: 1px 1px 0px 0px #fff;
color: var(--Colors-Accent---singles-Purple-full);
font-size: 12px;
font-weight: 700;
Expand All @@ -84,7 +84,3 @@
align-items: center;
gap: 8px;
}

.italics {
font-style: italic;
}
26 changes: 25 additions & 1 deletion packages/webapp/src/containers/Animals/Inventory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import useExpandable from '../../../components/Expandable/useExpandableItem';
import clsx from 'clsx';
import AnimalsBetaSpotlight from './AnimalsBetaSpotlight';
import { sumObjectValues } from '../../../util';
import Icon from '../../../components/Icons';

const HEIGHTS = {
filterAndSearch: 64,
Expand Down Expand Up @@ -319,6 +320,22 @@ export default function AnimalInventory({
),
sortable: false,
},
{
id: isDesktop ? 'location' : null,
label: t('ANIMAL.ANIMAL_LOCATIONS').toLocaleUpperCase(),
format: (d: AnimalInventoryType) => (
<div className={clsx(styles.location, !d.location && styles.unknown)}>
{d.location ? (
<>
<Icon iconName="LOCATION" className={styles.locationIcon} />
<span className={styles.locationText}>{d.location}</span>
</>
) : (
t('common:UNKNOWN')
)}
</div>
),
},
{
id: showLinks ? 'path' : null,
label: '',
Expand All @@ -335,7 +352,14 @@ export default function AnimalInventory({
);

const makeAnimalsSearchableString = (animal: AnimalInventoryType) => {
return [animal.identification, animal.type, animal.breed, ...animal.groups, animal.count]
return [
animal.identification,
animal.type,
animal.breed,
...animal.groups,
animal.count,
animal.location,
]
.filter(Boolean)
.join(' ');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
height: auto;
overflow-y: auto;
}

.taskViewMaxHeight {
max-height: calc(100vh - var(--global-navbar-height) - var(--global-multi-step-task-layout-aggregated-height));
max-height: calc(
100vh - var(--global-navbar-height) - var(--global-multi-step-task-layout-aggregated-height)
);
}

.summaryViewHeight {
Expand Down Expand Up @@ -105,4 +107,28 @@

.disableHover {
pointer-events: none;
}
}

.location {
display: flex;
align-items: center;
gap: 4px;
font-size: 14px;
font-weight: 600;
color: var(--Colors-Neutral-Neutral-600);

&.unknown {
font-weight: normal;
}
}

.locationIcon {
padding: 0;
min-width: 16px;
background-color: transparent;
}

.locationText {
width: calc(100% - 20px); // icon width 16px + gap 4px
@include truncateText();
}
Loading

0 comments on commit 0d60991

Please sign in to comment.