CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/chat/time.tsx
Views: 687
1
import { TimeAgo } from "@cocalc/frontend/components";
2
import { IS_TOUCH } from "@cocalc/frontend/feature";
3
import { ChatMessageTyped } from "./types";
4
5
interface Props {
6
message: ChatMessageTyped;
7
edit: (event) => void;
8
}
9
10
export function Time({ message, edit }: Props) {
11
// We make click on the timestamp edit the chat since onDoubleClick is completely
12
// ignored on mobile touch devices...
13
return (
14
<span
15
onClick={IS_TOUCH && edit != null ? edit : undefined}
16
className="pull-right small"
17
style={{
18
maxWidth: "20%",
19
whiteSpace: "nowrap",
20
overflow: "hidden",
21
textOverflow: "ellipsis",
22
cursor: "pointer",
23
}}
24
>
25
<TimeAgo date={new Date(message.get("date"))} />
26
</span>
27
);
28
}
29
30