Skip to content

Commit c7d4fab

Browse files
akanshaaa19AmishaBishtshijithkjayanmahajantejaspriyanshu6238
authored
Sprint bug bash master PR (#3546)
* Spring bug bash (#3519) * chore: add the helper text for shortcode in hsm tempalte * refactor: 🔥 Remove Collections button from staff management list (#3520) --------- Co-authored-by: Shijith Karumathil <[email protected]> (cherry picked from commit 5242f44) * Added asterics in certificates page and corrected info on resolution (#3522) (cherry picked from commit e3b6760) * Added asterics to assistants page (#3521) * added asterics to assistants page * Enhance CreateAssistant form validation and submission handling --------- Co-authored-by: Akansha Sakhre <[email protected]> (cherry picked from commit b3dd359) * Add asterisks to label and placeholder for required field (#3516) * Add asterisks to label and placeholder for required field indication in HSM component * Refactor: Add asterisks to labels for required fields in Trigger component * Refactor: Add asterisk to label for required field indication in Collection component * Refactor: Add asterisks to labels for required fields in InteractiveMessage component * Refactor: Add asterisk to label for required field indication in Flow component * Refactor: Add asterisks to 'Title' label for required field indication in Collection and InteractiveMessage tests * Refactor: Update order of severity options in NotificationList component * Refactor: Update label from 'Label' to 'Name' in columnNames of SheetIntegrationList component * Refactor: Update label from 'Label' to 'Title' * Refactor: Rearrange formFields to maintain consistent order of components in SheetIntegration * Refactor: Move AutoComplete model field definition within formFields array for improved structure * Refactor: Update label from 'Assigned to' to 'Collections assigned' in StaffManagementList component * Fix: Ensure openPickerButton can open date picker when not disabled * Fix: Ensure openPickerButton can open time picker when not disabled * Test: Add OpenPickerButton functionality tests for enabled and disabled states * Test: Add functionality to open calendar when picker button is clicked and not disabled * Test: Update calendar picker button click test to use role selector and ensure calendar opens * Test: Simplify calendar picker button click test by using screen.getByRole * Fix: Ensure text in Content class wraps correctly and maintains formatting * minor cleanup --------- Co-authored-by: Akansha Sakhre <[email protected]> (cherry picked from commit e2357ff) * Assistants: Fix file upload size message and link (#3515) * fix: update assistants upload files text * fix: create assistant text * test: fix instructions test case * refactor: fix instructions label * fix: correct spacing in 'Instructions(Prompt)' text * Merge branch 'sprint_bug_bash_master' of github.com:glific/glific-frontend into fix/assistants_popup --------- Co-authored-by: Akansha Sakhre <[email protected]> (cherry picked from commit ccf0e64) * Sprint bug bash (#3517) * added dropdown icon for options with sub options * change default assistant temperature to 0.1 in CreateAssistant and Assistants components * Add sortBy prop to ListProps and set default sort in TriggerList * moved isActive tp the top and footer below the add variable button * Change navigation to open destination in a new window * Remove unused navigate import from NotificationList component * Refactor navigation handling in NotificationList tests to use window.open instead of mocked useNavigate * Mock window.open in NotificationList tests for improved navigation handling * Add missing import for styles in SideMenus component * Update createAssistant mock to include temperature and change orderWith to updated_at in triggerListQuery * resolved eof error * Refactor sorting configuration in List and TriggerList components to use sortConfig object (cherry picked from commit 2a40610) * Fix optional chaining in setPayload function for safer property access (cherry picked from commit 34b9c58) * Add asterisks to required fields in HSM and QuickReplyTemplate components; update translations for date range in English and Hindi (cherry picked from commit 1053339) * Update date range label in Trigger component and remove asterisk from translations in English and Hindi (cherry picked from commit d9cec97) * Replace hamburger menu with collapsible side arrow icon when it open (#3542) * Replace hamburger menu icon with back arrow icon in SideDrawer component for improved navigation experience. * Remove unnecessary margin from ClosedItem class in SideMenus.module.css for improved layout consistency. (cherry picked from commit 9603e8a) * Added support for sharing flow links (#3527) * added dropdown icon for options with sub options * change default assistant temperature to 0.1 in CreateAssistant and Assistants components * Add sortBy prop to ListProps and set default sort in TriggerList * moved isActive tp the top and footer below the add variable button * Change navigation to open destination in a new window * Remove unused navigate import from NotificationList component * Refactor navigation handling in NotificationList tests to use window.open instead of mocked useNavigate * Add ShareFlowLink component and styles; include QR code functionality and share link feature * Add ShareFlowLink functionality to FlowEditor and FlowList; update styles and dialog handling * Add organization retrieval to user session and implement getOrganizationData function * clean up * Mock window.open in NotificationList tests for improved navigation handling * Add missing import for styles in SideMenus component * minor cleanup * Add tests for ShareFlowLink component and enhance functionality with clipboard and QR code features * Refactor imports in ShareFlowLink component for better organization and clarity * Update createAssistant mock to include temperature and change orderWith to updated_at in triggerListQuery * Remove unused import 'wait' from ShareFlowLink test file * Refactor CSS for improved readability and consistency; update ShareFlowLink component to conditionally render keyword selection based on available options. * moved edit icon inside view more * Add ShareResponderLink component with QR code download and keyword selection functionality * Refactor ShareFlowLink to ShareResponderLink; update imports and component usage across FlowEditor, FlowList, and tests (cherry picked from commit d3f54b3) * refactor: coderabbit comments (cherry picked from commit 4fd6c44) * fix: update text in ShareResponderLink tests and InteractiveMessage test (cherry picked from commit 373ea36) * fix: handle optional chaining for keywords in FlowEditor and update share dialog keywords type in FlowList style: remove duplicate border-radius in ShareResponderLink CSS test: refactor ShareResponderLink test setup for consistency i18n: add "Share" translation to English localization (cherry picked from commit 6f34634) * added test cases for flow list (cherry picked from commit c3cdfb6) * renamed flow link to responder link (cherry picked from commit 58043ca) * test: add export flow and share responder link tests; update dialog heading for accessibility (cherry picked from commit de3401f) * fix: remove console log for keywords length in getName function (cherry picked from commit 7dcc1c9) * remove redundant setUserSession call in ShareResponderLink tests (cherry picked from commit 4149cb9) * update expectation in flow preview button test to check for simulator container (cherry picked from commit d560894) * test: skip inactive flow test in FlowEditor (cherry picked from commit 32fbafb) * test: update text assertions in Collection and Trigger tests for clarity * minor refactoring --------- Co-authored-by: Amisha Bisht <[email protected]> Co-authored-by: Shijith Karumathil <[email protected]> Co-authored-by: Tejas Mahajan <[email protected]> Co-authored-by: Priyanshu singh <[email protected]>
1 parent 3b3415f commit c7d4fab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+962
-168
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"react-media-recorder": "^1.7.1",
5959
"react-phone-input-2": "^2.15.1",
6060
"react-player": "^3.1.0",
61+
"react-qr-code": "^2.0.18",
6162
"react-resize-detector": "^12.1.0",
6263
"react-router": "^7.6.3",
6364
"react-tiny-link": "^3.6.1",
Lines changed: 5 additions & 0 deletions
Loading

src/common/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,5 @@ export const getVariables = (contactOptions: any, messageOptions: any, variables
251251
...variables,
252252
};
253253
};
254+
255+
export const SHARE_FLOW_LINK = 'wa.me/';

src/common/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,12 @@ export const handleSubscriptionError = (error: any, subscriptionType: string, re
303303
refetch(true);
304304
}
305305
};
306+
307+
export const downloadCanvasAsPNG = (canvas: HTMLCanvasElement, fileName: string, notification: string) => {
308+
const pngFile = canvas.toDataURL('image/png', 1.0);
309+
const downloadLink = document.createElement('a');
310+
downloadLink.download = fileName;
311+
downloadLink.href = pngFile;
312+
downloadLink.click();
313+
setNotification(notification);
314+
};

