fix: Rename timer to stopwatch

Closes #392
This commit is contained in:
Maksim Eltyshev
2023-02-27 19:09:51 +01:00
parent eea57ff121
commit d0a2734161
35 changed files with 179 additions and 161 deletions
+13 -13
View File
@@ -9,7 +9,7 @@ import { useSteps } from '../../hooks';
import BoardMembershipsStep from '../BoardMembershipsStep';
import LabelsStep from '../LabelsStep';
import DueDateEditStep from '../DueDateEditStep';
import TimerEditStep from '../TimerEditStep';
import StopwatchEditStep from '../StopwatchEditStep';
import CardMoveStep from '../CardMoveStep';
import DeleteStep from '../DeleteStep';
@@ -19,7 +19,7 @@ const StepTypes = {
USERS: 'USERS',
LABELS: 'LABELS',
EDIT_DUE_DATE: 'EDIT_DUE_DATE',
EDIT_TIMER: 'EDIT_TIMER',
EDIT_STOPWATCH: 'EDIT_STOPWATCH',
MOVE: 'MOVE',
DELETE: 'DELETE',
};
@@ -68,8 +68,8 @@ const ActionsStep = React.memo(
openStep(StepTypes.EDIT_DUE_DATE);
}, [openStep]);
const handleEditTimerClick = useCallback(() => {
openStep(StepTypes.EDIT_TIMER);
const handleEditStopwatchClick = useCallback(() => {
openStep(StepTypes.EDIT_STOPWATCH);
}, [openStep]);
const handleMoveClick = useCallback(() => {
@@ -89,10 +89,10 @@ const ActionsStep = React.memo(
[onUpdate],
);
const handleTimerUpdate = useCallback(
(timer) => {
const handleStopwatchUpdate = useCallback(
(stopwatch) => {
onUpdate({
timer,
stopwatch,
});
},
[onUpdate],
@@ -133,11 +133,11 @@ const ActionsStep = React.memo(
onClose={onClose}
/>
);
case StepTypes.EDIT_TIMER:
case StepTypes.EDIT_STOPWATCH:
return (
<TimerEditStep
defaultValue={card.timer}
onUpdate={handleTimerUpdate}
<StopwatchEditStep
defaultValue={card.stopwatch}
onUpdate={handleStopwatchUpdate}
onBack={handleBack}
onClose={onClose}
/>
@@ -197,8 +197,8 @@ const ActionsStep = React.memo(
context: 'title',
})}
</Menu.Item>
<Menu.Item className={styles.menuItem} onClick={handleEditTimerClick}>
{t('action.editTimer', {
<Menu.Item className={styles.menuItem} onClick={handleEditStopwatchClick}>
{t('action.editStopwatch', {
context: 'title',
})}
</Menu.Item>
+15 -15
View File
@@ -6,7 +6,7 @@ import { Link } from 'react-router-dom';
import { Draggable } from 'react-beautiful-dnd';
import { usePopup } from '../../lib/popup';
import { startTimer, stopTimer } from '../../utils/timer';
import { startStopwatch, stopStopwatch } from '../../utils/stopwatch';
import Paths from '../../constants/Paths';
import Tasks from './Tasks';
import NameEdit from './NameEdit';
@@ -14,7 +14,7 @@ import ActionsStep from './ActionsStep';
import User from '../User';
import Label from '../Label';
import DueDate from '../DueDate';
import Timer from '../Timer';
import Stopwatch from '../Stopwatch';
import styles from './Card.module.scss';
@@ -24,7 +24,7 @@ const Card = React.memo(
index,
name,
dueDate,
timer,
stopwatch,
coverUrl,
boardId,
listId,
@@ -60,15 +60,15 @@ const Card = React.memo(
}
}, []);
const handleToggleTimerClick = useCallback(
const handleToggleStopwatchClick = useCallback(
(event) => {
event.preventDefault();
onUpdate({
timer: timer.startedAt ? stopTimer(timer) : startTimer(timer),
stopwatch: stopwatch.startedAt ? stopStopwatch(stopwatch) : startStopwatch(stopwatch),
});
},
[timer, onUpdate],
[stopwatch, onUpdate],
);
const handleNameUpdate = useCallback(
@@ -104,7 +104,7 @@ const Card = React.memo(
)}
<div className={styles.name}>{name}</div>
{tasks.length > 0 && <Tasks items={tasks} />}
{(dueDate || timer || notificationsTotal > 0) && (
{(dueDate || stopwatch || notificationsTotal > 0) && (
<span className={styles.attachments}>
{notificationsTotal > 0 && (
<span
@@ -122,14 +122,14 @@ const Card = React.memo(
<DueDate value={dueDate} size="tiny" />
</span>
)}
{timer && (
{stopwatch && (
<span className={classNames(styles.attachment, styles.attachmentLeft)}>
<Timer
<Stopwatch
as="span"
startedAt={timer.startedAt}
total={timer.total}
startedAt={stopwatch.startedAt}
total={stopwatch.total}
size="tiny"
onClick={canEdit ? handleToggleTimerClick : undefined}
onClick={canEdit ? handleToggleStopwatchClick : undefined}
/>
</span>
)}
@@ -171,7 +171,7 @@ const Card = React.memo(
<ActionsPopup
card={{
dueDate,
timer,
stopwatch,
boardId,
listId,
projectId,
@@ -219,7 +219,7 @@ Card.propTypes = {
index: PropTypes.number.isRequired,
name: PropTypes.string.isRequired,
dueDate: PropTypes.instanceOf(Date),
timer: PropTypes.object, // eslint-disable-line react/forbid-prop-types
stopwatch: PropTypes.object, // eslint-disable-line react/forbid-prop-types
coverUrl: PropTypes.string,
boardId: PropTypes.string.isRequired,
listId: PropTypes.string.isRequired,
@@ -252,7 +252,7 @@ Card.propTypes = {
Card.defaultProps = {
dueDate: undefined,
timer: undefined,
stopwatch: undefined,
coverUrl: undefined,
};