From 4707e4ed2e255e0524f0870ace0aeb79f67cd8f5 Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 10:03:36 +0200 Subject: [PATCH 1/3] refactor(core): allow labels to be customized --- .../forum/components/PostStreamScrubber.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 4fe6b3ace7..5ab4fb7de3 100644 --- a/framework/core/js/src/forum/components/PostStreamScrubber.js +++ b/framework/core/js/src/forum/components/PostStreamScrubber.js @@ -3,6 +3,7 @@ import Component from '../../common/Component'; import icon from '../../common/helpers/icon'; import formatNumber from '../../common/utils/formatNumber'; import ScrollListener from '../../common/utils/ScrollListener'; +import { NestedStringArray } from '@askvortsov/rich-icu-message-formatter'; /** * The `PostStreamScrubber` component displays a scrubber which can be used to @@ -64,7 +65,7 @@ export default class PostStreamScrubber extends Component {
- {icon('fas fa-angle-double-up')} {app.translator.trans('core.forum.post_scrubber.original_post_link')} + {icon('fas fa-angle-double-up')} {this.firstPostLabel()}
@@ -79,12 +80,12 @@ export default class PostStreamScrubber extends Component {
- {app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount })} + {this.unreadLabel(unreadCount)}
- {icon('fas fa-angle-double-down')} {app.translator.trans('core.forum.post_scrubber.now_link')} + {icon('fas fa-angle-double-down')} {this.lastPostLabel()}
@@ -92,6 +93,28 @@ export default class PostStreamScrubber extends Component { ); } + /** + * @returns {NestedStringArray} + */ + firstPostLabel() { + return app.translator.trans('core.forum.post_scrubber.original_post_link'); + } + + /** + * @param {number} unreadCount + * @returns {NestedStringArray} + */ + unreadLabel(unreadCount) { + return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount }); + } + + /** + * @returns {NestedStringArray} + */ + lastPostLabel() { + return app.translator.trans('core.forum.post_scrubber.now_link'); + } + onupdate(vnode) { super.onupdate(vnode); From 35ceef09059b27ccd29dae2ff878d0c7d92203d9 Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 11:39:42 +0200 Subject: [PATCH 2/3] chore: change type annotation --- .../core/js/src/forum/components/PostStreamScrubber.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 5ab4fb7de3..047398a3a2 100644 --- a/framework/core/js/src/forum/components/PostStreamScrubber.js +++ b/framework/core/js/src/forum/components/PostStreamScrubber.js @@ -94,7 +94,7 @@ export default class PostStreamScrubber extends Component { } /** - * @returns {NestedStringArray} + * @returns {NestedStringArray|string} */ firstPostLabel() { return app.translator.trans('core.forum.post_scrubber.original_post_link'); @@ -102,14 +102,14 @@ export default class PostStreamScrubber extends Component { /** * @param {number} unreadCount - * @returns {NestedStringArray} + * @returns {NestedStringArray|string} */ unreadLabel(unreadCount) { return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount }); } /** - * @returns {NestedStringArray} + * @returns {NestedStringArray|string} */ lastPostLabel() { return app.translator.trans('core.forum.post_scrubber.now_link'); From af273df1ddb7f5cf0f91c46f0a8356d136cb357d Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 12:11:22 +0200 Subject: [PATCH 3/3] chore: remove type annotations Importing `NestedStringArray` did cause issues in the CI --- .../js/src/forum/components/PostStreamScrubber.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 047398a3a2..ba166bc674 100644 --- a/framework/core/js/src/forum/components/PostStreamScrubber.js +++ b/framework/core/js/src/forum/components/PostStreamScrubber.js @@ -3,7 +3,6 @@ import Component from '../../common/Component'; import icon from '../../common/helpers/icon'; import formatNumber from '../../common/utils/formatNumber'; import ScrollListener from '../../common/utils/ScrollListener'; -import { NestedStringArray } from '@askvortsov/rich-icu-message-formatter'; /** * The `PostStreamScrubber` component displays a scrubber which can be used to @@ -93,24 +92,14 @@ export default class PostStreamScrubber extends Component { ); } - /** - * @returns {NestedStringArray|string} - */ firstPostLabel() { return app.translator.trans('core.forum.post_scrubber.original_post_link'); } - /** - * @param {number} unreadCount - * @returns {NestedStringArray|string} - */ unreadLabel(unreadCount) { return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount }); } - /** - * @returns {NestedStringArray|string} - */ lastPostLabel() { return app.translator.trans('core.forum.post_scrubber.now_link'); }