From c33e08ec6929a9e1507948904afb5db64dc80493 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Sat, 30 Nov 2019 11:34:38 +0700 Subject: [PATCH 1/3] refactor tampilan --- assets/js/ProfilePage.jsx | 283 +++++++++++++++++++++++++------------- 1 file changed, 186 insertions(+), 97 deletions(-) diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index c976e353..c92d010f 100755 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -69,7 +69,7 @@ export default class ProfilePage extends React.Component { github_url: '', gitlab_url: '', awards: '', - sertifikat:'', + sertifikat: '', projects: '', certification: '', languages: '', @@ -91,7 +91,7 @@ export default class ProfilePage extends React.Component { github_url: '', gitlab_url: '', awards: '', - sertifikat:'', + sertifikat: '', projects: '', certification: '', languages: '', @@ -173,22 +173,21 @@ export default class ProfilePage extends React.Component { window.scrollTo(0, 0); } }, - (error) => - error.then(() => { - this.state.name = 'Gagal mendapatkan informasi'; - }), + (error) => error.then(() => { + this.state.name = 'Gagal mendapatkan informasi'; + }), ); } isFromGithubLinkValid = () => { - var github_link = this.state.form.github_url; + const github_link = this.state.form.github_url; if (github_link == null) return; return github_link.includes('https://github.com/'); }; gitlabURL_is_valid = () => { if (this.state.form.gitlab_url != null) { - return this.state.form.gitlab_url.includes("https://gitlab.com/"); + return this.state.form.gitlab_url.includes('https://gitlab.com/'); } } @@ -203,15 +202,16 @@ export default class ProfilePage extends React.Component { '07': 'Juli', '08': 'Agustus', '09': 'September', - '10': 'Oktober', - '11': 'November', - '12': 'Desember', + 10: 'Oktober', + 11: 'November', + 12: 'Desember', }; - let timeSt = dateTime.split('T'); - let dayMonthYear = timeSt[0].split('-'); - let newTime = `${dayMonthYear[2]} ${monthNameIndex[dayMonthYear[1]]} ${dayMonthYear[0]} | ${timeSt[1].substr(0, 5)}`; - console.log(newTime); + const timeSt = dateTime.split('T'); + const date = new Date(dateTime); + + const newTime = `${date.getDate()} ${monthNameIndex[date.getMonth() + 1]} ${date.getFullYear()} | ${ + date.getHours() + timeSt[1].substr(2, 3)}`; return newTime; }; @@ -226,9 +226,9 @@ export default class ProfilePage extends React.Component { '07': 'Juli', '08': 'Agustus', '09': 'September', - '10': 'Oktober', - '11': 'November', - '12': 'Desember', + 10: 'Oktober', + 11: 'November', + 12: 'Desember', }; const dateIndexArray = dateIndex.split('-'); @@ -246,7 +246,7 @@ export default class ProfilePage extends React.Component { ); } else if (!this.gitlabURL_is_valid()) { this.modalAlert.open( - "Link gitlab tidak sesuai. Contoh : https://gitlab.com/<your-username>", + 'Link gitlab tidak sesuai. Contoh : https://gitlab.com/<your-username>', ); return; } @@ -271,41 +271,40 @@ export default class ProfilePage extends React.Component { this.getProfile, ); }, - (error) => - error.then((r) => { - this.setState({ loading: false }); - this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r)); - }), + (error) => error.then((r) => { + this.setState({ loading: false }); + this.modalAlert.open('Pembaharuan profil gagal', Dumper.dump(r)); + }), ); } }; handleFile = (e) => { - const form = this.state.form; + const { form } = this.state; form[e.target.name] = e.target.files[0]; this.setState({ form }); }; handleChange = (e) => { - const form = this.state.form; + const { form } = this.state; form[e.target.name] = e.target.value; this.setState({ form }); }; handleCheckbox = (e, d) => { - const form = this.state.form; + const { form } = this.state; form[d.name] = d.checked; this.setState({ form, show_transcript: d.checked }); }; handleRadioGender = (e, { value }) => { - const form = this.state.form; + const { form } = this.state; form.gender = value; this.setState({ form }); }; handleRadio = (e, { value }) => { - const form = this.state.form; + const { form } = this.state; form.job_seeking_status = value; this.setState({ form }); }; @@ -400,7 +399,7 @@ export default class ProfilePage extends React.Component { </Form.Field> <Form.Field> <label htmlFor="self_description">Deskripsi Diri</label> - <input onChange={this.handleChange} maxlength="500" placeholder="Saya suka belajar" name="self_description" /> + <input onChange={this.handleChange} maxLength="500" placeholder="Saya suka belajar" name="self_description" /> </Form.Field> <Form.Field> <label htmlFor="linkedin_url">URL Profile LinkedIn</label> @@ -440,8 +439,8 @@ export default class ProfilePage extends React.Component { <label htmlFor="portfolio_link">Portfolio Link</label> <input onChange={this.handleChange} - placeholder={this.state.portfolio_link === null ? 'https://www.example.com/myproject/' : - this.state.portfolio_link} + placeholder={this.state.portfolio_link === null ? 'https://www.example.com/myproject/' + : this.state.portfolio_link} defaultValue={this.state.portfolio_link === null ? null : this.state.portfolio_link} placeholder={ this.state.portfolio_link === null @@ -539,7 +538,7 @@ export default class ProfilePage extends React.Component { <Form.Field> <label htmlFor="latest_work_desc"> Latest Working Experience Description - </label> + </label> <input onChange={this.handleChange} placeholder={ @@ -728,7 +727,7 @@ export default class ProfilePage extends React.Component { floated="right" > Submit - </Button> + </Button> </Form> </Form.Field> </Segment> @@ -741,13 +740,12 @@ export default class ProfilePage extends React.Component { render() { const sertifikat_exists = this.state.sertifikat; let sertifikat_state; - if(sertifikat_exists){ + if (sertifikat_exists) { sertifikat_state = <p>Sertifikat sudah ada</p>; - } else{ + } else { sertifikat_state = <p>Sertifikat belum ada</p>; } - const defaultPicture = - 'https://semantic-ui.com/images/wireframe/square-image.png'; + const defaultPicture = 'https://semantic-ui.com/images/wireframe/square-image.png'; return ( <div className="profilePage"> <Segment className="biodata-section"> @@ -763,7 +761,11 @@ export default class ProfilePage extends React.Component { <Container textAlign="left" className="profile-biodata"> <div className="biodata"> <Segment basic textAlign="center"> - <h1> {this.state.name} </h1> + <h1> + {' '} + {this.state.name} + {' '} + </h1> </Segment> <Segment basic vertical> @@ -774,8 +776,11 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.major || 'N/A'},{' '} - {this.state.batch || 'N/A'}{' '} + {this.state.major || 'N/A'} +, + {' '} + {this.state.batch || 'N/A'} + {' '} </p> </Grid.Column> </Grid> @@ -787,7 +792,11 @@ export default class ProfilePage extends React.Component { <Icon name="mail" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.email || 'N/A'} </p> + <p> + {' '} + {this.state.email || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -798,7 +807,10 @@ export default class ProfilePage extends React.Component { <Icon name="phone" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.phone_number || 'Nomor Telepon belum ditambahkan'}</p> + <p> + {' '} + {this.state.phone_number || 'Nomor Telepon belum ditambahkan'} + </p> </Grid.Column> </Grid> </Segment> @@ -811,7 +823,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <a href={this.state.portfolio_link}> {' '} - {this.state.portfolio_link || 'Portofolio belum ditambahkan'}{' '} + {this.state.portfolio_link || 'Portofolio belum ditambahkan'} + {' '} </a> </Grid.Column> </Grid> @@ -823,7 +836,10 @@ export default class ProfilePage extends React.Component { <Icon name="venus mars" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.gender || 'Gender belum ditambahkan'}</p> + <p> + {' '} + {this.state.gender || 'Gender belum ditambahkan'} + </p> </Grid.Column> </Grid> </Segment> @@ -836,8 +852,11 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.cityOfBirth || 'N/A'},{' '} - {this.state.dateOfBirth || 'N/A'}{' '} + {this.state.cityOfBirth || 'N/A'} +, + {' '} + {this.state.dateOfBirth || 'N/A'} + {' '} </p> </Grid.Column> </Grid> @@ -849,7 +868,10 @@ export default class ProfilePage extends React.Component { <Icon name="user" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.self_description || 'N/A'}</p> + <p> + {' '} + {this.state.self_description || 'N/A'} + </p> </Grid.Column> </Grid> </Segment> @@ -862,7 +884,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <a href={this.state.linkedin_url}> {' '} - {this.state.linkedin_url || 'N/A'}{' '} + {this.state.linkedin_url || 'N/A'} + {' '} </a> </Grid.Column> </Grid> @@ -876,7 +899,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <a href={this.state.hackerrank_url}> {' '} - {this.state.hackerrank_url || 'N/A'}{' '} + {this.state.hackerrank_url || 'N/A'} + {' '} </a> </Grid.Column> </Grid> @@ -888,10 +912,11 @@ export default class ProfilePage extends React.Component { <Icon name="pencil alternate" size="big" /> </Grid.Column> <Grid.Column width={13}> - <a href={this.state.student_gpa}> + <p href={this.state.student_gpa}> {' '} - {this.state.student_gpa || 'null'}{' '} - </a> + {this.state.student_gpa || 'null'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -904,7 +929,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <a href={this.state.dependants}> {' '} - {this.state.dependants || 'null'}{' '} + {this.state.dependants || 'N/A'} + {' '} </a> </Grid.Column> </Grid> @@ -918,7 +944,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <a href={this.state.website_url}> {' '} - {this.state.website_url || 'N/A'}{' '} + {this.state.website_url || 'N/A'} + {' '} </a> </Grid.Column> </Grid> @@ -932,11 +959,12 @@ export default class ProfilePage extends React.Component { {this.state.github_url ? ( <a href={this.state.github_url}> {' '} - {this.state.github_url}{' '} + {this.state.github_url} + {' '} </a> ) : ( - <p> N/A </p> - )} + <p> N/A </p> + )} </Grid.Column> </Grid> </Segment> @@ -947,9 +975,15 @@ export default class ProfilePage extends React.Component { </Grid.Column> <Grid.Column width={13}> { - this.state.gitlab_url ? - <a href={ this.state.gitlab_url }> { this.state.gitlab_url } </a> : - <p> N/A </p> + this.state.gitlab_url + ? ( + <a href={this.state.gitlab_url}> + {' '} + { this.state.gitlab_url } + {' '} + </a> + ) + : <p> N/A </p> } </Grid.Column> </Grid> @@ -962,7 +996,11 @@ export default class ProfilePage extends React.Component { <Icon name="address book" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.alamat || 'N/A'} </p> + <p> + {' '} + {this.state.alamat || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -974,7 +1012,11 @@ export default class ProfilePage extends React.Component { <Icon name="map pin" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.region || 'N/A'} </p> + <p> + {' '} + {this.state.region || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -986,7 +1028,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.skills || 'Skills belum ditambahkan'}{' '} + {this.state.skills || 'Skills belum ditambahkan'} + {' '} </p> </Grid.Column> </Grid> @@ -998,14 +1041,24 @@ export default class ProfilePage extends React.Component { </Grid.Column> <Grid.Column width={13}> <p> - Latest working experience as:{' '} + Latest working experience as: + {' '} <span> - <b> {this.state.latest_work || 'N/A'} </b> + <b> + {' '} + {this.state.latest_work || 'N/A'} + {' '} + </b> </span> </p> <p> - Description:{' '} - <span> {this.state.latest_work_desc || 'N/A'} </span> + Description: + {' '} + <span> + {' '} + {this.state.latest_work_desc || 'N/A'} + {' '} + </span> </p> </Grid.Column> </Grid> @@ -1017,18 +1070,26 @@ export default class ProfilePage extends React.Component { <Icon name="money bill alternate" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.expected_salary || 'N/A'} </p> + <p> + {' '} + {this.state.expected_salary || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> - <Segment> + <Segment basic vertical> <Grid> <Grid.Column width={2}> <Icon name="hand peace outline" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.volunteer || 'N/A'} </p> + <p> + {' '} + {this.state.volunteer || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1041,7 +1102,8 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.awards || 'Awards belum ditambahkan'}{' '} + {this.state.awards || 'Awards belum ditambahkan'} + {' '} </p> </Grid.Column> </Grid> @@ -1055,7 +1117,7 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> {sertifikat_state} </Grid.Column> - </Grid>x + </Grid> </Segment> <Segment basic vertical> @@ -1066,8 +1128,9 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.projects || - 'Projects belum ditambahkan'}{' '} + {this.state.projects + || 'Projects belum ditambahkan'} + {' '} </p> </Grid.Column> </Grid> @@ -1079,7 +1142,11 @@ export default class ProfilePage extends React.Component { <Icon name="certificate" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.certification || 'N/A'} </p> + <p> + {' '} + {this.state.certification || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1090,7 +1157,11 @@ export default class ProfilePage extends React.Component { <Icon name="comment" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.languages || 'N/A'} </p> + <p> + {' '} + {this.state.languages || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1103,8 +1174,9 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.seminar || - 'Seminar dan Training kosong'}{' '} + {this.state.seminar + || 'Seminar dan Training kosong'} + {' '} </p> </Grid.Column> </Grid> @@ -1118,8 +1190,9 @@ export default class ProfilePage extends React.Component { <Grid.Column width={13}> <p> {' '} - {this.state.interests || - 'Interests belum ditambahkan'}{' '} + {this.state.interests + || 'Interests belum ditambahkan'} + {' '} </p> </Grid.Column> </Grid> @@ -1130,7 +1203,11 @@ export default class ProfilePage extends React.Component { <h3 className="lastSeen">Last Seen</h3> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.lastLoggedIn} </p> + <p> + {' '} + {this.state.lastLoggedIn} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1140,7 +1217,11 @@ export default class ProfilePage extends React.Component { <Icon name="time" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.age + ' years' || 'N/A'} </p> + <p> + {' '} + {`${this.state.age} years` || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1152,11 +1233,11 @@ export default class ProfilePage extends React.Component { <Icon name="map pin" size="big" /> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.region || 'N/A'} </p> - <h3>Intro</h3> - </Grid.Column> - <Grid.Column width={13}> - <p> {this.state.intro || 'N/A'} </p> + <p> + {' '} + {this.state.region || 'N/A'} + {' '} + </p> </Grid.Column> </Grid> </Segment> @@ -1167,17 +1248,24 @@ export default class ProfilePage extends React.Component { <h3>Intro</h3> </Grid.Column> <Grid.Column width={13}> - <p> {this.state.intro || 'N/A'} </p> + <p> + {' '} + {this.state.intro || 'N/A'} + {' '} + </p> </Grid.Column> <p className="jumlahLamaran"> {' '} - Jumlah lamaran diterima: {this.state.acceptedNo || '0'} + Jumlah lamaran diterima: + {' '} + {this.state.acceptedNo || '0'} </p> </Grid> <Grid> <p className="jumlahLamaran"> {' '} - Jumlah lamaran dibaca perusahaan:{' '} + Jumlah lamaran dibaca perusahaan: + {' '} {this.state.readNo || '0'} </p> </Grid> @@ -1204,7 +1292,8 @@ export default class ProfilePage extends React.Component { <div> <h4> {' '} - Bagikan Transkrip :{' '} + Bagikan Transkrip : + {' '} {this.state.bagikanTranskrip ? 'Ya' : 'Tidak'} </h4> </div> @@ -1231,14 +1320,14 @@ export default class ProfilePage extends React.Component { </p> </Message> ) : ( - <Message negative> - <Message.Header>Tidak mencari pekerjaan</Message.Header> - <p> + <Message negative> + <Message.Header>Tidak mencari pekerjaan</Message.Header> + <p> Saya sedang tidak mencari pekerjaan. Mohon jangan kirimkan informasi mengenai lowongan pekerjaan. </p> - </Message> - )} + </Message> + )} </h4> </div> </Segment> -- GitLab From 3f3023c65f6b83c0265a85e260c688ca567e82ed Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Sat, 30 Nov 2019 11:35:16 +0700 Subject: [PATCH 2/3] refactor fungsi last login --- assets/js/ProfilePage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index c92d010f..b1712175 100755 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -212,7 +212,7 @@ export default class ProfilePage extends React.Component { const newTime = `${date.getDate()} ${monthNameIndex[date.getMonth() + 1]} ${date.getFullYear()} | ${ date.getHours() + timeSt[1].substr(2, 3)}`; - return newTime; + return newTime }; parseIndonesianDateFormat(dateIndex) { -- GitLab From 8dcfe3d5af82b9979677e01246eeecbac991a1c1 Mon Sep 17 00:00:00 2001 From: Luthfi Dzaky Saifuddin <dzakyluthfi28@gmail.com> Date: Sat, 30 Nov 2019 11:35:32 +0700 Subject: [PATCH 3/3] semicolon --- assets/js/ProfilePage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx index b1712175..c92d010f 100755 --- a/assets/js/ProfilePage.jsx +++ b/assets/js/ProfilePage.jsx @@ -212,7 +212,7 @@ export default class ProfilePage extends React.Component { const newTime = `${date.getDate()} ${monthNameIndex[date.getMonth() + 1]} ${date.getFullYear()} | ${ date.getHours() + timeSt[1].substr(2, 3)}`; - return newTime + return newTime; }; parseIndonesianDateFormat(dateIndex) { -- GitLab