diff --git a/ui/src/cmsData/content_mapping.json b/ui/src/cmsData/content_mapping.json index c5b79c8da..cdf747030 100644 --- a/ui/src/cmsData/content_mapping.json +++ b/ui/src/cmsData/content_mapping.json @@ -35,7 +35,7 @@ "open_in_new_tab": false } ], - "content_types_heading": "Content Types", + "content_types_heading": "Content Models", "contentstack_fields": { "title": "Contentstack Field Types", "field_types": [ @@ -143,7 +143,7 @@ "_version": 3 }, "table_search_placeholder": "Search fields", - "search_placeholder": "Search content types", + "search_placeholder": "Search content models", "tags": [], "title": "Content Mapping", "updated_at": "2024-01-25T12:13:32.967Z", diff --git a/ui/src/cmsData/destinationStack.json b/ui/src/cmsData/destinationStack.json index 0ce50cd38..0fe310821 100644 --- a/ui/src/cmsData/destinationStack.json +++ b/ui/src/cmsData/destinationStack.json @@ -1,7 +1,7 @@ { "title": "Select Destination Stack", "cta": "Continue To Content Mapping", - "description":"Select the stack you want to migrate content to from the assigned organization.", + "description": "Select the stack you want to migrate content to from the assigned organization", "new_stack": { "save_stack_cta": "Save", "new_stack_input": "Enter Stack Details Below", diff --git a/ui/src/cmsData/homepage.json b/ui/src/cmsData/homepage.json index 46315cec3..e856330c9 100644 --- a/ui/src/cmsData/homepage.json +++ b/ui/src/cmsData/homepage.json @@ -18,5 +18,5 @@ "updated_at": "2023-12-12T09:03:00.889Z", "_version": 7, "_in_progress": false, - "description": "

Easily migrate content between stacks or from other CMS platforms to Contentstack.

" + "description": "

Easily migrate content between stacks or from other CMS platforms to Contentstack

" } diff --git a/ui/src/cmsData/legacyCms.json b/ui/src/cmsData/legacyCms.json index a4ca87405..665a2bda3 100644 --- a/ui/src/cmsData/legacyCms.json +++ b/ui/src/cmsData/legacyCms.json @@ -377,4 +377,4 @@ "restricted_keyword_checkbox_text": "Please acknowledge that you have referred to the Contentstack restricted keywords", "affix_cta": "Continue", "file_format_cta": "Continue" -} \ No newline at end of file +} diff --git a/ui/src/cmsData/migrationSteps.json b/ui/src/cmsData/migrationSteps.json index c318b7002..c8cab2826 100644 --- a/ui/src/cmsData/migrationSteps.json +++ b/ui/src/cmsData/migrationSteps.json @@ -17,7 +17,7 @@ "type": "p", "attrs": { "style": {}, "redactor-attributes": {}, "dir": "ltr" }, "uid": "f4f59ae597494fd5bf9b40920a2e7e86", - "children": [{ "text": "Select source CMS for data migration." }] + "children": [{ "text": "Select source CMS for data migration" }] } ], "type": "doc" @@ -118,7 +118,7 @@ "type": "p", "attrs": { "style": {}, "redactor-attributes": {}, "dir": "ltr" }, "uid": "9a6dbc02eff4492d81d5824a82f4c18e", - "children": [{ "text": "Review of content mapping on the target stack." }] + "children": [{ "text": "Review of content mapping on the target stack" }] } ], "_version": 11 diff --git a/ui/src/cmsData/projects.json b/ui/src/cmsData/projects.json index bde386e2b..49ec61484 100644 --- a/ui/src/cmsData/projects.json +++ b/ui/src/cmsData/projects.json @@ -53,7 +53,7 @@ "uid": "5ff5db2c09b54cf994ac9c0684d9a9eb", "children": [ { - "text": "Begin your content migration journey by creating a new project. Follow the steps to ensure a smooth and efficient transfer of your content." + "text": "Begin your content migration journey by creating a new project. Follow the steps to ensure a smooth and efficient transfer of your content" } ] } @@ -111,7 +111,7 @@ "uid": "abe73b9230a14732b851770356995ee8", "children": [ { - "text": "Don't worry though, we're here to help. Try adjusting your search terms or check if you misspelled anything." + "text": "Don't worry though, we're here to help. Try adjusting your search terms or check if you misspelled anything" } ] } @@ -141,4 +141,4 @@ }, "title": "New Project" } -} \ No newline at end of file +} diff --git a/ui/src/cmsData/region_login.json b/ui/src/cmsData/region_login.json index c4ed384da..310d7619c 100644 --- a/ui/src/cmsData/region_login.json +++ b/ui/src/cmsData/region_login.json @@ -2,7 +2,7 @@ "title": "Account Login", "url": "/region-login", "heading": "Account Login", - "description": "Please select Contentstack North America (AWS, Azure or GCP) or Contentstack Europe (AWS or Azure) to continue.", + "description": "Please select Contentstack North America (AWS, Azure or GCP) or Contentstack Europe (AWS or Azure) to continue", "regions": [ { "region": "NA", @@ -55,30 +55,30 @@ { "region": "GCP_NA", "service_icon": { - "uid": "blt57dafa9c1472b46f", - "created_at": "2024-07-29T10:57:59.058Z", - "updated_at": "2024-07-29T10:57:59.058Z", - "created_by": "blt181afddb6080e3df", - "updated_by": "blt181afddb6080e3df", - "content_type": "image/svg+xml", - "file_size": "1622", - "tags": [], - "filename": "google-cloud_1.svg", - "url": "https://images.contentstack.io/v3/assets/bltd3620ec6418ad3ad/blt57dafa9c1472b46f/66a775b7d14106640a554ec7/google-cloud_1.svg", - "ACL": [], - "is_dir": false, - "parent_uid": null, - "_version": 1, - "title": "google-cloud_1.svg" + "uid": "blt57dafa9c1472b46f", + "created_at": "2024-07-29T10:57:59.058Z", + "updated_at": "2024-07-29T10:57:59.058Z", + "created_by": "blt181afddb6080e3df", + "updated_by": "blt181afddb6080e3df", + "content_type": "image/svg+xml", + "file_size": "1622", + "tags": [], + "filename": "google-cloud_1.svg", + "url": "https://images.contentstack.io/v3/assets/bltd3620ec6418ad3ad/blt57dafa9c1472b46f/66a775b7d14106640a554ec7/google-cloud_1.svg", + "ACL": [], + "is_dir": false, + "parent_uid": null, + "_version": 1, + "title": "google-cloud_1.svg" }, "service_title": "Google Cloud Platform", "region_title": "North America", "cta": { - "title": "Continue", - "url": "/login" + "title": "Continue", + "url": "/login" }, "_metadata": { - "uid": "cs14bce3c329a87986" + "uid": "cs14bce3c329a87986" } }, { diff --git a/ui/src/cmsData/test_migration.json b/ui/src/cmsData/test_migration.json index 3d108e1a9..eb4f680d4 100644 --- a/ui/src/cmsData/test_migration.json +++ b/ui/src/cmsData/test_migration.json @@ -15,5 +15,5 @@ "url": "", "with_icon": false }, - "subtitle": "Test Migration allows you to migrate selected content to a test stack for review. Verify the content and ensure everything is correct before proceeding to the final migration." + "subtitle": "Test Migration allows you to migrate selected content to a test stack for review. Verify the content and ensure everything is correct before proceeding to the final migration" } diff --git a/ui/src/common/assets/icons.tsx b/ui/src/common/assets/icons.tsx index 18a4870b3..52b9b0e8f 100644 --- a/ui/src/common/assets/icons.tsx +++ b/ui/src/common/assets/icons.tsx @@ -12,7 +12,8 @@ export const NO_PROJECTS_SEARCH = ( height="300" viewBox="0 0 300 300" fill="none" - xmlns="http://www.w3.org/2000/svg"> + xmlns="http://www.w3.org/2000/svg" + > + fill="none" + > + name="CaretRight" + > - - - + + + ); @@ -811,8 +829,16 @@ export const LOG_OUT = ( */ export const MAGNIFY = ( - - + + ); @@ -826,8 +852,16 @@ export const MAGNIFY = ( */ export const DEMAGNIFY = ( - - + + ); @@ -841,30 +875,181 @@ export const DEMAGNIFY = ( */ export const SCHEMA_PREVIEW = ( - - - - - + + + + + - ); - -export const NoDataFound = ( - - - - - - - - - - +export const NoDataFound = ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); - - diff --git a/ui/src/components/AccountPage/index.tsx b/ui/src/components/AccountPage/index.tsx index bbb5baa35..aa9b5ed80 100644 --- a/ui/src/components/AccountPage/index.tsx +++ b/ui/src/components/AccountPage/index.tsx @@ -6,7 +6,7 @@ import './index.scss'; /** * Renders the AccountPage component. - * + * * @param {AccountObj} props - The props object containing data for the component. * @returns {JSX.Element} The rendered AccountPage component. */ @@ -19,7 +19,7 @@ const AccountPage = (props: AccountObj): JSX.Element => { // eslint-disable-next-line react/no-unknown-property
- Contentstack + Contentstack

{heading}

diff --git a/ui/src/components/AdvancePropertise/advanceProperties.interface.ts b/ui/src/components/AdvancePropertise/advanceProperties.interface.ts index 057ea1417..87d1b6830 100644 --- a/ui/src/components/AdvancePropertise/advanceProperties.interface.ts +++ b/ui/src/components/AdvancePropertise/advanceProperties.interface.ts @@ -8,17 +8,17 @@ export interface SchemaProps { * The type of the field. */ fieldtype: string; - + /** * The updated settings for the field. */ value: UpdatedSettings; - + /** * The ID of the row. */ rowId: string; - + /** * A function to update the field settings. * @param rowId - The ID of the row. @@ -26,22 +26,22 @@ export interface SchemaProps { * @param checkBoxChanged - Indicates whether the checkbox has changed. */ updateFieldSettings: (rowId: string, value: Advanced, checkBoxChanged: boolean) => void; - + /** * Indicates whether the field is localized. */ isLocalised: boolean; - + /** * A function to close the modal. */ closeModal: () => void; - + /** * The data for the field map. */ data: FieldMapType; - + /** * The ID of the project. */ @@ -121,8 +121,8 @@ export interface UpdatedSettings { embedObjects?: any; - default_value?: string |boolean; - options?: any[] + default_value?: string | boolean; + options?: any[]; } /** @@ -236,8 +236,8 @@ export interface StateType { embedAssests?: boolean; } -export interface optionsType{ - label?:string; - key?:string; - value:string -} \ No newline at end of file +export interface optionsType { + label?: string; + key?: string; + value: string; +} diff --git a/ui/src/components/AdvancePropertise/index.tsx b/ui/src/components/AdvancePropertise/index.tsx index 28ac6a19d..6720013fb 100644 --- a/ui/src/components/AdvancePropertise/index.tsx +++ b/ui/src/components/AdvancePropertise/index.tsx @@ -22,7 +22,7 @@ import { getContentTypes } from '../../services/api/migration.service'; import { validateArray } from '../../utilities/functions'; // Interfaces -import { optionsType, SchemaProps } from './advanceProperties.interface'; +import { optionsType, SchemaProps } from './advanceProperties.interface'; import { ContentType } from '../ContentMapper/contentMapper.interface'; // Styles @@ -64,45 +64,44 @@ const AdvancePropertise = (props: SchemaProps) => { const embedObjects = props?.value?.embedObjects?.map((item: string) => ({ label: item, - value: item, + value: item })); // State for content types const [contentTypes, setContentTypes] = useState([]); const [ctValue, setCTValue] = useState(embedObjects); - const [embedObjectsLabels, setEmbedObjectsLabels] = useState(props?.value?.embedObjects); + const [embedObjectsLabels, setEmbedObjectsLabels] = useState( + props?.value?.embedObjects + ); const [showOptions, setShowOptions] = useState>({}); const [showIcon, setShowIcon] = useState(); const filterRef = useRef(null); const [options, setOptions] = useState(props?.value?.options || []); const [draggedIndex, setDraggedIndex] = useState(null); - - useEffect(()=>{ + + useEffect(() => { const defaultIndex = toggleStates?.option?.findIndex( (item: optionsType) => toggleStates?.default_value === item?.key ); - + if (defaultIndex !== -1) { setShowIcon(defaultIndex); } - - },[]); + }, []); useEffect(() => { fetchContentTypes(''); - }, []) + }, []); /** * Fetches the content types list. * @param searchText - The search text. */ const fetchContentTypes = async (searchText: string) => { try { - const { data } = await getContentTypes(props?.projectId ?? '', 0,5000, searchText || ''); //org id will always present + const { data } = await getContentTypes(props?.projectId ?? '', 0, 5000, searchText || ''); //org id will always present setContentTypes(data?.contentTypes); } catch (error) { return error; - } - }; /** @@ -111,7 +110,11 @@ const AdvancePropertise = (props: SchemaProps) => { * @param event - The change event. * @param checkBoxChanged - Indicates if the checkbox was changed. */ - const handleOnChange = (field: string, event: React.ChangeEvent, checkBoxChanged: boolean) => { + const handleOnChange = ( + field: string, + event: React.ChangeEvent, + checkBoxChanged: boolean + ) => { setToggleStates((prevStates) => ({ ...prevStates, [field]: (event.target as HTMLInputElement)?.value @@ -119,7 +122,7 @@ const AdvancePropertise = (props: SchemaProps) => { const currentToggleStates = { ...toggleStates, - [field]: (event.target as HTMLInputElement)?.value, + [field]: (event.target as HTMLInputElement)?.value }; props?.updateFieldSettings( @@ -130,7 +133,7 @@ const AdvancePropertise = (props: SchemaProps) => { default_value: currentToggleStates?.default_value, validationRegex: currentToggleStates?.validationRegex ?? '', minChars: currentToggleStates?.minChars, - maxChars:currentToggleStates?.maxChars, + maxChars: currentToggleStates?.maxChars, mandatory: currentToggleStates?.mandatory, multiple: currentToggleStates?.multiple, unique: false, @@ -142,7 +145,7 @@ const AdvancePropertise = (props: SchemaProps) => { minSize: currentToggleStates?.minSize, maxSize: currentToggleStates?.maxSize, title: currentToggleStates?.title, - url:currentToggleStates?.url + url: currentToggleStates?.url }, checkBoxChanged ); @@ -161,9 +164,9 @@ const AdvancePropertise = (props: SchemaProps) => { })); const currentToggleStates = { ...toggleStates, - [field]: value, + [field]: value }; - + props?.updateFieldSettings( props?.rowId, { @@ -175,30 +178,29 @@ const AdvancePropertise = (props: SchemaProps) => { unique: false, nonLocalizable: currentToggleStates?.nonLocalizable, embedObject: currentToggleStates?.embedObject, - embedObjects : embedObjectsLabels, + embedObjects: embedObjectsLabels, default_value: currentToggleStates?.default_value, minChars: currentToggleStates?.minChars, - maxChars:currentToggleStates?.maxChars, + maxChars: currentToggleStates?.maxChars, minRange: currentToggleStates?.minRange, maxRange: currentToggleStates?.maxRange, minSize: currentToggleStates?.minSize, maxSize: currentToggleStates?.maxSize, title: currentToggleStates?.title, - url:currentToggleStates?.url + url: currentToggleStates?.url }, checkBoxChanged ); }; - - const handleRadioChange = (field: string,value:boolean) => { + const handleRadioChange = (field: string, value: boolean) => { setToggleStates((prevStates) => ({ ...prevStates, [field]: value })); const currentToggleStates = { ...toggleStates, - [field]: value, + [field]: value }; props?.updateFieldSettings( @@ -211,26 +213,22 @@ const AdvancePropertise = (props: SchemaProps) => { unique: false, nonLocalizable: currentToggleStates?.nonLocalizable, embedObject: currentToggleStates?.embedObject, - embedObjects : embedObjectsLabels + embedObjects: embedObjectsLabels }, true ); - }; - const handleOnClick = ( index:number) =>{ - + const handleOnClick = (index: number) => { setShowOptions((prev) => ({ - - [index]: !prev[index], + [index]: !prev[index] })); - } - - const handleDefalutValue = (index:number, option:optionsType) => { + }; + + const handleDefalutValue = (index: number, option: optionsType) => { setShowIcon(index); setShowOptions(() => ({ - - [index]: false, + [index]: false })); setToggleStates((prevStates) => ({ ...prevStates, @@ -250,18 +248,16 @@ const AdvancePropertise = (props: SchemaProps) => { unique: false, nonLocalizable: currentToggleStates?.nonLocalizable, embedObject: currentToggleStates?.embedObject, - embedObjects : embedObjectsLabels, - options:options + embedObjects: embedObjectsLabels, + options: options }, true ); - - } - const handleRemoveDefalutValue = (index:number)=>{ + }; + const handleRemoveDefalutValue = (index: number) => { setShowIcon(-1); setShowOptions(() => ({ - - [index]: false, + [index]: false })); setToggleStates((prevStates) => ({ ...prevStates, @@ -281,50 +277,46 @@ const AdvancePropertise = (props: SchemaProps) => { unique: false, nonLocalizable: currentToggleStates?.nonLocalizable, embedObject: currentToggleStates?.embedObject, - embedObjects : embedObjectsLabels, + embedObjects: embedObjectsLabels, options: options }, true ); - } + }; const handleDragStart = (index: number) => { setDraggedIndex(index); document.querySelectorAll('.element-wrapper').forEach((el, i) => { if (i === index) { - el.classList.add('dragging'); + el.classList.add('dragging'); } }); }; - const handleDragOver = (e:React.DragEvent, index:number) => { - e.preventDefault(); + const handleDragOver = (e: React.DragEvent, index: number) => { + e.preventDefault(); document.querySelectorAll('.element-wrapper').forEach((el, i) => { if (i === index) { - el.classList.remove('dragging'); + el.classList.remove('dragging'); } }); }; - const handleDrop = (index:number) => { + const handleDrop = (index: number) => { if (draggedIndex === null) return; - - const updatedOptions = [...options]; - const draggedItem = updatedOptions[draggedIndex]; - const targetItem = updatedOptions[index]; - - updatedOptions[draggedIndex] = targetItem; - updatedOptions[index] = draggedItem; - - setOptions(updatedOptions); - setDraggedIndex(null); - - + + const updatedOptions = [...options]; + const draggedItem = updatedOptions[draggedIndex]; + const targetItem = updatedOptions[index]; + + updatedOptions[draggedIndex] = targetItem; + updatedOptions[index] = draggedItem; + + setOptions(updatedOptions); + setDraggedIndex(null); }; - useEffect(() => { - if (ctValue && Array.isArray(ctValue)) { const labels = ctValue.map((item) => item.label); setEmbedObjectsLabels(labels); @@ -332,147 +324,162 @@ const AdvancePropertise = (props: SchemaProps) => { }, [ctValue]); // Option for content types - const contentTypesList = contentTypes?.filter((ct: ContentType) => ct?.type === "content_type"); - + const contentTypesList = contentTypes?.filter((ct: ContentType) => ct?.type === 'content_type'); + const option = validateArray(contentTypesList) - ? contentTypesList?.map((option: ContentType) => ({ label: option?.contentstackTitle, value: option?.contentstackUid })) + ? contentTypesList?.map((option: ContentType) => ({ + label: option?.contentstackTitle, + value: option?.contentstackUid + })) : [{ label: contentTypesList, value: contentTypesList }]; return ( <> - + -
- - - {(props?.fieldtype === 'Dropdown') && - <> - - Choice - - - (read only) -
- {options?.map((option: optionsType,index)=>( - -
handleDragStart(index)} - onDragOver={(e)=> handleDragOver(e,index)} - onDrop={() => handleDrop(index)} - > -
- -
- + {props?.fieldtype === 'Dropdown' && ( + <> + + Choice + + (read only) +
+ {options?.map((option: optionsType, index) => ( +
handleDragStart(index)} + onDragOver={(e) => handleDragOver(e, index)} + onDrop={() => handleDrop(index)} + > +
+ +
+ } - > - - - - - - {showOptions[index] && ( -
- {showIcon !== index ? - - : - - - } - - -
- )} - - - + suffix={ + index === showIcon && ( + + ) + } + > + + + + {showOptions[index] && ( +
+ {showIcon !== index ? ( + + ) : ( + + )} +
+ )}
- - ))} - + ))} +
+ + )} -
- - - - - } - - {(props?.fieldtype === 'Single Line Textbox' || props?.fieldtype === 'Multi Line Textbox') && ( + {(props?.fieldtype === 'Single Line Textbox' || + props?.fieldtype === 'Multi Line Textbox') && ( <> Default Value - - + + ) => handleOnChange('default_value', e, true))} + onChange={ + handleOnChange && + ((e: React.ChangeEvent) => + handleOnChange('default_value', e, true)) + } /> - + Validation (Regex) - + ) => handleOnChange('validationRegex', e, true))} + onChange={ + handleOnChange && + ((e: React.ChangeEvent) => + handleOnChange('validationRegex', e, true)) + } /> - )} + )} {props?.fieldtype === 'Link' && ( <> -
- - Default Value - - - - -
+
+ + Default Value + + + + +
@@ -483,7 +490,10 @@ const AdvancePropertise = (props: SchemaProps) => { value={toggleStates?.title} placeholder="Enter value" version="v2" - onChange={handleOnChange && ((e: React.ChangeEvent) => handleOnChange('title', e, true))} + onChange={ + handleOnChange && + ((e: React.ChangeEvent) => handleOnChange('title', e, true)) + } /> @@ -496,31 +506,32 @@ const AdvancePropertise = (props: SchemaProps) => { value={toggleStates?.url} placeholder="Enter value" version="v2" - onChange={handleOnChange && ((e: React.ChangeEvent) => handleOnChange('url', e, true))} + onChange={ + handleOnChange && + ((e: React.ChangeEvent) => handleOnChange('url', e, true)) + } /> - + )} {props?.fieldtype === 'Boolean' && ( - - Default Value - -
- handleRadioChange('default_value',true)}> - - handleRadioChange('default_value',false)}> - - -
- + + Default Value + +
+ handleRadioChange('default_value', true)} + > + handleRadioChange('default_value', false)} + > +
)} @@ -529,12 +540,7 @@ const AdvancePropertise = (props: SchemaProps) => { Referenced Content Type - - + )} @@ -543,37 +549,46 @@ const AdvancePropertise = (props: SchemaProps) => { Other Options
- {(props?.fieldtype === 'HTML Rich text Editor' || props?.fieldtype === 'JSON Rich Text Editor') && ( + {(props?.fieldtype === 'HTML Rich text Editor' || + props?.fieldtype === 'JSON Rich Text Editor') && ( <> -
+
0 || toggleStates?.embedObject} - onChange={handleToggleChange && ((e: React.MouseEvent) => handleToggleChange('embedObject', (e.target as HTMLInputElement)?.checked, true))} + onChange={ + handleToggleChange && + ((e: React.MouseEvent) => + handleToggleChange( + 'embedObject', + (e.target as HTMLInputElement)?.checked, + true + )) + } />
- - {(ctValue && ctValue?.length > 0 || toggleStates?.embedObject) && ( + + {((ctValue && ctValue?.length > 0) || toggleStates?.embedObject) && ( handleSelectedCsLocale(key, index, 'csLocale')} + onChange={(key: { label: string; value: string }) => + handleSelectedCsLocale(key, index, 'csLocale') + } options={csOptions} placeholder={placeholder} isSearchable @@ -305,12 +316,16 @@ const Mapper = ({ className="select-container" /> */