Skip to content

Commit dbde0b6

Browse files
committed
TT-7335 Code cleanup
1 parent bb7e31d commit dbde0b6

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

src/renderer/src/components/PassageDetail/mobile/MobileWorkflowSteps.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ export default function MobileWorkflowSteps() {
6767
}
6868
};
6969

70-
const currentLabel = useMemo(() => {
71-
return workflow.find((w) => w.id === currentstep)?.label ?? '';
72-
}, [currentstep, workflow]);
70+
const currentLabel = useMemo(
71+
() => workflow.find((w) => w.id === currentstep)?.label ?? '',
72+
[currentstep, workflow]
73+
);
7374
const currentTip = useMemo(() => {
74-
if (!currentLabel) {
75-
return '';
76-
}
75+
if (!currentLabel) return '';
7776
const tipKey = toCamel(currentLabel + 'Tip');
7877
return Object.prototype.hasOwnProperty.call(t, tipKey)
7978
? t.getString(tipKey)
@@ -86,10 +85,10 @@ export default function MobileWorkflowSteps() {
8685
useLayoutEffect(() => {
8786
const el = dropdownRef.current;
8887
if (!el) return;
89-
const update = () => {
90-
const style = window.getComputedStyle(el);
91-
setDropdownWidth(el.offsetWidth + parseFloat(style.marginRight));
92-
};
88+
const update = () =>
89+
setDropdownWidth(
90+
el.offsetWidth + parseFloat(window.getComputedStyle(el).marginRight)
91+
);
9392
update();
9493
const ro = new ResizeObserver(update);
9594
ro.observe(el);
@@ -101,9 +100,7 @@ export default function MobileWorkflowSteps() {
101100

102101
useEffect(() => {
103102
const el = stepRefs.current.get(currentstep);
104-
if (!el) {
105-
return;
106-
}
103+
if (!el) return;
107104
el.scrollIntoView({
108105
behavior: didMountRef.current ? 'smooth' : 'auto',
109106
block: 'nearest',
@@ -170,11 +167,8 @@ export default function MobileWorkflowSteps() {
170167
onClick={handleSelect(step.id)}
171168
tabIndex={0}
172169
ref={(el) => {
173-
if (el) {
174-
stepRefs.current.set(step.id, el);
175-
} else {
176-
stepRefs.current.delete(step.id);
177-
}
170+
if (el) stepRefs.current.set(step.id, el);
171+
else stepRefs.current.delete(step.id);
178172
}}
179173
onKeyDown={(e) => {
180174
if (e.key === 'Enter' || e.key === ' ') {
@@ -218,7 +212,7 @@ export default function MobileWorkflowSteps() {
218212
aria-label={currentTip}
219213
>
220214
{getWfLabel(currentLabel) + '\u00A0'}
221-
<InfoIcon color={'info'} fontSize="small" />
215+
<InfoIcon color="info" fontSize="small" />
222216
</ButtonBase>
223217
) : (
224218
getWfLabel(currentLabel)

0 commit comments

Comments
 (0)