Browse Source

refactor: move view icons to iconmap

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5343/head
Pranav C 2 years ago
parent
commit
4ed577834c
  1. 16
      packages/nc-gui/utils/iconUtils.ts
  2. 22
      packages/nc-gui/utils/viewUtils.ts

16
packages/nc-gui/utils/iconUtils.ts

@ -80,8 +80,11 @@ import MMIcon from '~icons/mdi/table-network'
import PhShareThin from '~icons/ph/share-thin' import PhShareThin from '~icons/ph/share-thin'
import PhReloadThin from '~icons/ph/arrow-clockwise-thin' import PhReloadThin from '~icons/ph/arrow-clockwise-thin'
import PhCodeThin from '~icons/ph/code-thin' import PhCodeThin from '~icons/ph/code-thin'
import PhGridNineThinThin from '~icons/ph/grid-nine-thin' import PhGridNineThin from '~icons/ph/grid-nine-thin'
import PhGridThin from '~icons/ph/grid-four-thin'
import PhComputerTowerThin from '~icons/ph/ComputerTowerThin'
import PhSquareHalfBottomThin from '~icons/ph/SquareHalfBottomThin'
import MdiMapIcon from '~icons/mdi/map-outline'
export const iconMap = { export const iconMap = {
lock: PhLockIcon, lock: PhLockIcon,
@ -146,8 +149,13 @@ export const iconMap = {
share: PhShareThin, share: PhShareThin,
reload: PhReloadThin, reload: PhReloadThin,
xml: PhCodeThin, xml: PhCodeThin,
airtable:PhGridNineThinThin, airtable: PhGridNineThin,
grid: PhGridThin,
gallery: PhImageThin,
form: PhComputerTowerThin,
map: MdiMapIcon,
kanban: PhSquareHalfBottomThin,
view: PhEyeThin,
mm: MMIcon, mm: MMIcon,
hm: HMIcon, hm: HMIcon,
bt: BTIcon, bt: BTIcon,

22
packages/nc-gui/utils/viewUtils.ts

@ -1,23 +1,17 @@
import { ViewTypes } from 'nocodb-sdk' import { ViewTypes } from 'nocodb-sdk'
import { themeV2Colors } from '#imports' import { themeV2Colors } from '#imports'
import { iconMap } from '~/utils/iconUtils'
import MdiCalendarIcon from '~icons/mdi/calendar'
import MdiMapIcon from '~icons/mdi/map-outline'
import type { Language } from '~/lib' import type { Language } from '~/lib'
import PhTableThin from '~icons/ph/TableThin'
import PhImageThin from '~icons/ph/ImageThin'
import PhComputerTowerThin from '~icons/ph/ComputerTowerThin'
import PhSquareHalfBottomThin from '~icons/ph/SquareHalfBottomThin'
import PhEyeThin from '~icons/ph/EyeThin'
export const viewIcons: Record<number | string, { icon: any; color: string }> = { export const viewIcons: Record<number | string, { icon: any; color: string }> = {
[ViewTypes.GRID]: { icon: PhTableThin, color: '#8f96f2' }, [ViewTypes.GRID]: { icon: iconMap.grid, color: '#8f96f2' },
[ViewTypes.FORM]: { icon: PhComputerTowerThin, color: themeV2Colors.pink['500'] }, [ViewTypes.FORM]: { icon: iconMap.form, color: themeV2Colors.pink['500'] },
calendar: { icon: MdiCalendarIcon, color: 'purple' }, calendar: { icon: iconMap.calendar, color: 'purple' },
[ViewTypes.GALLERY]: { icon: PhImageThin, color: 'orange' }, [ViewTypes.GALLERY]: { icon: iconMap.gallery, color: 'orange' },
[ViewTypes.MAP]: { icon: MdiMapIcon, color: 'blue' }, [ViewTypes.MAP]: { icon: iconMap.map, color: 'blue' },
[ViewTypes.KANBAN]: { icon: PhSquareHalfBottomThin, color: 'green' }, [ViewTypes.KANBAN]: { icon: iconMap.kanban, color: 'green' },
view: { icon: PhEyeThin, color: 'blue' }, view: { icon: iconMap.view, color: 'blue' },
} }
export const viewTypeAlias: Record<number, string> = { export const viewTypeAlias: Record<number, string> = {

Loading…
Cancel
Save