blob: abc3d0c94639fc90b0f68bf160e2a1801a1c4571 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
import React from "react";
import { useTranslation } from "react-i18next";
import { Dropdown, Button } from "react-bootstrap";
import { useAvatar } from "@/services/user";
import { timelineVisibilityTooltipTranslationMap } from "@/services/timeline";
import BlobImage from "../common/BlobImage";
import { TimelineCardComponentProps } from "../timeline-common/TimelinePageTemplateUI";
import InfoCardTemplate from "../timeline-common/InfoCardTemplate";
export type OrdinaryTimelineManageItem = "delete";
export type TimelineInfoCardProps = TimelineCardComponentProps<
OrdinaryTimelineManageItem
>;
const TimelineInfoCard: React.FC<TimelineInfoCardProps> = (props) => {
const {
timeline,
collapse,
onMember,
onManage,
syncStatus,
toggleCollapse,
} = props;
const { t } = useTranslation();
const avatar = useAvatar(timeline?.owner?.username);
return (
<InfoCardTemplate
className={props.className}
syncStatus={syncStatus}
collapse={collapse}
toggleCollapse={toggleCollapse}
>
<h3 className="text-primary mx-3 d-inline-block align-middle">
{timeline.title}
<small className="ml-3 text-secondary">{timeline.name}</small>
</h3>
<div className="align-middle">
<BlobImage blob={avatar} className="avatar small rounded-circle mr-3" />
{timeline.owner.nickname}
<small className="ml-3 text-secondary">
@{timeline.owner.username}
</small>
</div>
<p className="mb-0">{timeline.description}</p>
<small className="mt-1 d-block">
{t(timelineVisibilityTooltipTranslationMap[timeline.visibility])}
</small>
<div className="text-right mt-2">
{onManage != null ? (
<Dropdown>
<Dropdown.Toggle variant="outline-primary">
{t("timeline.manage")}
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item onClick={() => onManage("property")}>
{t("timeline.manageItem.property")}
</Dropdown.Item>
<Dropdown.Item onClick={onMember}>
{t("timeline.manageItem.member")}
</Dropdown.Item>
<Dropdown.Divider />
<Dropdown.Item
className="text-danger"
onClick={() => onManage("delete")}
>
{t("timeline.manageItem.delete")}
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
) : (
<Button variant="outline-primary" onClick={onMember}>
{t("timeline.memberButton")}
</Button>
)}
</div>
</InfoCardTemplate>
);
};
export default TimelineInfoCard;
|