Skip to content

Commit bdc395f

Browse files
Copilotimnasnainaec
andcommitted
Address code review feedback
- Move tooltip text construction inside conditional block to avoid unnecessary computation - Replace inline styles with sx prop for consistency with MUI patterns - Remove unused theme import Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
1 parent 65df42d commit bdc395f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/goals/MergeDuplicates/MergeDupsCompleted.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import SenseCardContent from "goals/MergeDuplicates/MergeDupsStep/SenseCardConte
2323
import { protectReasonsText } from "goals/MergeDuplicates/MergeDupsStep/protectReasonUtils";
2424
import { MergesCompleted } from "goals/MergeDuplicates/MergeDupsTypes";
2525
import { type StoreState } from "rootRedux/types";
26-
import theme from "types/theme";
2726
import { newFlag } from "types/word";
2827
import { TypographyWithFont } from "utilities/fontComponents";
2928

@@ -133,13 +132,6 @@ function WordBox(props: { wordId: string }): ReactElement {
133132
const audioCount = word?.audio?.length ?? 0;
134133
const noteText = word?.note?.text ?? "";
135134

136-
// Build tooltip lines for protected entry
137-
const tooltipTexts = [t("mergeDups.helpText.protectedWord")];
138-
if (isProtected) {
139-
tooltipTexts.push(protectReasonsText(t, { word: word?.protectReasons }));
140-
}
141-
tooltipTexts.push(t("mergeDups.helpText.protectedWordInfo"));
142-
143135
const headerTitle = (
144136
<TypographyWithFont variant="h5" vernacular>
145137
{word?.vernacular}
@@ -154,7 +146,15 @@ function WordBox(props: { wordId: string }): ReactElement {
154146
icon={<WarningOutlined />}
155147
side="top"
156148
size="small"
157-
text={<MultilineTooltipTitle lines={tooltipTexts} />}
149+
text={
150+
<MultilineTooltipTitle
151+
lines={[
152+
t("mergeDups.helpText.protectedWord"),
153+
protectReasonsText(t, { word: word?.protectReasons }),
154+
t("mergeDups.helpText.protectedWordInfo"),
155+
]}
156+
/>
157+
}
158158
/>
159159
)}
160160
<AudioSummary count={audioCount} />
@@ -168,11 +168,11 @@ function WordBox(props: { wordId: string }): ReactElement {
168168
<Card sx={{ bgcolor: "lightgrey", pb: 1 }}>
169169
<CardHeader
170170
action={headerAction}
171-
style={{
172-
backgroundColor: isProtected ? "lightyellow" : "white",
171+
sx={{
172+
bgcolor: isProtected ? "lightyellow" : "white",
173173
minHeight: 44,
174174
minWidth: 150,
175-
padding: theme.spacing(1),
175+
p: 1,
176176
}}
177177
title={headerTitle}
178178
/>

0 commit comments

Comments
 (0)