summaryrefslogtreecommitdiff
path: root/client/src/pages/ServerSelection.js
blob: 7e2798263e6ba3a740fc69c93c6ccfb739dc42fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Alert, CardColumns } from 'react-bootstrap';

import ServerCard from '../components/selection/ServerCard';

export default class ServerSelection extends Component {
    render() {
        const guilds = this.props.user.guilds.filter(g => g.admin);
        
        if (!guilds.length) {
            return(
                <Alert variant="warning">
                    <strong>You cannot manage any servers</strong>
                </Alert>
            );
        } else {
            return(
                <React.Fragment>
                    <CardColumns>
                        {guilds.map(guild => {
                            return(<ServerCard guild={guild} />);
                        })}
                    </CardColumns>
                </React.Fragment>
            );
        }
    }
}

ServerSelection.propTypes = {
    user: PropTypes.object
}