aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/timeline-common/Timeline.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'FrontEnd/src/app/views/timeline-common/Timeline.tsx')
-rw-r--r--FrontEnd/src/app/views/timeline-common/Timeline.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
index ff9f663a..aba868cb 100644
--- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx
+++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
@@ -7,7 +7,7 @@ import TimelineItem from "./TimelineItem";
import TimelineTop from "./TimelineTop";
export interface TimelinePostInfoEx extends TimelinePostInfo {
- deletable: boolean;
+ onDelete?: () => void;
}
export type TimelineDeleteCallback = (index: number, id: number) => void;
@@ -16,13 +16,12 @@ export interface TimelineProps {
className?: string;
style?: React.CSSProperties;
posts: TimelinePostInfoEx[];
- onDelete: TimelineDeleteCallback;
onResize?: () => void;
containerRef?: React.Ref<HTMLDivElement>;
}
const Timeline: React.FC<TimelineProps> = (props) => {
- const { posts, onDelete, onResize } = props;
+ const { posts, onResize } = props;
const [showMoreIndex, setShowMoreIndex] = React.useState<number>(-1);
@@ -42,12 +41,12 @@ const Timeline: React.FC<TimelineProps> = (props) => {
key={post.id}
current={length - 1 === index}
more={
- post.deletable
+ post.onDelete != null
? {
isOpen: showMoreIndex === index,
toggle: () =>
setShowMoreIndex((old) => (old === index ? -1 : index)),
- onDelete: () => onDelete(index, post.id),
+ onDelete: post.onDelete,
}
: undefined
}