From bae09bf243cf151ee072f947fe3eee8e9e683b7e Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Tue, 7 May 2024 18:38:57 +0530 Subject: [PATCH 1/3] code refactor --- ui/src/components/MainHeader/index.scss | 7 +++++++ ui/src/pages/Login/index.tsx | 10 +++++++--- ui/src/pages/RegionalLogin/index.tsx | 1 - ui/src/scss/_variables.scss | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/src/components/MainHeader/index.scss b/ui/src/components/MainHeader/index.scss index 36ba78e2..e5c6428a 100644 --- a/ui/src/components/MainHeader/index.scss +++ b/ui/src/components/MainHeader/index.scss @@ -20,3 +20,10 @@ width: 2rem; } } +.Dropdown__header__label { + line-height: $line-height-reset; +} +.Dropdown__header__value { + color: $color-black-222!important; + line-height: $line-height-reset; +} \ No newline at end of file diff --git a/ui/src/pages/Login/index.tsx b/ui/src/pages/Login/index.tsx index 9588c5b6..0e0ca279 100644 --- a/ui/src/pages/Login/index.tsx +++ b/ui/src/pages/Login/index.tsx @@ -202,6 +202,8 @@ const Login: FC = () => { className="mb-2" version="v2" htmlFor="tfa_token" + aria-label="tfa_token" + > {twoFactorAuthentication?.security_code?.title} @@ -213,6 +215,7 @@ const Login: FC = () => { error={meta?.error && meta?.touched} width="large" testId="cs-tfa-token-input-field" + id="tfa_token" /> {meta?.error && meta?.touched && ( = () => { className="mb-2" required={true} version="v2" - htmlFor="email" + htmlFor={login?.email} > {login?.email} @@ -302,7 +305,7 @@ const Login: FC = () => { } })); }} - name="email" + name={login?.email} width="large" id="email" version="v2" @@ -310,6 +313,7 @@ const Login: FC = () => { data-testid="cs-login-email-input-field" placeholder={login?.placeholder?.email} error={(meta?.error || meta?.submitError) && meta?.touched} + aria-label={login?.email} /> {meta.error && meta.touched && ( = () => { buttonType="primary" type="submit" icon="v2-Login" - tabIndex={0} + tabindex={0} > {login?.cta?.title} diff --git a/ui/src/pages/RegionalLogin/index.tsx b/ui/src/pages/RegionalLogin/index.tsx index 25faebaf..3bf266e6 100644 --- a/ui/src/pages/RegionalLogin/index.tsx +++ b/ui/src/pages/RegionalLogin/index.tsx @@ -102,7 +102,6 @@ const RegionalLogin = () => { region?.service_title as string ) } - aria-label={`${region?.cta?.title} with ${region?.service_title} ${region?.region_title}`} > {region?.cta?.title} diff --git a/ui/src/scss/_variables.scss b/ui/src/scss/_variables.scss index 673ed147..1d8442b8 100644 --- a/ui/src/scss/_variables.scss +++ b/ui/src/scss/_variables.scss @@ -27,6 +27,8 @@ $color-brand-warning-medium: #eb5646; $color-font-disabled: rgba(160, 174, 192, 0.5); $color-font-gray: #637392; $color-black-2121: #212121; +$color-black-222: #222222; + $font-family-primary: 'Inter', sans-serif; $font-family-secondary: 'Montserrat', sans-serif; @@ -43,8 +45,6 @@ $size-font-4-xl: 1.875rem; /* 30px[H3] */ $size-font-5-xl: 1.75rem; /* 28px[H2] */ $size-font-6-xl: 2.5rem; /* 40px[H1] */ -$font-base: 16; - $font-weight-regular: 400; $font-weight-medium: 500; $font-weight-semi-bold: 600; From 3bd358305e784fa2bafe0727fb9ed7098fa4e66c Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Fri, 10 May 2024 17:46:56 +0530 Subject: [PATCH 2/3] [CMG-102] - UI for for On row uncheck make isdeleted value to true --- .../ContentMapper/contentMapper.interface.ts | 8 ++++ ui/src/components/ContentMapper/index.tsx | 45 ++++++++++++------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/ui/src/components/ContentMapper/contentMapper.interface.ts b/ui/src/components/ContentMapper/contentMapper.interface.ts index 77287cd1..3ad33dbb 100644 --- a/ui/src/components/ContentMapper/contentMapper.interface.ts +++ b/ui/src/components/ContentMapper/contentMapper.interface.ts @@ -100,3 +100,11 @@ export interface optionsType { export interface ExstingContentTypeMatch { [key: string]: string; } + +export interface UidMap { + [key: string]: boolean; +} + +export interface ContentTypeMap { + [key: string]: string; +} diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index ffd9b51a..a4e892d6 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -47,7 +47,9 @@ import { ExistingFieldType, ContentTypeList, ContentTypesSchema, - optionsType + optionsType, + UidMap, + ContentTypeMap } from './contentMapper.interface'; import { ItemStatusMapProp } from '@contentstack/venus-components/build/components/Table/types'; import { ModalObj } from '../Modal/modal.interface'; @@ -81,10 +83,6 @@ const Fields: Mapping = { CheckBox: 'Select' }; -interface ContentTypeMap { - [key: string]: string; -} - const ContentMapper = () => { /** ALL CONTEXT HERE */ const { @@ -140,7 +138,9 @@ const ContentMapper = () => { const [searchContentType, setSearchContentType] = useState(''); - const [selectedFields, setSelectedFields] = useState([]); + const [rowIds, setRowIds] = useState({}) + const [selectedEntries, setSelectedEntries] = useState([]); + /** ALL HOOKS Here */ const { projectId = '' } = useParams(); @@ -199,6 +199,15 @@ const ContentMapper = () => { } }, [tableData, isContentTypeSaved]); + // To make all the fields checked + useEffect(() => { + const selectedId = tableData.reduce((acc, item) => { + acc[item?.id] = true; + return acc; + }, {}); + setRowIds(selectedId) + }, [tableData]) + // Method to fetch content types const fetchContentTypes = async (searchText: string) => { const { data } = await getContentTypes(projectId || '', 0, 10, searchContentType || ''); //org id will always present @@ -320,7 +329,7 @@ const ContentMapper = () => { fetchFields(contentTypes?.[i]?.id, searchText || ''); setotherCmsUid(contentTypes?.[i]?.otherCmsUid); setSelectedContentType(contentTypes?.[i]); - }; + }; //function to handle previous content type navigation const handlePrevClick = (e: React.MouseEvent) => { @@ -386,15 +395,17 @@ const ContentMapper = () => { ); }; - interface UidMap { - [key: string]: boolean; + + // Function to handle selected fields + const handleSelectedEntries = (singleSelectedRowIds: any, selectedData: any) => { + const selectedObj: any = {} + singleSelectedRowIds.forEach((uid: any) => { + selectedObj[uid] = true; + }) + setRowIds(selectedObj) + setSelectedEntries(selectedData) } - const rowIds = tableData.reduce((acc, item) => { - acc[item?.id] = true; - return acc; - }, {}); - // Method for change select value const handleValueChange = (value: FieldTypes, rowIndex: string) => { setisDropDownCHanged(true); @@ -681,7 +692,7 @@ const ContentMapper = () => { updateAt: new Date(), contentstackTitle: selectedContentType?.contentstackTitle, contentstackUid: selectedContentType?.contnetStackUid, - fieldMapping: tableData + fieldMapping: selectedEntries } }; @@ -692,6 +703,9 @@ const ContentMapper = () => { dataCs ); + console.log('dataCs', dataCs); + + if (status == 200) { Notification({ notificationContent: { text: 'Content type saved successfully' }, @@ -908,6 +922,7 @@ const ContentMapper = () => { ), showExportCta: true }} + getSelectedRow={handleSelectedEntries} /> From ad7d1660548ac8c5c65bf9546323d111ea7ffb77 Mon Sep 17 00:00:00 2001 From: Sayali Joshi Date: Fri, 10 May 2024 17:54:32 +0530 Subject: [PATCH 3/3] Removed console --- ui/src/components/ContentMapper/index.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index 20ff3711..5c9ae498 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -835,9 +835,6 @@ const ContentMapper = () => { dataCs ); - console.log('dataCs', dataCs); - - if (status == 200) { Notification({ notificationContent: { text: 'Content type saved successfully' },