From 2d408eb3a70915a4f3e3410fd307202d83a7b3ba Mon Sep 17 00:00:00 2001 From: Nuwan Date: Tue, 29 Oct 2024 22:32:20 +0530 Subject: [PATCH] show generic icon image for instruments which we do not have an icon --- jam-ui/src/components/profile/JKInstrumentIcon.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jam-ui/src/components/profile/JKInstrumentIcon.js b/jam-ui/src/components/profile/JKInstrumentIcon.js index 3703105a1..f8d465cd4 100644 --- a/jam-ui/src/components/profile/JKInstrumentIcon.js +++ b/jam-ui/src/components/profile/JKInstrumentIcon.js @@ -4,12 +4,14 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; function JKInstrumentIcon({instrumentId, instrumentName}) { const InstrumentIcon = useCallback( () => { + let file; try { - const file = require(`../../icons/instruments/icon_instrument_${instrumentId.replace(/\s+/g, '_')}.svg`); - return {instrumentName} + file = require(`../../icons/instruments/icon_instrument_${instrumentId.replace(/\s+/g, '_')}.svg`); } catch (error) { - return + file = require("../../icons/instruments/icon_instrument_unknown.svg"); } + return {instrumentName} + }, [instrumentId], )