Skip to content
Merged

Dev #111

Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<a href="#root" class="skip-to-main-content-link">Skip to main content</a>
<a href="#root" class="skip-to-main-content-link">Skip to main content</a>

<div id="root"></div>
</body>
Expand Down
5 changes: 2 additions & 3 deletions ui/src/components/AccountPage/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@
.copyright_text {
bottom: 1.5rem;
color: $color-font-base;
font-size: .75rem;
letter-spacing: .02em;
font-size: 0.75rem;
letter-spacing: 0.02em;
left: 2.5rem;
position: absolute;
}

2 changes: 1 addition & 1 deletion ui/src/components/AccountPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const AccountPage = (props: AccountObj): JSX.Element => {
</div>
<div className="AccountPage__action">
<div className="AccountPage__content">{props?.children}</div>
<p className='copyright_text'>{`© ${previousYear}-${currentYear} ${copyrightText}`}</p>
<p className="copyright_text">{`© ${previousYear}-${currentYear} ${copyrightText}`}</p>
</div>
</div>
);
Expand Down
75 changes: 40 additions & 35 deletions ui/src/components/AdvancePropertise/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,16 @@ import {

import './index.scss';


export interface SchemaProps {
fieldtype: string;
value: any;
rowId: string;
updateFieldSettings:(rowId:string, value:any, checkBoxChanged:boolean)=> void;
isLocalised:boolean;
updateFieldSettings: (rowId: string, value: any, checkBoxChanged: boolean) => void;
isLocalised: boolean;
closeModal: () => void;
data:any
data: any;
}
const AdvancePropertise = (props: SchemaProps) => {


const AdvancePropertise = (props: SchemaProps) => {
const [toggleStates, setToggleStates] = useState({
validationRegex: props?.value?.ValidationRegex,
mandatory: props?.value?.Mandatory,
Expand All @@ -33,26 +30,31 @@ const AdvancePropertise = (props: SchemaProps) => {
});

const handleToggleChange = (field: string, value: boolean, checkBoxChanged: boolean) => {

setToggleStates(prevStates => ({
setToggleStates((prevStates) => ({
...prevStates,
[field]: value
}));

props?.updateFieldSettings(props?.rowId, {[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: value}, checkBoxChanged);
};
}));

const handleOnChange = ( field: string, event: any, checkBoxChanged: boolean) => {
setToggleStates(prevStates => ({
props?.updateFieldSettings(
props?.rowId,
{ [field?.charAt(0)?.toUpperCase() + field?.slice(1)]: value },
checkBoxChanged
);
};

const handleOnChange = (field: string, event: any, checkBoxChanged: boolean) => {
setToggleStates((prevStates) => ({
...prevStates,
[field]: event?.target?.value
}));

props?.updateFieldSettings(props?.rowId, {[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: event?.target?.value}, checkBoxChanged);
}));

}
props?.updateFieldSettings(
props?.rowId,
{ [field?.charAt(0)?.toUpperCase() + field?.slice(1)]: event?.target?.value },
checkBoxChanged
);
};


return (
<>
<ModalHeader title={`${props?.fieldtype} propertise`} closeModal={props?.closeModal} />
Expand All @@ -66,7 +68,7 @@ const AdvancePropertise = (props: SchemaProps) => {
value={toggleStates?.validationRegex}
placeholder="Enter value"
version="v2"
onChange={(e:any)=> handleOnChange("validationRegex",e, true)}
onChange={(e: any) => handleOnChange('validationRegex', e, true)}
/>
<FieldLabel className="option-label" htmlFor="someInput" version="v2">
Options
Expand All @@ -77,33 +79,36 @@ const AdvancePropertise = (props: SchemaProps) => {
labelColor="primary"
labelPosition="right"
checked={toggleStates?.mandatory}
onChange={(e:any) => handleToggleChange("mandatory" , e?.target?.checked, true)}
onChange={(e: any) => handleToggleChange('mandatory', e?.target?.checked, true)}
/>
<ToggleSwitch
label="Multiple"
labelColor="primary"
labelPosition="right"
checked={toggleStates?.multiple}
onChange={(e:any) => handleToggleChange("multiple" ,e?.target?.checked, true)}
onChange={(e: any) => handleToggleChange('multiple', e?.target?.checked, true)}
/>
<ToggleSwitch
label="Unique"
labelColor="primary"
labelPosition="right"
checked={toggleStates?.unique}
onChange={(e:any) => handleToggleChange("unique" , e?.target?.checked,true)}
onChange={(e: any) => handleToggleChange('unique', e?.target?.checked, true)}
/>
<Tooltip content='Available only if there are multiple languages in your stack' position='top' disabled={props?.isLocalised}>
<ToggleSwitch
id="disabled"
disabled={ ! props?.isLocalised}
label="Non-localizable"
labelColor="primary"
labelPosition="right"
checked={toggleStates?.nonLocalizable}
onChange={(e:any) => handleToggleChange("nonLocalizable" , e?.target?.checked,true)}
/>

<Tooltip
content="Available only if there are multiple languages in your stack"
position="top"
disabled={props?.isLocalised}
>
<ToggleSwitch
id="disabled"
disabled={!props?.isLocalised}
label="Non-localizable"
labelColor="primary"
labelPosition="right"
checked={toggleStates?.nonLocalizable}
onChange={(e: any) => handleToggleChange('nonLocalizable', e?.target?.checked, true)}
/>
</Tooltip>
<p className="non-localizable-message">
If enabled, editing this field is restricted in localized entries. The field will use
Expand Down
16 changes: 11 additions & 5 deletions ui/src/components/Card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@
padding: 1.75rem 2rem 0.688rem;
}
.ProjectCard__title {
color: $color-font-black;
font-size: $size-font-2-xl;
font-weight: $font-weight-extra-bold;
height: 1.563rem;
line-height: $line-height-reset;
color: $color-font-base;
display: -webkit-box;
font-size: $size-font-xl;
font-weight: $font-weight-semi-bold;
height: $px-48;
line-height: $line-height-default;
overflow: hidden;
padding: 0;
white-space: normal;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.ProjectCard__footer {
display: flex;
Expand Down
4 changes: 3 additions & 1 deletion ui/src/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const CardList = ({ project }: ProjectType) => {
<div className="ProjectCard__stats">
<div className="ProjectCard__unit">
<span className="ProjectCard__stats-number">Project Status</span>
<span className="ProjectCard__stats-category">{PROJECT_STATUS?.[project?.status !== undefined ? project?.status : 0]}</span>
<span className="ProjectCard__stats-category">
{PROJECT_STATUS?.[project?.status !== undefined ? project?.status : 0]}
</span>
</div>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/Common/AddStack/addStack.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
.ReactModal__Overlay .ReactModal__Content .ReactModal__Content__body.selectWrapperBody {
overflow: visible;
}

28 changes: 15 additions & 13 deletions ui/src/components/Common/AddStack/addStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,26 @@ const AddStack = (props: any): JSX.Element => {
setIsLoading(false);
});

//fetch all locales
getAllLocales(props?.selectedOrganisation).then((response:any) => {
const rawMappedLocalesMapped = validateObject(response?.data) && response?.data?.locales
? Object?.keys(response?.data?.locales)?.map((key) => ({
uid: key,
label: response?.data?.locales[key],
value: key,
master_locale: key,
locales:[],
created_at: key
}))
: [];
//fetch all locales
getAllLocales(props?.selectedOrganisation)
.then((response: any) => {
const rawMappedLocalesMapped =
validateObject(response?.data) && response?.data?.locales
? Object?.keys(response?.data?.locales)?.map((key) => ({
uid: key,
label: response?.data?.locales[key],
value: key,
master_locale: key,
locales: [],
created_at: key
}))
: [];
setAllLocales(rawMappedLocalesMapped);
})
.catch((err: any) => {
console.error(err);
});
//org id will always be there
//org id will always be there
}, []);
return (
<>
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/ContentMapper/contentMapper.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ interface mapDataType {
projectId: string;
}
interface Advanced {
ValidationRegex: string,
mandatory:boolean,
multiple:boolean,
unique:boolean,
nonLocalizable:boolean
ValidationRegex: string;
mandatory: boolean;
multiple: boolean;
unique: boolean;
nonLocalizable: boolean;
}
export interface ContentMapperType {
content_types_heading?: string;
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface FieldMapType {
uid: string;
id: string;
_canSelect?: boolean;
advanced:Advanced
advanced: Advanced;
}

export interface ItemStatus {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ContentMapper/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
}
}
.disabled-field {
color: $color-font-disabled;
color: $color-font-disabled;
}
.action-btn-wrapper {
background-color: $color-brand-white-base;
Expand Down
Loading