import PropTypes from 'prop-types';
import React from 'react';
-import { Alert, Button } from 'react-bootstrap';
+import { Alert, Button, Table } from 'react-bootstrap';
import { withTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
{i18n.t('users.participationEmpty')}
</Alert>;
}
- return <div className="participation">
- {user.participation.map(p => <div key={p.id}>
- <Button
- onClick={() => navigate(`/tournaments/${p.tournament_id}`)}
- variant="link"
- >
- {p.tournament.title}
- </Button>
- </div>)}
- </div>;
+ return <Table className="participation">
+ <thead>
+ <tr>
+ <th>{i18n.t('participants.tournament')}</th>
+ <th>{i18n.t('participants.roles')}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {user.participation.map(p => <tr key={p.id}>
+ <td>
+ <Button
+ onClick={() => navigate(`/tournaments/${p.tournament_id}`)}
+ variant="link"
+ >
+ {p.tournament.title}
+ </Button>
+ </td>
+ <td>
+ {p.roles ? p.roles.map((role, index) =>
+ <span key={role}>
+ {index === 0 ? '' : ', '}
+ {i18n.t(`participants.roleNames.${role}`)}
+ </span>
+ ) : null}
+ </td>
+ </tr>)}
+ </tbody>
+ </Table>;
};
Participation.propTypes = {
empty: 'Noch keine Teilnehmer eingetragen',
heading: 'Teilnehmer',
participant: 'Teilnehmer',
+ roleNames: {
+ admin: 'Administrator',
+ runner: 'Runner',
+ },
+ roles: 'Teilnahme als',
+ tournament: 'Turnier',
score: 'Punktzahl',
},
protocol: {
empty: 'No participants on record',
heading: 'Participants',
participant: 'Participant',
+ roleNames: {
+ admin: 'Administrator',
+ runner: 'Runner',
+ },
+ roles: 'Participated as',
+ tournament: 'Tournament',
score: 'Score',
},
protocol: {