Fakultas Ilmu Komputer UI

Commit e1054624 authored by PRIAMBUDI LINTANG BAGASKARA's avatar PRIAMBUDI LINTANG BAGASKARA 🎱
Browse files

Merge branch '1606895171-177' into 'master'

1606895171 177

See merge request !211
parents 8e51e362 057a0e9f
Pipeline #26534 passed with stages
in 11 minutes and 20 seconds
......@@ -13,6 +13,7 @@ import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
import Dumper from './lib/Dumper';
import { isFromGithubLinkValid, gotoLink } from './Utils';
export default class EditProfile extends React.Component {
static propTypes = {
......@@ -97,9 +98,6 @@ export default class EditProfile extends React.Component {
this.handleCheckbox = this.handleCheckbox.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleFile = this.handleFile.bind(this);
this.gotoLink = this.gotoLink.bind(this);
this.gotoStudentResume = this.gotoStudentResume.bind(this);
this.gotoStudentTranscript = this.gotoStudentTranscript.bind(this);
this.getProfile();
}
......@@ -164,12 +162,6 @@ export default class EditProfile extends React.Component {
);
}
isFromGithubLinkValid = () => {
const github_link = this.state.form.github_url;
if (github_link == null) return;
return github_link.includes('https://github.com/');
};
parseIndonesianDateFormat(dateIndex) {
const monthNameIndex = {
'01': 'Januari',
......@@ -194,7 +186,7 @@ export default class EditProfile extends React.Component {
handleSubmit = (e) => {
e.preventDefault();
if (!this.isFromGithubLinkValid()) {
if (!isFromGithubLinkValid(this.state.form.github_url)) {
this.modalAlert.open(
'Pembaharuan profil gagal',
'Pastikan link github yang anda tulis benar.(Berpola : https://github.com/<username>',
......@@ -258,15 +250,6 @@ export default class EditProfile extends React.Component {
this.setState({ form });
};
gotoLink = (url) => {
const win = window.open(url);
win.focus();
};
gotoStudentResume = () => this.gotoLink(this.state.resume || '#');
gotoStudentTranscript = () => this.gotoLink(`transkrip/${this.state.id}`);
updateForm(show) {
if (show) {
return (
......
......@@ -16,6 +16,7 @@ import Server from './lib/Server';
import Storage from './lib/Storage';
import ModalAlert from './components/ModalAlert';
import Dumper from './lib/Dumper';
import { isFromGithubLinkValid, gotoLink } from './Utils';
export default class ProfilePage extends React.Component {
static propTypes = {
......@@ -104,7 +105,6 @@ export default class ProfilePage extends React.Component {
this.handleCheckbox = this.handleCheckbox.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.handleFile = this.handleFile.bind(this);
this.gotoLink = this.gotoLink.bind(this);
this.gotoStudentResume = this.gotoStudentResume.bind(this);
this.gotoStudentTranscript = this.gotoStudentTranscript.bind(this);
this.getProfile();
......@@ -179,12 +179,6 @@ export default class ProfilePage extends React.Component {
);
}
isFromGithubLinkValid = () => {
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/');
......@@ -239,7 +233,7 @@ export default class ProfilePage extends React.Component {
handleSubmit = (e) => {
e.preventDefault();
if (!this.isFromGithubLinkValid()) {
if (!isFromGithubLinkValid(this.state.form.github_url)) {
this.modalAlert.open(
'Pembaharuan profil gagal',
'Pastikan link github yang anda tulis benar.(Berpola : https://github.com/<username>',
......@@ -309,14 +303,9 @@ export default class ProfilePage extends React.Component {
this.setState({ form });
};
gotoLink = (url) => {
const win = window.open(url);
win.focus();
};
gotoStudentResume = () => this.gotoLink(this.state.resume || '#');
gotoStudentResume = () => gotoLink(this.state.resume || '#');
gotoStudentTranscript = () => this.gotoLink(`transkrip/${this.state.id}`);
gotoStudentTranscript = () => gotoLink(`transkrip/${this.state.id}`);
updateForm(show) {
if (show) {
......
export const isFromGithubLinkValid = github_link => {
if (github_link == null) return;
return github_link.includes('https://github.com/');
};
export const gotoLink = url => window.open(url).focus();
import React from 'react';
import {
Button, Header, Icon, Modal,
} from 'semantic-ui-react';
import {ModalComponent} from "./ModalComponent";
export default class ModalAlert extends React.Component {
constructor(props) {
......@@ -46,19 +44,14 @@ export default class ModalAlert extends React.Component {
render = () => {
const style = { whiteSpace: 'pre-wrap' };
return (
<Modal open={this.state.open} basic size="small">
<Header icon="warning sign" content={this.state.header} />
<Modal.Content>
<p style={style}>{this.state.content}</p>
</Modal.Content>
<Modal.Actions>
<Button color="green" inverted onClick={this.close}>
<Icon name="checkmark" />
{' '}
OK
</Button>
</Modal.Actions>
</Modal>
<ModalComponent
open={this.state.open}
icon={"warning sign"}
header={this.state.header}
style={style}
content={this.state.content}
onClick={this.close}
/>
);
};
}
import React from 'react';
import {
Button, Header, Icon, Modal,
} from 'semantic-ui-react';
export const ModalComponent = (props) => (
<Modal open={props.open} basic size="small">
<Header icon={props.icon} content={props.header} />
<Modal.Content>
<p style={props.style}>{props.content}</p>
</Modal.Content>
<Modal.Actions>
<Button color="green" inverted onClick={props.onClick}>
<Icon name="checkmark" />
{' '}
OK
</Button>
</Modal.Actions>
</Modal>
);
import React from 'react';
import {
Button, Header, Icon, Modal,
} from 'semantic-ui-react';
import {ModalComponent} from "./ModalComponent";
export default class ModalSuccess extends React.Component {
constructor(props) {
......@@ -29,7 +27,10 @@ export default class ModalSuccess extends React.Component {
open = (header = this.state.header, content = this.state.content, callback = this.state.callback) => {
this.setState({
open: true, header, content, callback,
open: true,
header,
content,
callback,
});
};
......@@ -41,19 +42,14 @@ export default class ModalSuccess extends React.Component {
render = () => {
const style = { whiteSpace: 'pre-wrap' };
return (
<Modal open={this.state.open} basic size="small">
<Header icon="checkmark sign" content={this.state.header} />
<Modal.Content>
<p style={style}>{this.state.content}</p>
</Modal.Content>
<Modal.Actions>
<Button color="green" inverted onClick={this.close}>
<Icon name="checkmark" />
{' '}
OK
</Button>
</Modal.Actions>
</Modal>
<ModalComponent
open={this.state.open}
icon={"checkmark sign"}
header={this.state.header}
style={style}
content={this.state.content}
onClick={this.close}
/>
);
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment