From 8de5ad7ab770e3658240b9f65252f786a67741ba Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 11:50:05 +0200 Subject: [PATCH 1/2] 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..047398a3a2 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|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'); + } + onupdate(vnode) { super.onupdate(vnode); From d93212a654a1a35dea153054611685bd581a3eab Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 12:01:23 +0200 Subject: [PATCH 2/2] chore: debug --- .../core/js/src/forum/components/PostStreamScrubber.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 047398a3a2..f9f50dae96 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 @@ -94,7 +93,7 @@ export default class PostStreamScrubber extends Component { } /** - * @returns {NestedStringArray|string} + * @returns {any|string} */ firstPostLabel() { return app.translator.trans('core.forum.post_scrubber.original_post_link'); @@ -102,14 +101,14 @@ export default class PostStreamScrubber extends Component { /** * @param {number} unreadCount - * @returns {NestedStringArray|string} + * @returns {any|string} */ unreadLabel(unreadCount) { return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount }); } /** - * @returns {NestedStringArray|string} + * @returns {any|string} */ lastPostLabel() { return app.translator.trans('core.forum.post_scrubber.now_link');