Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/assets/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
display: flex;
flex-shrink: 1;
}

/* @cubing/icons 3.0.5 provides the FTO glyph under its former unofficial name. */
.cubing-icon.event-fto:before {
content: '\f135';
}
3 changes: 2 additions & 1 deletion src/components/RoundSelector/RoundListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
activityCodeToName,
cumulativeGroupCount,
findGroupActivitiesByRound,
parseActivityCode,
Expand All @@ -12,7 +13,7 @@ import {
} from '../../store/selectors';
import '@cubing/icons';
import { Collapse, ListItemAvatar, ListItemButton, ListItemText } from '@mui/material';
import { activityCodeToName, type Round } from '@wca/helpers';
import { type Round } from '@wca/helpers';
import { useEffect, useRef } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import type { AppState } from '../../store/initialState';
Expand Down
8 changes: 6 additions & 2 deletions src/dialogs/ConfigureGroupDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { generateNextChildActivityId, parseActivityCode } from '../lib/domain/activities';
import {
activityCodeToName,
generateNextChildActivityId,
parseActivityCode,
} from '../lib/domain/activities';
import { useAppSelector } from '../store';
import { editActivity } from '../store/actions';
import {
Expand All @@ -12,7 +16,7 @@ import {
TextField,
Typography,
} from '@mui/material';
import { type Activity, activityCodeToName } from '@wca/helpers';
import { type Activity } from '@wca/helpers';
import { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';

Expand Down
8 changes: 6 additions & 2 deletions src/dialogs/ConfigureGroupsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { createGroupActivity, findAllActivities } from '../lib/domain/activities';
import {
activityCodeToName,
createGroupActivity,
findAllActivities,
} from '../lib/domain/activities';
import { formatTimeRange } from '../lib/utils/time';
import { useAppSelector, useAppDispatch } from '../store';
import { updateRoundChildActivities } from '../store/actions';
Expand Down Expand Up @@ -33,7 +37,7 @@ import {
type GridRowModesModel,
GridToolbarContainer,
} from '@mui/x-data-grid';
import { type Activity, activityCodeToName, parseActivityCode } from '@wca/helpers';
import { type Activity, parseActivityCode } from '@wca/helpers';
import { formatDuration } from 'date-fns';
import { omit } from 'lodash';
import React, { Fragment, useCallback } from 'react';
Expand Down
6 changes: 6 additions & 0 deletions src/lib/domain/activities/activityCode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ describe('activityCodeToName', () => {
it('handles different event types', () => {
expect(activityCodeToName('444bf-r1')).toBe('4x4x4 Blindfolded, Round 1');
});

it('handles FTO', () => {
expect(activityCodeToName('fto-r1-g2')).toBe(
'Face-Turning Octahedron, Round 1, Group 2'
);
});
});

describe('activityCodeIsChild', () => {
Expand Down
5 changes: 4 additions & 1 deletion src/lib/domain/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('eventNameById', () => {
expect(eventNameById('333fm')).toBe('3x3x3 Fewest Moves');
expect(eventNameById('minx')).toBe('Megaminx');
expect(eventNameById('pyram')).toBe('Pyraminx');
expect(eventNameById('fto')).toBe('Face-Turning Octahedron');
});

it('throws for unknown event ID', () => {
Expand All @@ -45,6 +46,7 @@ describe('shortEventNameById', () => {
expect(shortEventNameById('333fm')).toBe('FMC');
expect(shortEventNameById('333oh')).toBe('3OH');
expect(shortEventNameById('333mbf')).toBe('MBLD');
expect(shortEventNameById('fto')).toBe('FTO');
});

it('throws for unknown event ID', () => {
Expand Down Expand Up @@ -123,10 +125,11 @@ describe('sortWcifEvents', () => {
{ id: '333', rounds: [], extensions: [] },
{ id: '222', rounds: [], extensions: [] },
{ id: '444', rounds: [], extensions: [] },
{ id: 'fto' as Event['id'], rounds: [], extensions: [] },
];

const sorted = sortWcifEvents(wcifEvents);
expect(sorted.map((e) => e.id)).toEqual(['333', '222', '444', 'minx']);
expect(sorted.map((e) => e.id)).toEqual(['333', '222', '444', 'minx', 'fto']);
});

it('maintains order for events not in the standard list', () => {
Expand Down
5 changes: 4 additions & 1 deletion src/lib/domain/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { type Event, type EventId } from '@wca/helpers';
import { type Event, type EventId as WcaEventId } from '@wca/helpers';
import { sortBy } from 'lodash';

type EventId = WcaEventId | 'fto';

interface EventInfo {
id: EventId;
name: string;
Expand All @@ -22,6 +24,7 @@ export const events: EventInfo[] = [
{ id: 'clock', name: 'Clock', shortName: 'Clock' },
{ id: 'skewb', name: 'Skewb', shortName: 'Skewb' },
{ id: 'sq1', name: 'Square-1', shortName: 'Sq1' },
{ id: 'fto', name: 'Face-Turning Octahedron', shortName: 'FTO' },
{ id: '444bf', name: '4x4x4 Blindfolded', shortName: '4BLD' },
{ id: '555bf', name: '5x5x5 Blindfolded', shortName: '5BLD' },
{ id: '333mbf', name: '3x3x3 Multi-Blind', shortName: 'MBLD' },
Expand Down
Loading