From 611f1346fc76050cdfc299d54ee264743214efc7 Mon Sep 17 00:00:00 2001 From: Ahmad Yazid <ahmad.yazid51@ui.ac.id> Date: Fri, 6 Dec 2019 01:49:42 +0700 Subject: [PATCH] [GREEN] Implemented new feature all test passed --- .../__test__/components/CompanyInfo-test.jsx | 4 +- assets/js/components/CompanyInfo.jsx | 61 +++++++++++++++++++ assets/js/components/TopMenu.jsx | 17 ++++-- 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/assets/js/__test__/components/CompanyInfo-test.jsx b/assets/js/__test__/components/CompanyInfo-test.jsx index 27dfdfbc..b720009a 100644 --- a/assets/js/__test__/components/CompanyInfo-test.jsx +++ b/assets/js/__test__/components/CompanyInfo-test.jsx @@ -11,7 +11,7 @@ describe('CompanyInfo', () => { it('open without problem', () => { const modalCompany = ReactTestUtils.renderIntoDocument(<CompanyInfo buttonTitle="submit" />); - const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalPendaftaran, 'Button'); + const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalCompany, 'Button'); modalCompany.handleApply(); ReactTestUtils.Simulate.click(modal); expect(modalCompany).to.exist; @@ -19,7 +19,7 @@ describe('CompanyInfo', () => { it('open with problem', () => { const modalCompany = ReactTestUtils.renderIntoDocument(<CompanyInfo buttonTitle="submit" />); - const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalInfo, 'Button'); + const modal = ReactTestUtils.findRenderedDOMComponentWithTag(modalCompany, 'Button'); ReactTestUtils.Simulate.click(modal); expect(modalCompany).to.exist; }); diff --git a/assets/js/components/CompanyInfo.jsx b/assets/js/components/CompanyInfo.jsx index e69de29b..f549a6a6 100644 --- a/assets/js/components/CompanyInfo.jsx +++ b/assets/js/components/CompanyInfo.jsx @@ -0,0 +1,61 @@ +import React from 'react'; +import { Modal, Button } from 'semantic-ui-react'; +import ModalAlert from './ModalAlert'; +import GeneralModal from './GeneralModal'; + +export default class CompanyInfo extends GeneralModal { + render() { + return ( + <Modal + trigger={( + <Button primary onClick={this.handleOpen} floated="center"> + Cara Tambah Lowongan + </Button> + )} + closeIcon="close" + open={this.state.modalOpen} + onClose={this.handleClose} + > + <Modal.Header>Cara Tambah Lowongan</Modal.Header> + <Modal.Content> + <ModalAlert + ref={(modal) => { + this.modalAlert = modal; + }} + /> + <Modal.Description> + <Modal.Header> + {' '} + <h1>Berikut Cara Menambahkan Lowongan Pada Situs Kape:</h1> + </Modal.Header> + </Modal.Description> + <h2> + {' '} + 1.Click tombol warna hijau yang bertuliskan tambah lowongan baru. + </h2> + <h2> + {' '} + 2.Isi semua informasi secara rinci supaya lowongan lebih deskriptif. + </h2> + <h2> + {' '} + 3.Klik tombol submit. + </h2> + <h2> + {' '} + 4. Lowongan berhasil ditambahkan. + </h2> + <h2> + {' '} + 5. Untuk melihat semua pendaftar tekan lah tombol warna biru yang bertuliskan lihat semua pendaftar + </h2> + <h2> + {' '} + 6. Jangan lupa untuk melihat secara berkala sehingga tidak tertingal calon perkerja pada perusahaan anda. + </h2> + </Modal.Content> + <Modal.Actions /> + </Modal> + ); + } +} diff --git a/assets/js/components/TopMenu.jsx b/assets/js/components/TopMenu.jsx index 42c31986..3a36eb0d 100755 --- a/assets/js/components/TopMenu.jsx +++ b/assets/js/components/TopMenu.jsx @@ -6,7 +6,7 @@ import Server from '../lib/Server'; import Storage from '../lib/Storage'; import moment from 'moment'; import ModalAlert from './ModalAlert'; - +import CompanyInfo from './CompanyInfo'; var quotes = require('starwars'); const defaultPicture = 'https://semantic-ui.com/images/avatar/small/elliot.jpg'; @@ -56,9 +56,8 @@ export default class TopMenu extends React.Component { "4. Pastikan persyaratan sudah terpenuhi\n" + "5. Jelaskan mengapa anda ingin mengikuti lowongan internship tersebut di 'Cover Letter'\n"+ "6. Klik tombol 'Daftar'\n", - kapeDescription: "Kanal Akses Pendaftaran KP Elektronik" - - + kapeDescription: "Kanal Akses Pendaftaran KP Elektronik", + welcomeStudent: "Selamat Datang, " }; this.logout = this.logout.bind(this); this.logoutCompany = this.logoutCompany.bind(this); @@ -171,10 +170,20 @@ export default class TopMenu extends React.Component { {this.state.kapeDescription} </Menu.Item> </Menu.Menu> + <Menu.Menu position="center"> + {this.props.user.role === 'student' && ( + <Menu.Item style={{ padding: '25px' }}> + {this.state.welcomeStudent} {data.name} + </Menu.Item> + )} + </Menu.Menu> <Menu.Menu position="right"> {this.props.user.role === 'student' && ( <Menu.Item>{btn}</Menu.Item> + )} + {this.props.user.role === 'company' && ( + <CompanyInfo>Company Info</CompanyInfo> )} <Menu.Item style={{ margin: '3px' }}> {this.state.currentDate} -- GitLab