createCustomIcons.ts 639 B

123456789101112131415161718192021
  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