Skip to content

Commit

Permalink
MOSIP : 33771 - UI fixes and added fav icon. (#457)
Browse files Browse the repository at this point in the history
* MOSIP : 33771 - UI fixes and added fav icon.

Signed-off-by: sudeep <[email protected]>

* MOSIP : 33771 - UI fixes and added fav icon.

Signed-off-by: sudeep <[email protected]>

---------

Signed-off-by: sudeep <[email protected]>
Signed-off-by: Sudeep7353 <[email protected]>
  • Loading branch information
Sudeep7353 authored Jun 13, 2024
1 parent d8179fe commit b8f96c4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 85 deletions.
9 changes: 3 additions & 6 deletions pmp-reactjs-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/mosip_icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/mosip_icon.svg" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
16 changes: 3 additions & 13 deletions pmp-reactjs-ui/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
"src": "mosip_icon.svg",
"type": "image/svg+xml",
"sizes": "any"
}
],
"start_url": ".",
Expand Down
File renamed without changes
5 changes: 2 additions & 3 deletions pmp-reactjs-ui/src/nav/HeaderNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { handleMouseClickForDropdown, logout } from '../utils/AppUtils.js';
import profileIcon from '../profile_icon.png';
import hamburgerIcon from '../svg/hamburger_icon.svg';
import orgIcon from '../svg/org_icon.svg';
import mosip_icon from '../../src/mosip_icon.svg';
import side_menu_title from '../../src/side_menu_title.svg';

