From 52afb428bcbcdc89ae879d00cc1e7d620a969295 Mon Sep 17 00:00:00 2001
From: cv <34649812+cpvalente@users.noreply.github.com>
Date: Fri, 21 Apr 2023 20:18:08 +0200
Subject: [PATCH 1/4] refactor: cuesheet show block title
---
apps/client/src/features/table/tableRows/BlockRow.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/client/src/features/table/tableRows/BlockRow.jsx b/apps/client/src/features/table/tableRows/BlockRow.jsx
index bcb2fd78fc..1bdb089ac8 100644
--- a/apps/client/src/features/table/tableRows/BlockRow.jsx
+++ b/apps/client/src/features/table/tableRows/BlockRow.jsx
@@ -6,7 +6,7 @@ export default function BlockRow(props) {
const { row } = props;
return (
- Delay Block |
+ {row.original?.title || 'Block'} |
);
}
From 3ebe5c7991db4f3326e633fa78a0c45509af9be2 Mon Sep 17 00:00:00 2001
From: cv <34649812+cpvalente@users.noreply.github.com>
Date: Fri, 21 Apr 2023 20:21:35 +0200
Subject: [PATCH 2/4] refactor: cuesheet show full delay string
---
apps/client/src/common/utils/__tests__/dateConfig.test.js | 8 ++++----
apps/client/src/common/utils/dateConfig.ts | 4 ++--
apps/client/src/features/table/tableRows/DelayRow.jsx | 8 +++-----
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/apps/client/src/common/utils/__tests__/dateConfig.test.js b/apps/client/src/common/utils/__tests__/dateConfig.test.js
index 4dbee84cc8..d8c49cc36b 100644
--- a/apps/client/src/common/utils/__tests__/dateConfig.test.js
+++ b/apps/client/src/common/utils/__tests__/dateConfig.test.js
@@ -462,10 +462,10 @@ describe('millisToDelayString()', () => {
});
describe('converts values in seconds', () => {
it(`shows a simple string with value in seconds`, () => {
- expect(millisToDelayString(10000)).toBe('+10sec');
+ expect(millisToDelayString(10000)).toBe('+10 sec');
});
it(`... and its negative counterpart`, () => {
- expect(millisToDelayString(-10000)).toBe('-10sec');
+ expect(millisToDelayString(-10000)).toBe('-10 sec');
});
const underAMinute = [1, 500, 1000, 6000, 55000, 59999];
@@ -479,10 +479,10 @@ describe('millisToDelayString()', () => {
describe('converts values in minutes', () => {
it(`shows a simple string with value in minutes`, () => {
- expect(millisToDelayString(720000)).toBe('+12min');
+ expect(millisToDelayString(720000)).toBe('+12 min');
});
it(`... and its negative counterpart`, () => {
- expect(millisToDelayString(-720000)).toBe('-12min');
+ expect(millisToDelayString(-720000)).toBe('-12 min');
});
it(`shows a simple string with value in minutes and seconds`, () => {
expect(millisToDelayString(630000)).toBe('+00:10:30');
diff --git a/apps/client/src/common/utils/dateConfig.ts b/apps/client/src/common/utils/dateConfig.ts
index ad3f8c9fee..3c4e2c226b 100644
--- a/apps/client/src/common/utils/dateConfig.ts
+++ b/apps/client/src/common/utils/dateConfig.ts
@@ -233,9 +233,9 @@ export function millisToDelayString(millis: number | null): undefined | string |
const absMillis = Math.abs(millis);
if (absMillis < mtm) {
- return `${isNegative ? '-' : '+'}${formatFromMillis(absMillis, 's')}sec`;
+ return `${isNegative ? '-' : '+'}${formatFromMillis(absMillis, 's')} sec`;
} else if (absMillis < mth && absMillis % mtm === 0) {
- return `${isNegative ? '-' : '+'}${formatFromMillis(absMillis, 'm')}min`;
+ return `${isNegative ? '-' : '+'}${formatFromMillis(absMillis, 'm')} min`;
} else {
return `${isNegative ? '-' : '+'}${formatFromMillis(absMillis, 'HH:mm:ss')}`;
}
diff --git a/apps/client/src/features/table/tableRows/DelayRow.jsx b/apps/client/src/features/table/tableRows/DelayRow.jsx
index 5157b9ea6a..fb24298dd5 100644
--- a/apps/client/src/features/table/tableRows/DelayRow.jsx
+++ b/apps/client/src/features/table/tableRows/DelayRow.jsx
@@ -1,18 +1,17 @@
import PropTypes from 'prop-types';
-import { millisToMinutes } from '../../../common/utils/dateConfig';
+import { millisToDelayString } from '../../../common/utils/dateConfig';
import style from '../Table.module.scss';
export default function DelayRow(props) {
const { row } = props;
const delayVal = row.original.duration;
- const minutesDelayed = Math.abs(millisToMinutes(delayVal));
- const labelText = `${minutesDelayed} minutes ${delayVal >= 0 ? 'delayed' : 'ahead'}`;
+ const delayTime = delayVal !== 0 ? millisToDelayString(delayVal) : null;
return (
- {labelText} |
+ {delayTime} |
);
}
@@ -20,4 +19,3 @@ export default function DelayRow(props) {
DelayRow.propTypes = {
row: PropTypes.object.isRequired,
};
-
From 92c9bb3fd5591906227c02893726e1672d4567ed Mon Sep 17 00:00:00 2001
From: cv <34649812+cpvalente@users.noreply.github.com>
Date: Fri, 21 Apr 2023 20:33:08 +0200
Subject: [PATCH 3/4] refactor: cuesheet show full delay string
---
e2e/tests/002-upload-showfile.spec.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2e/tests/002-upload-showfile.spec.ts b/e2e/tests/002-upload-showfile.spec.ts
index bccfcea48f..721a396c58 100644
--- a/e2e/tests/002-upload-showfile.spec.ts
+++ b/e2e/tests/002-upload-showfile.spec.ts
@@ -17,7 +17,7 @@ test('test', async ({ page }) => {
await page.getByTestId('delay-input').click();
await page
.locator('div')
- .filter({ hasText: /^SED\+10minNew start: 10:10:00$/ })
+ .filter({ hasText: /^SED\+10 minNew start: 10:10:00$/ })
.getByPlaceholder('Start')
.click();
await page.getByText('+10minNew start: 10:10:00').click();
From 404e49ece4ea1bdbb1a7231fe22c4f812ba4bea7 Mon Sep 17 00:00:00 2001
From: cv <34649812+cpvalente@users.noreply.github.com>
Date: Fri, 21 Apr 2023 20:36:08 +0200
Subject: [PATCH 4/4] refactor: cuesheet show full delay string
---
e2e/tests/002-upload-showfile.spec.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2e/tests/002-upload-showfile.spec.ts b/e2e/tests/002-upload-showfile.spec.ts
index 721a396c58..8fac43eb2c 100644
--- a/e2e/tests/002-upload-showfile.spec.ts
+++ b/e2e/tests/002-upload-showfile.spec.ts
@@ -20,7 +20,7 @@ test('test', async ({ page }) => {
.filter({ hasText: /^SED\+10 minNew start: 10:10:00$/ })
.getByPlaceholder('Start')
.click();
- await page.getByText('+10minNew start: 10:10:00').click();
+ await page.getByText('+10 minNew start: 10:10:00').click();
await page.getByText('Second test event').click();
await page.getByText('Lunch').click();
await page.getByText('Third test event').click();