show generic icon image for instruments which we do not have an icon
This commit is contained in:
parent
c8a8ecc40d
commit
2d408eb3a7
|
|
@ -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 <img width={25} height={25} src={file} alt={instrumentName} />
|
||||
file = require(`../../icons/instruments/icon_instrument_${instrumentId.replace(/\s+/g, '_')}.svg`);
|
||||
} catch (error) {
|
||||
return <FontAwesomeIcon icon="music" size="sm" />
|
||||
file = require("../../icons/instruments/icon_instrument_unknown.svg");
|
||||
}
|
||||
return <img width={25} height={25} src={file} alt={instrumentName} />
|
||||
|
||||
},
|
||||
[instrumentId],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue