Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Restyle fix: endpoints and schema bugs #75

Merged
merged 2 commits into from
Jul 23, 2021
Merged
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
4 changes: 1 addition & 3 deletions src/pages/private/admin/questions/listQuestion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ const ListQuestions = ({
onKeyDown={handleKeyPress}
/>
{inputValidationAlert.apply && (
<Alert severity="error">
{inputValidationAlert.message}
</Alert>
<Alert severity="error">{inputValidationAlert.message}</Alert>
)}
</div>
<div className="float-left">
Expand Down
23 changes: 5 additions & 18 deletions src/pages/private/user/messages/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ class PeopleCards extends Component {
filterPeople = (e) => {
const people = this.state.persons.filter(
(person) =>
person.name
.toLowerCase()
.search(e.target.value.trim().toLowerCase()) !== -1,
person.name.toLowerCase().search(e.target.value.trim().toLowerCase()) !== -1,
);
this.setState({ people, NoSearchResults: !people.length });
};
Expand All @@ -74,10 +72,7 @@ class PeopleCards extends Component {
return this.setState({
people: persons.filter((e) => {
if (sectionSelect !== 'ALL') {
return (
e.department === input.value &&
e.section === sectionSelect
);
return e.department === input.value && e.section === sectionSelect;
}
return e.department === input.value;
}),
Expand All @@ -101,10 +96,7 @@ class PeopleCards extends Component {
return this.setState({
people: persons.filter((e) => {
if (departmentSelect !== 'ALL') {
return (
e.section === input.value &&
e.department === departmentSelect
);
return e.section === input.value && e.department === departmentSelect;
}
return e.section === input.value;
}),
Expand All @@ -113,13 +105,8 @@ class PeopleCards extends Component {
};

render() {
const {
ProgressBar,
departments,
sections,
people,
NoSearchResults,
} = this.state;
const { ProgressBar, departments, sections, people, NoSearchResults } =
this.state;

return (
<>
Expand Down
28 changes: 20 additions & 8 deletions src/pages/private/user/messages/modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ import { apiUrl, endPoints } from '../../../../config.json';
import http from '../../../../services/httpService';
import { NotifyAlert, TimerAlert } from '../../../../components';

const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue }) => {
const ModalBox = ({
personId,
personName,
toggleOpen,
triggerModal,
modalValue,
}) => {
const [ModalValue, setModalValue] = useState(() => modalValue);
const [isAnonymous, setIsAnonymous] = useState(false);

useEffect(() => {
setModalValue(modalValue)
}, [modalValue])
setModalValue(modalValue);
}, [modalValue]);

const handleSubmit = () => {
const messageObject = {
Expand Down Expand Up @@ -54,9 +60,7 @@ const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue

<MDBModalBody>
<div className="form-group">
<p className="text-center">
Write a nice message for {personName} :)
</p>
<p className="text-center">Write a nice message for {personName} :)</p>
<textarea
className="form-control"
id={personId}
Expand All @@ -69,8 +73,16 @@ const ModalBox = ({ personId, personName, toggleOpen, triggerModal, modalValue
</MDBModalBody>
<MDBModalFooter>
<span className="custom-control custom-checkbox">
<input type="checkbox" className="custom-control-input" id="defaultUnchecked" value={isAnonymous} onChange={() => setIsAnonymous(!isAnonymous)} />
<label className="custom-control-label" for="defaultUnchecked">Send Anonymously</label>
<input
type="checkbox"
className="custom-control-input"
id="defaultUnchecked"
value={isAnonymous}
onChange={() => setIsAnonymous(!isAnonymous)}
/>
<label className="custom-control-label" for="defaultUnchecked">
Send Anonymously
</label>
</span>
<div>
<button
Expand Down
2 changes: 1 addition & 1 deletion src/pages/private/user/messages/single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const UserCard = ({ person, personName, personBio, personImageUrl }) => {
};

const triggerModal = () => {
getUserMessage()
getUserMessage();
setModalOpen(!modalOpen);
};

Expand Down
44 changes: 37 additions & 7 deletions src/pages/private/user/profile/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const UserInfo = () => {
icon="user"
isDisabled
/>

<Input
name="department"
label="Department"
Expand Down Expand Up @@ -202,7 +202,12 @@ const UserInfo = () => {
name="Email"
label="Email"
value={socialHandles.email}
handleChange={(e) => setSocialHandles({...socialHandles, email: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
email: e.target.value,
})
}
error={ValidationErrors.email}
feedback={ValidationErrors.email}
icon="envelope-open"
Expand All @@ -212,7 +217,12 @@ const UserInfo = () => {
name="contactNo"
label="Contact Number"
value={socialHandles.phone}
handleChange={(e) => setSocialHandles({...socialHandles, phone: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
phone: e.target.value,
})
}
error={ValidationErrors.phone}
feedback={ValidationErrors.phone}
icon="phone-alt"
Expand All @@ -222,7 +232,12 @@ const UserInfo = () => {
name="facebook"
label="Facebook"
value={socialHandles.facebook}
handleChange={(e) => setSocialHandles({...socialHandles, facebook: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
facebook: e.target.value,
})
}
error={ValidationErrors.facebook}
feedback={ValidationErrors.facebook}
icon="facebook"
Expand All @@ -232,7 +247,12 @@ const UserInfo = () => {
name="linkedin"
label="LinkedIn"
value={socialHandles.linkedin}
handleChange={(e) => setSocialHandles({...socialHandles, linkedin: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
linkedin: e.target.value,
})
}
error={ValidationErrors.linkedin}
feedback={ValidationErrors.linkedin}
icon="linkedin"
Expand All @@ -241,15 +261,25 @@ const UserInfo = () => {
<Input
name="instagram"
label="Instagram"
handleChange={(e) => setSocialHandles({...socialHandles, instagram: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
instagram: e.target.value,
})
}
handleChange={handleSocialHandles}
icon="instagram"
IconBrand
/>
<Input
name="snapchat"
label="Snapchat"
handleChange={(e) => setSocialHandles({...socialHandles, snapchat: e.target.value})}
handleChange={(e) =>
setSocialHandles({
...socialHandles,
snapchat: e.target.value,
})
}
handleChange={handleSocialHandles}
icon="snapchat-ghost"
IconBrand
Expand Down
5 changes: 1 addition & 4 deletions src/pages/private/user/profile/messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ const Message = ({ person, message, index }) => {
<>
<div className={getClass()}>
<div className="card-body text-dark">
<h5
className="card-title h5-responsive mb-2"
style={{ fontWeight: 500 }}
>
<h5 className="card-title h5-responsive mb-2" style={{ fontWeight: 500 }}>
{person}
</h5>
<p className="p-responsive" style={{ fontFamily: 'Product Sans' }}>
Expand Down
16 changes: 3 additions & 13 deletions src/pages/private/user/profile/profileCard/socialCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ const PersonalCard = () => {
snapchat: '',
});

const {
email,
phone,
instagram,
linkedin,
facebook,
snapchat,
} = socialHandles;
const { email, phone, instagram, linkedin, facebook, snapchat } = socialHandles;

useEffect(() => {
const fetchUserData = async () => {
Expand All @@ -44,7 +37,7 @@ const PersonalCard = () => {
linkedin: data.socialHandles.linkedin,
snapchat: data.socialHandles.snapchat,
});
console.log('socialss', data)
console.log('socialss', data);
} catch (ex) {
if (ex.response && ex.response.status === 400) {
TimerAlert('Error', ex.response.data, 'error');
Expand Down Expand Up @@ -90,10 +83,7 @@ const PersonalCard = () => {
<Tooltip title="You can add more details from update details section">
<div className="row">
{email && (
<SocialHandle
platform={email}
iconClass="fas fa-lg fa-envelope"
/>
<SocialHandle platform={email} iconClass="fas fa-lg fa-envelope" />
)}
{phone && (
<SocialHandle
Expand Down
3 changes: 1 addition & 2 deletions src/utils/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import Joi from 'joi-browser';

const LoginSchema = () => {
return {
userId: Joi
.number()
userId: Joi.number()
.error(() => {
return {
message: 'Please enter a valid enrollment number',
Expand Down