Skip to content
Merged

Dev #177

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Content type and Global fields icons added
  • Loading branch information
sayalijoshi27 committed Jul 9, 2024
commit 922f49aba1b808875bbe36c3e043743569c04c21
1 change: 1 addition & 0 deletions ui/src/components/ContentMapper/contentMapper.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface ContentType {
updateAt: string;
id?: string;
status: string;
type: string;
fieldMapping?: FieldMapType[] | [];
}

Expand Down
14 changes: 8 additions & 6 deletions ui/src/components/ContentMapper/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
justify-content: space-between;
line-height: normal;
min-height: 42px;
padding: $px-8 $px-4 $px-8 $px-12;
padding: $px-8 $px-10 $px-8 $px-12;
&:hover, &.active-ct {
background-color: $color-brand-white-base;
.cms-title {
Expand All @@ -80,22 +80,24 @@
}
}
.cms-title {
margin-right: 12px;
align-items: center;
display: flex;
margin-right: $px-12;
max-height: 24px;
max-width: 155px;
white-space: nowrap;
width: 80%;
.tippy-wrapper {
display: flex;
}
span {
color: $color-font-base;
margin-left: $px-10;
overflow: hidden;
text-overflow: ellipsis;
}
}
.ct-options {
justify-content: flex-end;
min-width: 150px;
}
}
}
Expand All @@ -111,14 +113,14 @@
}
}
.content-type-list {
padding-left: 12px;
padding-left: $px-12;
}
.content-types-fields-wrapper {
display: flex;
flex-direction: column;
max-width: 75%;
width: 100%;
padding: 0px;
padding: 0;
}
.cta-wrapper {
border-top: 1px solid $color-base-gray-40;
Expand Down
30 changes: 9 additions & 21 deletions ui/src/components/ContentMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Notification,
cbModal,
InstructionText,
Dropdown
} from '@contentstack/venus-components';

// Services
Expand Down Expand Up @@ -122,7 +121,6 @@ const ContentMapper = () => {
const [itemStatusMap, updateItemStatusMap] = useState({});
const [totalCounts, setTotalCounts] = useState<number>(tableData?.length);
const [fieldValue, setFieldValue] = useState<FieldTypes>();
const [currentIndex, setCurrentIndex] = useState(0);

const [searchText, setSearchText] = useState('');
const [contentTypes, setContentTypes] = useState<ContentType[]>([]);
Expand Down Expand Up @@ -356,7 +354,6 @@ const ContentMapper = () => {
setOtherContentType({ label: option, value: option });

setContentTypeUid(contentTypes?.[i]?.id ?? '');
setCurrentIndex(i);
fetchFields(contentTypes?.[i]?.id ?? '', searchText || '');
setotherCmsUid(contentTypes?.[i]?.otherCmsUid);
setSelectedContentType(contentTypes?.[i]);
Expand Down Expand Up @@ -1003,6 +1000,7 @@ const ContentMapper = () => {
<ul className="ct-list">
{filteredContentTypes?.map((content: ContentType, index: number) => {
const icon = STATUS_ICON_Mapping[content?.status] || '';

return (
<li
key={`${index.toString()}`}
Expand All @@ -1011,9 +1009,15 @@ const ContentMapper = () => {
onKeyDown={() => openContentType(index)}
>
<div className='cms-title'>
<Tooltip content={content?.otherCmsTitle} position="left">
<span>{content?.otherCmsTitle}</span>
<Tooltip content={content?.type} position="bottom">
{content?.type === "Content Type"
? <Icon icon={active == index ? "ContentModelsMediumActive" : "ContentModelsMedium"} size="small" />
: content?.type === "Global Field"
? <Icon icon={active == index ? "GlobalFieldsMediumActive" : "GlobalFieldsMedium"} size="small" />
: <></>
}
</Tooltip>
<span>{content?.otherCmsTitle}</span>
</div>


Expand All @@ -1030,22 +1034,6 @@ const ContentMapper = () => {
<Icon icon="LivePreview" version="v2" onClick={handleSchemaPreview} />
</Tooltip>
</span>

{/* <Dropdown
list={[
{
action: handleSchemaPreview,
default: true,
label: 'Schema Preview'
}
]}
type="click"
withIcon
dropDownPosition="left"
className='dropdown-align'
>
<Icon icon="DotsThreeLargeVertical" version="v2" />
</Dropdown> */}
</div>
</li>
)
Expand Down
1 change: 1 addition & 0 deletions ui/src/components/MainHeader/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
}

.logo {
cursor: pointer;
position: relative;
text-align: center;
width: 3.5rem;
Expand Down
25 changes: 2 additions & 23 deletions ui/src/components/MainHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Libraries
import { useEffect, useState } from 'react';
import { useNavigate, useLocation, Link, Params, useParams } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router-dom';
import { cbModal, Dropdown, Tooltip} from '@contentstack/venus-components';
import { useDispatch, useSelector } from 'react-redux';

Expand All @@ -14,7 +14,6 @@ import { setSelectedOrganisation } from '../../store/slice/authSlice';
//Utilities
import { CS_ENTRIES } from '../../utilities/constants';
import {
clearLocalStorage,
getDataFromLocalStorage,
isEmptyString,
setDataInLocalStorage
Expand All @@ -30,7 +29,6 @@ import './index.scss';
import NotificationModal from '../Common/NotificationModal';
import { updateNewMigrationData } from '../../store/slice/migrationDataSlice';
import { ModalObj } from '../Modal/modal.interface';
import { getProject } from '../../services/api/project.service';

const MainHeader = () => {

Expand All @@ -41,14 +39,10 @@ const MainHeader = () => {

const [data, setData] = useState<MainHeaderType>({});
const [orgsList, setOrgsList] = useState<IDropDown[]>([]);
const [currentStep, setCurrentStep] = useState<number>(0);
const [projectName, setProjectName] = useState('');

const location = useLocation();
const navigate = useNavigate();
const dispatch = useDispatch();
const params = useParams();


const { logo, organization_label: organizationLabel } = data;

Expand All @@ -57,7 +51,7 @@ const MainHeader = () => {
const updateOrganisationListState = () => {
if (organisationsList) {
//set selected org as default
const list = organisationsList.map((org: any) => ({
const list = organisationsList.map((org: IDropDown) => ({
...org,
default: org?.value === selectedOrganisation?.value
}));
Expand Down Expand Up @@ -89,16 +83,6 @@ const MainHeader = () => {
useEffect(() => {
updateOrganisationListState();
}, [selectedOrganisation]);

const urlParams = new URLSearchParams(location.search);
const newParam = urlParams.get('region');

// Function for Logout
const handleLogout = () => {
if (clearLocalStorage()) {
navigate('/', { replace: true });
}
};

const handleOnDropDownChange = (data: IDropDown) => {
if (data.value === selectedOrganisation.value) return;
Expand Down Expand Up @@ -136,13 +120,8 @@ const MainHeader = () => {
else{
dispatch(updateNewMigrationData(DEFAULT_NEW_MIGRATION))
navigate(`/projects`, { replace: true });

}



};

return (
<div className="mainheader">
<div className="d-flex align-items-center" onClick={handleonClick}>
Expand Down