src/components/UI/Form/Calendar/Calendar.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,16 @@ describe('<Calendar />', () => {
109109
expect(screen.queryByTestId('sentinelStart')).not.toBeInTheDocument();
110110
});
111111
});
112+
113+
it('should open calendar when picker button is clicked and not disabled', async () => {
114+
render(wrapper);
115+
const input = screen.getByRole('button', { name: /Choose date/i });
116+
if (input) {
117+
fireEvent.click(input);
118+
expect(screen.getByTestId('sentinelStart')).toBeInTheDocument();
119+
}
120+
await waitFor(() => {
121+
expect(screen.queryByTestId('sentinelStart')).toBeInTheDocument();
122+
});
123+
});
112124
});

src/components/UI/Form/Calendar/Calendar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ export const Calendar = ({
7575
error: hasError,
7676
onClick: () => !disabled && setOpen(true),
7777
},
78+
openPickerButton: {
79+
onClick: () => !disabled && setOpen(true),
80+
},
7881
}}
7982
onClose={() => setOpen(false)}
8083
sx={CalendarStyles}

src/components/UI/Form/TimePicker/TimePicker.test.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,34 @@ describe('Disable <TimePicker />', () => {
8484
expect(input).toHaveValue('');
8585
});
8686
});
87+
88+
describe('OpenPickerButton functionality', () => {
89+
it('should open picker when openPickerButton is clicked and not disabled', async () => {
90+
const props = timePickerProps(false);
91+
render(<TimePicker {...props} />);
92+
93+
const openPickerButton = screen.getByRole('button', { name: /choose time/i });
94+
expect(openPickerButton).toBeInTheDocument();
95+
96+
fireEvent.click(openPickerButton);
97+
98+
await waitFor(() => {
99+
expect(screen.getByRole('dialog')).toBeInTheDocument();
100+
});
101+
});
102+
103+
it('should not open picker when openPickerButton is clicked and disabled', async () => {
104+
const props = timePickerProps(true);
105+
render(<TimePicker {...props} />);
106+
107+
const openPickerButton = screen.getByRole('button', { name: /choose time/i });
108+
expect(openPickerButton).toBeInTheDocument();
109+
expect(openPickerButton).toBeDisabled();
110+
111+
fireEvent.click(openPickerButton);
112+
113+
await waitFor(() => {
114+
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
115+
});
116+
});
117+
});

