<commit_before>import React from 'react';
import Picture from './Picture';
import ChangePassword from './ChangePassword';
import AccountDeletion from './AccountDeletion';
import ChangePersonalData from './ChangePersonalData';

class UserSettings extends React.Component {
    componentDidMount() {
        this.enableAccordion();
    }

    componentDidUpdate() {
        this.refreshAccordion();
        if (this.props.dimmer.success === true)
            $('#userDataDimmer').dimmer('show');
        if (this.props.dimmer.userdeleted === true)
            $('#userDeleteDimmer').dimmer('show');
        if (this.props.dimmer.failure === true)
            $('#failureDimmer').dimmer('show');
    }

    enableAccordion(status) {
        $(this.refs.accordion).accordion();
        $(this.refs.language).dropdown();
    }

    refreshAccordion(status) {
        $(this.refs.accordion).accordion('refresh');
        $(this.refs.language).dropdown('refresh');
    }

    render() {
        return (
            <div>
                <div className="ui styled fluid accordion" ref="accordion">

                    <div className="active title">
                        <i className="dropdown icon"/> <i className="user icon"/>
                        Personal Data
                    </div>
                    <div className="active content ui">
                        <div className="ui stackable vertically divided grid">

                            <div className="row">
                                <div className="sixteen wide column">
                                    <Picture user={ this.props.user }/>
                                </div>
                            </div>

                            <div className="row">
                                <div className="sixteen wide column">
                                    <ChangePersonalData user={ this.props.user} failures={ this.props.failures }/>
                                </div>
                            </div>

                            <div className="row">
                                <div className="sixteen wide column">
                                    <ChangePassword failures={ this.props.failures }/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div className="title">
                        <i className="dropdown icon"/> <i className="settings icon"/>
                        Integrations with other platforms
                    </div>
                    <div className="content">
                        <p>This feature is currently missing. Please wait for future releases of SlideWiki.</p>
                        {/*Include a nested accordion covering Google, Github, ....*/}
                    </div>

                    <div className="title">
                        <i className="dropdown icon"/> <i className="ban icon"/>
                        Delete my account
                    </div>
                    <div className="content">
                        <AccountDeletion />
                    </div>
                </div>
                <div className="ui blurring page dimmer" id="userDataDimmer">
                    <div className="content">
                        <div className="center"><h1 className="ui inverted icon header"><i className="huge inverted checkmark icon"/>Changes have been applied</h1></div>
                    </div>
                </div>
                <div className="ui blurring page dimmer" id="userDeleteDimmer">
                    <div className="content">
                        <div className="center"><h1 className="ui inverted icon header"><i className="huge inverted checkmark icon"/>Your Account has been deleted</h1></div>
                    </div>
                </div>
                <div className="ui blurring page dimmer" id="failureDimmer">
                    <div className="content">
                        <div className="center"><h1 className="ui inverted icon header"><i className="huge inverted ban icon"/>Something went wrong</h1></div>
                    </div>
                </div>
            </div>
        );
    }
}

UserSettings.contextTypes = {
    executeAction: React.PropTypes.func.isRequired
};

export default UserSettings;
<commit_msg>[SWIK-640_same_modals] Exchanged modals/notifications in UserSettings<commit_after>import React from 'react';
import Picture from './Picture';
import ChangePassword from './ChangePassword';
import AccountDeletion from './AccountDeletion';
import ChangePersonalData from './ChangePersonalData';

class UserSettings extends React.Component {
    componentDidMount() {
        this.enableAccordion();
    }

    componentDidUpdate() {
        this.refreshAccordion();
        if (this.props.dimmer.success === true)
            swal({
                type: 'success',
                text: '',
                title: 'Changes have been applied',
                timer: 2600,
                showCloseButton: false,
                showCancelButton: false,
                allowEscapeKey: false,
                showConfirmButton: false
            })
            .then(() => {});
        if (this.props.dimmer.userdeleted === true)
            swal({
                type: 'success',
                text: '',
                title: 'Your Account has been deleted',
                timer: 4000,
                showCloseButton: false,
                showCancelButton: false,
                allowEscapeKey: false,
                showConfirmButton: false
            })
            .then(() => {});
        if (this.props.dimmer.failure === true)
            swal({
                title: 'Error',
                text: 'Something went wrong',
                type: 'error',
                allowEscapeKey: false,
                allowOutsideClick: false,
                confirmButtonText: 'OK',
                confirmButtonClass: 'negative ui button',
                buttonsStyling: false
            })
            .then(() => {});
    }

    enableAccordion(status) {
        $(this.refs.accordion).accordion();
        $(this.refs.language).dropdown();
    }

    refreshAccordion(status) {
        $(this.refs.accordion).accordion('refresh');
        $(this.refs.language).dropdown('refresh');
    }

    render() {
        return (
            <div>
                <div className="ui styled fluid accordion" ref="accordion">

                    <div className="active title">
                        <i className="dropdown icon"/> <i className="user icon"/>
                        Personal Data
                    </div>
                    <div className="active content ui">
                        <div className="ui stackable vertically divided grid">

                            <div className="row">
                                <div className="sixteen wide column">
                                    <Picture user={ this.props.user }/>
                                </div>
                            </div>

                            <div className="row">
                                <div className="sixteen wide column">
                                    <ChangePersonalData user={ this.props.user} failures={ this.props.failures }/>
                                </div>
                            </div>

                            <div className="row">
                                <div className="sixteen wide column">
                                    <ChangePassword failures={ this.props.failures }/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div className="title">
                        <i className="dropdown icon"/> <i className="settings icon"/>
                        Integrations with other platforms
                    </div>
                    <div className="content">
                        <p>This feature is currently missing. Please wait for future releases of SlideWiki.</p>
                        {/*Include a nested accordion covering Google, Github, ....*/}
                    </div>

                    <div className="title">
                        <i className="dropdown icon"/> <i className="ban icon"/>
                        Delete my account
                    </div>
                    <div className="content">
                        <AccountDeletion />
                    </div>
                </div>
            </div>
        );
    }
}

UserSettings.contextTypes = {
    executeAction: React.PropTypes.func.isRequired
};

export default UserSettings;

{'fraction_non_alphanumeric': 0.10945387792565398, 'fraction_numerical': 0.001950435979807251, 'mean_word_length': 1.245492014425554, 'pattern_counts': {'":': 0, '<': 114, '<?xml version=': 0, '>': 117, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1358423', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1866, 'n_words': 479}