aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/app/views')
-rw-r--r--FrontEnd/src/app/views/about/index.tsx8
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx16
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx11
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx2
4 files changed, 13 insertions, 24 deletions
diff --git a/FrontEnd/src/app/views/about/index.tsx b/FrontEnd/src/app/views/about/index.tsx
index d63b6996..a8a53a97 100644
--- a/FrontEnd/src/app/views/about/index.tsx
+++ b/FrontEnd/src/app/views/about/index.tsx
@@ -25,10 +25,6 @@ const frontendCredits: {
url: "https://react-bootstrap.github.io",
},
{
- name: "babeljs",
- url: "https://babeljs.io",
- },
- {
name: "webpack",
url: "https://webpack.js.org",
},
@@ -48,10 +44,6 @@ const frontendCredits: {
name: "pepjs",
url: "https://github.com/jquery/PEP",
},
- {
- name: "react-inlinesvg",
- url: "https://github.com/gilbarbara/react-inlinesvg",
- },
];
const backendCredits: {
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx
index 69fd9207..37f02a82 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePagedPostListView.tsx
@@ -1,8 +1,9 @@
import React from "react";
-import { fromEvent } from "rxjs";
import { HttpTimelinePostInfo } from "@/http/timeline";
+import useScrollToTop from "@/utilities/useScrollToTop";
+
import TimelinePostListView from "./TimelinePostListView";
export interface TimelinePagedPostListViewProps {
@@ -25,16 +26,9 @@ const TimelinePagedPostListView: React.FC<TimelinePagedPostListViewProps> = (
: posts.slice(-lastViewCount);
}, [posts, lastViewCount]);
- React.useEffect(() => {
- if (lastViewCount < posts.length) {
- const subscription = fromEvent(window, "scroll").subscribe(() => {
- if (window.scrollY === 0) {
- setLastViewCount(lastViewCount + 10);
- }
- });
- return () => subscription.unsubscribe();
- }
- }, [lastViewCount, posts]);
+ useScrollToTop(() => {
+ setLastViewCount(lastViewCount + 10);
+ }, lastViewCount < posts.length);
return (
<TimelinePostListView
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
index c9fec919..2f778ab1 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
@@ -28,15 +28,18 @@ const TimelinePostView: React.FC<TimelinePostViewProps> = (props) => {
React.useState<boolean>(false);
const [deleteDialog, setDeleteDialog] = React.useState<boolean>(false);
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const cardRef = React.useRef<HTMLDivElement>(null!);
+ const cardRef = React.useRef<HTMLDivElement>(null);
React.useEffect(() => {
const cardIntersectionObserver = new IntersectionObserver(([e]) => {
if (e.intersectionRatio > 0) {
- cardRef.current.style.animationName = "timeline-post-enter";
+ if (cardRef.current != null) {
+ cardRef.current.style.animationName = "timeline-post-enter";
+ }
}
});
- cardIntersectionObserver.observe(cardRef.current);
+ if (cardRef.current) {
+ cardIntersectionObserver.observe(cardRef.current);
+ }
return () => {
cardIntersectionObserver.disconnect();
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
index f38485eb..70f72025 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
@@ -72,7 +72,7 @@ const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps>
if (newDescription !== timeline.description) {
req.description = newDescription;
}
- const nc = newColor ?? "#007bff";
+ const nc = newColor ?? "";
if (nc !== timeline.color) {
req.color = nc;
}