src/components/UI/Form/TimePicker/TimePicker.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ export const TimePicker = ({
6969
error: hasError,
7070
onClick: () => !disabled && setOpen(true),
7171
},
72+
openPickerButton: {
73+
onClick: () => !disabled && setOpen(true),
74+
},
7275
}}
7376
sx={TimePickerStyles}
7477
/>

src/components/UI/Layout/Navigation/SideDrawer/SideDrawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useContext, useState } from 'react';
22
import { Drawer, Toolbar, Typography, IconButton } from '@mui/material';
33
import MenuIcon from '@mui/icons-material/Menu';
4+
import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
45
import { SideDrawerContext, ProviderContext } from 'context/session';
56
import { GUPSHUP_ENTERPRISE_SHORTCODE } from 'common/constants';
67
import GlificLogo from 'assets/images/logo/Logo.svg';
@@ -27,7 +28,7 @@ export const SideDrawer = () => {
2728
</Typography>
2829

2930
<IconButton onClick={() => setDrawerOpen(false)} data-testid="drawer-button">
30-
<MenuIcon />
31+
<ArrowBackIosNewIcon fontSize="small" />
3132
</IconButton>
3233
</div>
3334
) : (

src/components/UI/Layout/Navigation/SideMenus/SideMenus.module.css

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
}
2424

2525
.OpenItem {
26-
margin: 0px 8px;
27-
padding: 6px 16px;
26+
padding: 0.5rem 0.75rem;
27+
display: flex;
28+
width: 100%;
29+
justify-content: space-between;
2830
}
2931

3032
.ClosedItem {
3133
width: unset !important;
32-
margin: 0px 10px !important;
3334
}
3435

3536
.SelectedText {
@@ -114,6 +115,10 @@
114115
animation: animation 1s ease-in-out;
115116
}
116117

118+
.ListItemContent {
119+
display: flex;
120+
}
121+
117122
@keyframes animation {
118123
from {
119124
-webkit-transform: scale3d(1, 1, 1);
@@ -145,4 +150,4 @@
145150
-webkit-transform: scale3d(1, 1, 1);
146151
transform: scale3d(1, 1, 1);
147152
}
148-
}
153+
}

0 commit comments

Comments
 (0)