createCustomIcons.ts 640 B

12345678910111213141516171819202122
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { invert } from 'lodash-es'
  3. import { useIcons } from '#shared/components/CommonIcon/useIcons.ts'
  4. const createCustomIcons = (): Record<string, string> => {
  5. const { icons: customIcons, aliases: customIconAliases } = useIcons()
  6. const reversedCustomIconAliases = invert(customIconAliases)
  7. return Object.keys(customIcons).reduce(
  8. (icons: Record<string, string>, name) => {
  9. const alias = reversedCustomIconAliases[name]
  10. icons[alias || name] = customIcons[name]
  11. return icons
  12. },
  13. {},
  14. )
  15. }
  16. export default createCustomIcons