Skip to content

Commit

Permalink
TASK :#0000 [Direct Connect] If list is empty then sow the empty as m…
Browse files Browse the repository at this point in the history
…essage, [Profile Page] Edit User profile popup => Only allow 500 char to add bio, But After login 1st time fill up this infor they are allowing more than 500 char
  • Loading branch information
mahajanmahesh935 committed Sep 16, 2024
1 parent 28a6de8 commit b7f1215
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 6 deletions.
30 changes: 26 additions & 4 deletions packages/nulp_elite/src/pages/SelectPreference.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const SelectPreference = ({ isOpen, onClose }) => {
const [toasterMessage, setToasterMessage] = useState("");
const [orgId, setOrgId] = useState();
const [framworkname, setframworkname] = useState(false);
const [toastMessage, setToastMessage] = useState("");
const [showToast, setShowToast] = useState(false);

const showErrorMessage = (msg) => {
setToasterMessage(msg);
Expand Down Expand Up @@ -298,11 +300,22 @@ const SelectPreference = ({ isOpen, onClose }) => {
},
body: JSON.stringify(requestBody),
});

if (!response.ok) {
showErrorMessage(t("FAILED_TO_FETCH_DATA"));
if (response.ok) {
setToastMessage(t("Preferences updated successfully!"));
setShowToast(true);
onClose();
} else {
showErrorMessage(t("FAILED_TO_FETCH_DATA"));
throw new Error(t("FAILED_TO_FETCH_DATA"));
}
// if (!response.ok) {
// showErrorMessage(t("FAILED_TO_FETCH_DATA"));
// throw new Error(t("FAILED_TO_FETCH_DATA"));
// }
// if(response.ok){
// setToastMessage("Preferance Updated Successfully");
// setShowToast(true);
// }

const responseData = await response.json();
} catch (error) {
Expand All @@ -317,6 +330,10 @@ const SelectPreference = ({ isOpen, onClose }) => {
onClose();
};

const closeToast = () => {
setShowToast(false);
};

const handleClose = () => {
onClose();
};
Expand Down Expand Up @@ -355,7 +372,8 @@ const SelectPreference = ({ isOpen, onClose }) => {
]);

return (
<Dialog
<>
<Dialog
open={isOpen}
// onClose={handleClose}
maxWidth="sm"
Expand Down Expand Up @@ -468,6 +486,10 @@ const SelectPreference = ({ isOpen, onClose }) => {
</Button>
</DialogActions>
</Dialog>
{showToast && (
<ToasterCommon response={toastMessage} onClose={closeToast} />
)}
</>
);
};

Expand Down
8 changes: 7 additions & 1 deletion packages/nulp_elite/src/pages/connections/AddConnections.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const AddConnections = () => {
useState();
const [loggedInUserId, setLoggedInUserId] = useState();
const location = useLocation();
const [invitationReceiverByUser, setInvitationReceivedUserByIds] = useState();
const [invitationReceiverByUser, setInvitationReceivedUserByIds] = useState([]);
const [userChat, setUserChat] = useState();
const [isModalOpen, setIsModalOpen] = useState(false);
const [showModal, setShowModal] = useState(false);
Expand Down Expand Up @@ -1587,6 +1587,12 @@ const AddConnections = () => {
</TabPanel>
<TabPanel value="2">
<Box className="scroll">
{invitationReceiverByUser.length ===0 && (
<Box marginTop="26px" marginLeft="163px">
{t("NO Chat Request")}
</Box>

)}
{invitationReceiverByUser &&
invitationReceiverByUser.map((item) => (
<List
Expand Down
1 change: 1 addition & 0 deletions packages/nulp_elite/src/pages/connections/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ const Chat = ({
placeholder="Enter your message here..."
fullWidth
sx={{ fontSize: "13px" }}
inputProps={{ maxLength: charLimit }}
/>
<Box mt={1} textAlign="right" sx={{ fontSize: "12px", color: "#484848" ,marginTop: "0px",backgroundColor:"#ffffff", padding: "25px"}}>
{`${textValue.length}/${charLimit}`}
Expand Down
8 changes: 8 additions & 0 deletions packages/nulp_elite/src/pages/content/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,14 @@ const attemptid = ()=>{
<Typography>{t("ABOUTTHECONTENT")}</Typography>
</AccordionSummary>
<AccordionDetails>
{lesson?.attributions && (
<>
<Box sx={{ fontWeight: 'bold' }}>{t("ATTRIBUTIONS")}</Box>
<Box>
{lesson?.attributions.join(', ')}
</Box>
</>
)}
<Box sx={{ fontWeight: 'bold' }}>{t("LICENSEDETAILS")} : </Box>
{lesson?.licenseDetails && (
<Typography className="mb-10">
Expand Down
13 changes: 12 additions & 1 deletion packages/nulp_elite/src/pages/profileData.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const PopupForm = ({ open, handleClose }) => {

const [initialFirstName, setInitialFirstName] = useState("");
const [initialLastName, setInitialLastName] = useState("");
const maxChars = 500;

useEffect(() => {
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.USER.GET_PROFILE}${_userId}`;
Expand Down Expand Up @@ -125,6 +126,12 @@ const PopupForm = ({ open, handleClose }) => {
handleClose();
};

const handleBioChange = (e) => {
if (e.target.value.length <= maxChars) {
setBio(e.target.value);
}
};

return (
<Modal
open={open}
Expand Down Expand Up @@ -174,8 +181,12 @@ const PopupForm = ({ open, handleClose }) => {
type="text"
fullWidth
value={bio}
onChange={(e) => setBio(e.target.value)}
onChange={handleBioChange}
inputProps={{ maxLength: maxChars }}
/>
<Typography variant="body2" color="textSecondary">
{bio.length}/{maxChars}
</Typography>
<FormControl fullWidth margin="dense">
<Select
options={designations}
Expand Down

0 comments on commit b7f1215

Please sign in to comment.