function HeaderNav({ open, setOpen }) {
Expand All @@ -31,15 +30,15 @@ function HeaderNav({ open, setOpen }) {
<div className={`flex gap-x-4 h-16 items-center shadow-sm`}>
{!open && (
<div className={`flex items-center ${isLoginLanguageRTL ? "pr-5" : "pl-6"}`}>
<img src={mosip_icon} alt="" />
<img src={process.env.PUBLIC_URL + '/mosip_icon.svg'} alt="Mosip Icon" />
<div className="p-9 cursor-pointer" onClick={() => setOpen(!open)}>
<img className="min-w-5" src={hamburgerIcon} alt=""></img>
</div>
</div>
)}
{open && (
<div className={`flex items-center w-64 gap-x-4 ${isLoginLanguageRTL ? "pr-5" : "pl-6"} h-16 shadow-md`}>
<img src={mosip_icon} alt="" />
<img src={process.env.PUBLIC_URL + '/mosip_icon.svg'} alt="Mosip Icon" />
<div className={`duration-700`}>
<img src={side_menu_title} alt="" />
</div>
Expand Down
90 changes: 30 additions & 60 deletions pmp-reactjs-ui/src/pages/certificates/UploadCertificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import { getUserProfile } from '../../services/UserProfileService';
import ErrorMessage from "../common/ErrorMessage";
import LoadingIcon from "../common/LoadingIcon";
import SuccessMessage from '../common/SuccessMessage';
import DropdownComponent from '../common/fields/DropdownComponent';
import fileUploadImg from '../../svg/file_upload_certificate.svg';
import fileDescription from '../../svg/file_description.svg';

function UploadCertificate({ closePopup, partnerData }) {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [selectedDomainType, setSelectedDomainType] = useState("");
const [partnerDomainType, setPartnerDomainType] = useState("");
const [partnerType, setPartnerType] = useState("");
const [uploading, setUploading] = useState(false);
const [fileName, setFileName] = useState('');
const [uploadSuccess, setUploadSuccess] = useState(false);
Expand All @@ -24,29 +23,10 @@ function UploadCertificate({ closePopup, partnerData }) {
const [certificateData, setCertificateData] = useState("");
const [formattedDate, setFormattedDate] = useState("");
const [dataLoaded, setDataLoaded] = useState(true);
const [partnerDomainTypeData, setPartnerDomainTypeData] = useState([]);
const [removeLastUploadDate, setRemoveLastUploadData] = useState(false);
const { t } = useTranslation();
const isLoginLanguageRTL = isLangRTL(getUserProfile().langCode);

useEffect(() => {
const fetchData = async () => {
const partnerDomainTypeList = ["DEVICE", "FTM", "AUTH"];
let dataArr = [];
partnerDomainTypeList.forEach(item => {
dataArr.push({
fieldCode: item,
fieldValue: item
})
})
setPartnerDomainTypeData(dataArr);
}
fetchData();
}, [])

const openDropdown = () => {
setIsDropdownOpen(!isDropdownOpen);
};
const clickOnCancel = () => {
closePopup(true, "cancel");
};
Expand All @@ -62,7 +42,7 @@ function UploadCertificate({ closePopup, partnerData }) {
request: {
partnerId: partnerData.partnerId,
certificateData: certificateData,
partnerDomain: selectedDomainType,
partnerDomain: partnerDomainType,
},
}
try {
Expand Down Expand Up @@ -102,20 +82,20 @@ function UploadCertificate({ closePopup, partnerData }) {
}
}

const selectDomainType = (fieldName, selectedValue) => {
setSelectedDomainType(selectedValue);
openDropdown();
};

useEffect(() => {
if (partnerData.partnerType === "Device_Provider") {
setSelectedDomainType("DEVICE");
} else if (partnerData.partnerType === "FTM_Provider") {
setSelectedDomainType("FTM");
} else {
setSelectedDomainType("AUTH");
const getPartnerDomainType = (partner) => {
if (partner.partnerType) {
const partnerType = partner.partnerType.toUpperCase();
if (partnerType === "Device_Provider".toUpperCase()) {
return 'DEVICE';
}
else if (partnerType === "FTM_Provider".toUpperCase()) {
return 'FTM';
}
else {
return 'AUTH';
}
}
}, [partnerData.partnerType]);
}

const cancelUpload = () => {
setFileName("");
Expand Down Expand Up @@ -158,23 +138,18 @@ function UploadCertificate({ closePopup, partnerData }) {
};

useEffect(() => {
setPartnerType(getPartnerType(partnerData));
setPartnerDomainType(getPartnerDomainType(partnerData));
if (partnerData.isCertificateAvailable && partnerData.certificateUploadDate) {
const dateString = partnerData.certificateUploadDate.toString();
const formatted = formatDate(dateString, 'dateTime');
setFormattedDate(formatted);
}
}, [partnerData.isCertificateAvailable, partnerData.certificateUploadDate]);

const styles = {
outerDiv: "!ml-0 !mb-0",
dropdownLabel: "!text-base !mb-1",
dropdownButton: "!w-full !h-12 !px-3 !rounded-md !text-lg !text-start !text-gunmetal-gray",
selectionBox: "!top-12"
}
}, [partnerData.isCertificateAvailable, partnerData.certificateUploadDate, partnerData, getPartnerType]);

return (
<div className="fixed inset-0 flex items-center justify-center bg-black bg-opacity-[30%] z-50">
<div className={`bg-white md:w-[400px] w-[60%] mx-auto ${partnerData.isCertificateAvailable ? 'h-[520px]' : 'h-[500px]'} rounded-lg shadow-lg`}>
<div className={`bg-white md:w-[27rem] w-[60%] mx-auto ${partnerData.isCertificateAvailable ? 'h-[32rem]' : 'h-[31rem]'} rounded-lg shadow-lg`}>
{!dataLoaded && (
<LoadingIcon></LoadingIcon>
)}
Expand All @@ -191,22 +166,17 @@ function UploadCertificate({ closePopup, partnerData }) {
<div className="mb-3">
<label className="block text-dark-blue text-base font-semibold mb-1">{t('uploadCertificate.partnerTypeLabel')}</label>
<input type="text" className="w-full h-12 px-3 py-2 border border-[#C1C1C1] rounded-md text-lg text-gunmetal-gray bg-[#EBEBEB] leading-tight focus:outline-none focus:shadow-outline"
value={getPartnerType(partnerData)} disabled />
value={partnerType} disabled />
</div>
<div className="mb-3">
<DropdownComponent
fieldName='partnerDomainType'
dropdownDataList={partnerDomainTypeData}
onDropDownChangeEvent={selectDomainType}
fieldNameKey='uploadCertificate.partnerDomainType*'
selectedDropdownValue={selectedDomainType}
styleSet={styles}>
</DropdownComponent>
<label className="block text-dark-blue text-base font-semibold mb-1">{t('uploadCertificate.partnerDomainType')}</label>
<input type="text" className="w-full h-12 px-3 py-2 border border-[#C1C1C1] rounded-md text-lg text-gunmetal-gray bg-[#EBEBEB] leading-tight focus:outline-none focus:shadow-outline"
value={partnerDomainType} disabled />
</div>
</form>
<div className="flex items-center justify-center mt-[4%] w-full h-36 p-4 border-2 border-[#9CB2E0] rounded-xl bg-[#F8FBFF] bg-opacity-100 text-center cursor-pointer relative">
{uploading && (
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer ${!isDropdownOpen ? 'z-10' : 'z-0'}`}>
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer`}>
<svg aria-hidden="true" className="w-9 h-9 text-gray-200 animate-spin fill-blue-800" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor" />
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill" />
Expand All @@ -220,7 +190,7 @@ function UploadCertificate({ closePopup, partnerData }) {
</div>
)}
{!uploading && fileName === '' && (
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer ${!isDropdownOpen ? 'z-10' : 'z-0'}`}>
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer`}>
<label htmlFor="fileInput" className="flex flex-col items-center justify-center cursor-pointer">
<img src={fileUploadImg} alt="" className="mb-2 w-10 h-10" />
<h5 className="text-charcoal-gray text-base font-medium">
Expand All @@ -234,7 +204,7 @@ function UploadCertificate({ closePopup, partnerData }) {
</div>
)}
{!uploading && fileName && (
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer ${!isDropdownOpen ? 'z-10' : 'z-0'}`}>
<div className={`flex flex-col items-center justify-center mb-2 cursor-pointer`}>
<label htmlFor="fileInput" className="flex flex-col items-center justify-center cursor-pointer">
<img src={fileDescription} alt="" className="w-10 h-10 mb-2" />
</label>
Expand All @@ -261,14 +231,14 @@ function UploadCertificate({ closePopup, partnerData }) {
)}
{uploadSuccess && successMsg && (
<div className="absolute inset-0 flex justify-center">
<div className="bg-fruit-salad md:w-[400px] w-full h-[50px] flex items-center justify-between p-4">
<div className="bg-fruit-salad w-full h-[50px] flex items-center justify-between p-4">
<SuccessMessage successMsg={successMsg} clickOnCancel={cancelSuccessMsg}></SuccessMessage>
</div>
</div>
)}
{uploadFailure && errorMsg && (
<div className="absolute inset-0 flex justify-center">
<div className="bg-moderate-red md:w-[400px] w-full h-[50px] flex items-center justify-between p-4 overflow-y-auto">
<div className="absolute inset-0 flex justify-center w-full">
<div className="bg-moderate-red w-full h-[50px] flex items-center justify-between p-4 overflow-y-auto">
<ErrorMessage errorCode={errorCode} errorMessage={errorMsg} clickOnCancel={cancelErrorMsg}></ErrorMessage>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pmp-reactjs-ui/src/pages/policies/RequestPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ function RequestPolicy() {
{dataLoaded && (
<>
{errorMsg && (
<div className={`flex justify-end max-w-7xl mb-5 absolute ${isLoginLanguageRTL? "left-0" : "right-0"}`}>
<div className="flex justify-between items-center max-w-[400px] min-h-14 min-w-72 bg-[#C61818] rounded-xl p-3">
<div className={`flex justify-end max-w-7xl absolute ${isLoginLanguageRTL? "left-0" : "right-0"}`}>
<div className="flex justify-between items-center max-w-[35rem] min-h-14 min-w-72 bg-[#C61818] rounded-xl p-3">
<ErrorMessage errorCode={errorCode} errorMessage={errorMsg} clickOnCancel={cancelErrorMsg}></ErrorMessage>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function RequestPolicyConfirmation() {
<p className="text-[#666666] text-sm font-semibold">
{t('requestPolicy.policySuccessMsg')}
</p>
<div className="flex space-x-3 mt-12 border justify-center">
<div className="flex space-x-3 mt-12 justify-center">
<button onClick={() => moveToPolicies(navigate)} type="button" className="text-white font-semibold bg-tory-blue rounded-md text-base px-12 py-4">
{t('commons.goBack')}
</button>
Expand Down

0 comments on commit b8f96c4

Please sign in to comment.