Skip to content

Commit b441fec

Browse files
committed
fix(afc): Address PR review comments in AfcCardUnitLaneBody
- Add `rel="noopener noreferrer"` to external Spoolman link to prevent reverse-tabnabbing via `target="_blank"` - Keep `!this.spoolId` guard in `spoolUrl` — spool ID `0` is invalid in Spoolman so the falsy check is correct and consistent with `spool` getter - Replace hard-coded English strings in tooltip with i18n keys (`app.afc.WeightRemaining`, `app.afc.WeightUsed`); fix `spoolUsedWeight` guard from truthy to `!= null` so `0 g used` is displayed correctly Signed-off-by: paxx12 <245230251+paxx12@users.noreply.github.com>
1 parent fbed6a9 commit b441fec

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/components/widgets/afc/AfcCardUnitLaneBody.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
</template>
3737
<template v-if="spoolRemainingWeight != null">
3838
<br>
39-
{{ Math.round(spoolRemainingWeight) }} g remaining
40-
<template v-if="spoolUsedWeight">
41-
({{ Math.round(spoolUsedWeight) }} g used)
39+
{{ $t('app.afc.WeightRemaining', { weight: Math.round(spoolRemainingWeight) }) }}
40+
<template v-if="spoolUsedWeight != null">
41+
({{ $t('app.afc.WeightUsed', { weight: Math.round(spoolUsedWeight) }) }})
4242
</template>
4343
</template>
4444
</span>
@@ -106,6 +106,7 @@
106106
v-if="spoolUrl"
107107
:href="spoolUrl"
108108
target="_blank"
109+
rel="noopener noreferrer"
109110
class="position-absolute text-truncate text-truncate-element text-center text-decoration-none filament-link"
110111
>{{ spoolFilamentName }}</a>
111112
<span

src/locales/en.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ app:
8787
Unloading: "Unloading"
8888
UnloadLane: "Unload Lane"
8989
Weight: "Weight"
90+
WeightRemaining: "{weight} g remaining"
9091
WeightSubtitle: "The weight of the filament in grams (without spool)."
92+
WeightUsed: "{weight} g used"
9193
bedmesh:
9294
label:
9395
active: active

0 commit comments

Comments
 (0)