-import { isParticipant } from '../../helpers/permissions';
-import { findParticipant } from '../../helpers/Tournament';
-import { withUser } from '../../helpers/UserContext';
-import i18n from '../../i18n';
+import { mayEditRound, mayReportResult, isRunner } from '../../helpers/permissions';
+import { isComplete } from '../../helpers/Round';
+import { hasFinishedRound } from '../../helpers/User';
+import { useUser } from '../../hooks/user';
+
+const getClassName = (round, tournament, user) => {
+ const classNames = ['round'];
+ if (round.locked) {
+ classNames.push('is-locked');
+ } else {
+ classNames.push('is-unlocked');
+ }
+ if (isComplete(tournament, round)) {
+ classNames.push('is-complete');
+ } else {
+ classNames.push('is-incomplete');
+ }
+ if (hasFinishedRound(user, round)) {
+ classNames.push('has-finished');
+ } else if (isRunner(user, tournament)) {
+ classNames.push('has-not-finished');
+ }
+ return classNames.join(' ');
+};