-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathRecentEntryCold.tsx
More file actions
74 lines (63 loc) · 2.08 KB
/
Copy pathRecentEntryCold.tsx
File metadata and controls
74 lines (63 loc) · 2.08 KB
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
import { Edit } from "@mui/icons-material";
import { Grid2 } from "@mui/material";
import { ReactElement, memo } from "react";
import { Word, WritingSystem } from "api/models";
import { NoteButton } from "components/Buttons";
import { AudioSummary } from "components/WordCard";
import theme from "types/theme";
import { TypographyWithFont } from "utilities/fontComponents";
import { firstGlossText } from "utilities/wordUtilities";
const idAffix = "recent-entry";
export interface RecentEntryColdProps {
analysisLang: WritingSystem;
entry: Word;
rowIndex: number;
senseGuid: string;
}
/** Displays a recently entered word that a user cannot edit. */
export function RecentEntryCold(props: RecentEntryColdProps): ReactElement {
const sense = props.entry.senses.find((s) => s.guid === props.senseGuid);
const gloss = sense ? firstGlossText(sense, props.analysisLang.bcp47) : "";
return (
<Grid2 alignItems="center" container id={`${idAffix}-${props.rowIndex}`}>
<Grid2
size={4}
style={{ paddingInline: theme.spacing(2), position: "relative" }}
>
<TypographyWithFont vernacular>
{props.entry.vernacular}
</TypographyWithFont>
</Grid2>
<Grid2
size={4}
style={{ paddingInline: theme.spacing(2), position: "relative" }}
>
<TypographyWithFont analysis lang={props.analysisLang.bcp47}>
{gloss}
</TypographyWithFont>
</Grid2>
<Grid2
size={1}
style={{ paddingInline: theme.spacing(1), position: "relative" }}
>
{props.entry.note.text ? (
<NoteButton disabled noteText={props.entry.note.text} />
) : null}
</Grid2>
<Grid2
size={1}
style={{ paddingInline: theme.spacing(1), position: "relative" }}
>
<AudioSummary count={props.entry.audio.length} />
</Grid2>
<Grid2 size={1} />
<Grid2
size={1}
style={{ paddingInline: theme.spacing(1), position: "relative" }}
>
<Edit />
</Grid2>
</Grid2>
);
}
export default memo(RecentEntryCold);