refactor: place all presentation code in a presentation folder
Some features didn't have this folder.
Bug: twpowertools:226
Change-Id: Ic9803e7ee66a15c6c9e083509e059e453a26ed0f
diff --git a/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler.ts b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler.ts
new file mode 100644
index 0000000..c776588
--- /dev/null
+++ b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBar.handler.ts
@@ -0,0 +1,22 @@
+import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
+import CCInfiniteScroll from '../../core/ccInfiniteScroll';
+import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
+
+export default class CCInfiniteScrollLoadMoreBarHandler extends CssSelectorNodeWatcherHandler {
+ cssSelector = '.load-more-bar';
+
+ constructor(private ccInfiniteScroll: CCInfiniteScroll) {
+ super();
+ }
+
+ onMutatedNode({ node }: NodeMutation) {
+ if (!(node instanceof Element)) {
+ console.error(
+ '[CCInfiniteScrollLoadMoreBarHandler] Node is not an Element: ',
+ node,
+ );
+ return;
+ }
+ this.ccInfiniteScroll.observeLoadMoreBar(node);
+ }
+}
diff --git a/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler.ts b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler.ts
new file mode 100644
index 0000000..2f3e72a
--- /dev/null
+++ b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollLoadMoreBtn.handler.ts
@@ -0,0 +1,23 @@
+import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
+import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
+import CCInfiniteScroll from '../../core/ccInfiniteScroll';
+
+export default class CCInfiniteScrollLoadMoreBtnHandler extends CssSelectorNodeWatcherHandler {
+ cssSelector =
+ '.scTailwindThreadMorebuttonbutton, .scTailwindThreadMessagegapbutton';
+
+ constructor(private ccInfiniteScroll: CCInfiniteScroll) {
+ super();
+ }
+
+ onMutatedNode({ node }: NodeMutation) {
+ if (!(node instanceof Element)) {
+ console.error(
+ '[CCInfiniteScrollLoadMoreBtnHandler] Node is not an Element: ',
+ node,
+ );
+ return;
+ }
+ this.ccInfiniteScroll.observeLoadMoreInteropBtn(node);
+ }
+}
diff --git a/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler.ts b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler.ts
new file mode 100644
index 0000000..ad6e153
--- /dev/null
+++ b/src/features/infiniteScroll/presentation/nodeWatcherHandlers/ccInfiniteScrollSetUp.handler.ts
@@ -0,0 +1,17 @@
+import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
+import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
+import CCInfiniteScroll from '../../core/ccInfiniteScroll';
+
+export default class CCInfiniteScrollSetUpHandler extends CssSelectorNodeWatcherHandler {
+ cssSelector = 'ec-app, .scrollable-content';
+
+ constructor(private ccInfiniteScroll: CCInfiniteScroll) {
+ super();
+ }
+
+ onMutatedNode({ node }: NodeMutation) {
+ if (!(node instanceof Element)) return;
+ const isScrollableContent = node.classList.contains('scrollable-content');
+ this.ccInfiniteScroll.setUpIntersectionObserver(node, isScrollableContent);
+ }
+}