-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix: Enable actual typescript code verification (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Provide basic typings (global vars & own code) (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Fix typescript include (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Fix spool typings (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: When rendering spools data, use safer, more error resistant field access method (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Return failure on empty get spools response (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Fix Spool.filament.vendor typing (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Add spool data display formatter (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Use safe and formatted spool data in confirmation modal (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Display invalid spool warning (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Use safe and formatted spool data in selector modal (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Do not allow to select invalid spools (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Use safe and formatted spool data in sidebar list (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Use safe and formatted spool data in selector modal, current selection (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> * fix: Improve sidebar layout in edge cases (GH-43) Signed-off-by: Michał Dziekoński <[email protected]> --------- Signed-off-by: Michał Dziekoński <[email protected]>
- Loading branch information
Showing
14 changed files
with
452 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* @param {Spool} spool | ||
* @param {{ | ||
* constants: Record<string, unknown> | ||
* }} params | ||
*/ | ||
const toSpoolForDisplay = (spool, params) => { | ||
return { | ||
filament: { | ||
color: { | ||
cssProperty: ( | ||
spool.filament.color_hex | ||
? 'background-color' | ||
: 'background' | ||
), | ||
cssValue: ( | ||
spool.filament.color_hex | ||
? `#${spool.filament.color_hex}` | ||
: 'linear-gradient(45deg, #000000 -25%, #ffffff)' | ||
), | ||
}, | ||
name: ( | ||
spool.filament.name | ||
? { | ||
displayValue: spool.filament.name, | ||
} : { | ||
displayValue: "Unnamed filament", | ||
} | ||
), | ||
material: ( | ||
spool.filament.material | ||
? { | ||
displayShort: spool.filament.material, | ||
displayValue: spool.filament.material, | ||
} : { | ||
displayShort: "Unknown", | ||
displayValue: "Unknown material", | ||
} | ||
), | ||
vendor: { | ||
name: ( | ||
spool.filament.vendor?.name | ||
? { | ||
displayValue: spool.filament.vendor.name, | ||
} : { | ||
displayValue: "Unknown filament vendor", | ||
} | ||
), | ||
}, | ||
}, | ||
used_weight: { | ||
displayValue: spool.used_weight.toFixed(1), | ||
}, | ||
remaining_weight: ( | ||
spool.remaining_weight !== undefined | ||
? { | ||
isValid: true, | ||
displayValue: `${spool.remaining_weight.toFixed(1)}${params.constants['weight_unit']}`, | ||
} : { | ||
isValid: false, | ||
displayValue: "Unavailable", | ||
} | ||
), | ||
}; | ||
}; |
Oops, something went wrong.