Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/glific/glific-frontend in…
Browse files Browse the repository at this point in the history
…to update/types
  • Loading branch information
mdshamoon committed Jan 20, 2022
2 parents 839e1f2 + 9e3f3cb commit 46b603c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const getDisplayName = (conversation: any) => {
setLogs(er, 'error');
}

if (contactFields.name) {
if (contactFields?.name) {
displayName = contactFields.name.value;
} else if (conversation.contact.name) {
displayName = conversation.contact.name;
Expand Down
2 changes: 1 addition & 1 deletion src/components/UI/Form/TimePicker/TimePicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('<TimePicker />', () => {
it('test time change event', async () => {
render(wrapper);
const input = screen.getByRole('textbox');
UserEvent.type(input, '09:00 AM');
fireEvent.change(input, { target: { value: '09:00 AM' } });
expect(input).toHaveValue('09:00 AM');
});

Expand Down
6 changes: 5 additions & 1 deletion src/components/UI/Form/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';
import 'date-fns';
import Grid from '@material-ui/core/Grid';
import DateFnsUtils from '@date-io/date-fns';
Expand Down Expand Up @@ -28,6 +28,7 @@ export const TimePicker: React.SFC<TimePickerProps> = ({
}) => {
moment.defaultFormat = 'Thh:mm:ss';
const dateValue = field.value ? moment(field.value, moment.defaultFormat).toDate() : null;
const [open, setOpen] = useState(false);

const errorText = getIn(errors, field.name);
const touchedVal = getIn(touched, field.name);
Expand All @@ -44,12 +45,15 @@ export const TimePicker: React.SFC<TimePickerProps> = ({
<KeyboardTimePicker
error={hasError}
autoOk
open={open}
variant={variant}
inputVariant={inputVariant}
label={placeholder}
data-testid="time-picker"
mask="__:__ _M"
value={dateValue}
onClick={() => !disabled && setOpen(true)}
onClose={() => setOpen(false)}
disabled={disabled}
onChange={(date) => handleDateChange(date)}
keyboardIcon={<ScheduleIcon />}
Expand Down
6 changes: 2 additions & 4 deletions src/components/UI/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ const Menu: React.SFC<MenuProps> = (props) => {
const { menus, children } = props;
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);

const handleClick = (
event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>
) => {
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
setAnchorEl(event.currentTarget);
};

Expand All @@ -38,7 +36,7 @@ const Menu: React.SFC<MenuProps> = (props) => {

return (
<div data-testid="Menu">
<div onClick={handleClick} onKeyDown={handleClick} aria-hidden="true">
<div onMouseEnter={handleClick} aria-hidden="true">
{children}
</div>
<MenuElement
Expand Down
8 changes: 8 additions & 0 deletions src/containers/SettingList/Organisation/Organisation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ export const Organisation: React.SFC = () => {
activeLanguages: Yup.array().required(t('Supported Languages is required.')),
defaultLanguage: Yup.object().nullable().required(t('Default Language is required.')),
signaturePhrase: Yup.string().nullable().required(t('Webhook signature is required.')),
endTime: Yup.string()
.test('is-midnight', t('End time cannot be 12 AM'), (value) => value !== 'T00:00:00')
.test('is-valid', t('Not a valid time'), (value) => value !== 'Invalid date'),
startTime: Yup.string().test(
'is-valid',
t('Not a valid time'),
(value) => value !== 'Invalid date'
),
newcontactFlowId: Yup.object()
.nullable()
.when('newcontactFlowEnabled', {
Expand Down

0 comments on commit 46b603c

Please sign in to comment.