diff --git a/app/client/src/assets/icons/widget/alert.svg b/app/client/src/assets/icons/widget/alert.svg deleted file mode 100644 index 71eeb2297a..0000000000 --- a/app/client/src/assets/icons/widget/alert.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/audio-recorder.svg b/app/client/src/assets/icons/widget/audio-recorder.svg deleted file mode 100755 index 85d23c1773..0000000000 --- a/app/client/src/assets/icons/widget/audio-recorder.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/audio.svg b/app/client/src/assets/icons/widget/audio.svg deleted file mode 100644 index d6069c08b0..0000000000 --- a/app/client/src/assets/icons/widget/audio.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/button-group.svg b/app/client/src/assets/icons/widget/button-group.svg deleted file mode 100644 index 93e175d443..0000000000 --- a/app/client/src/assets/icons/widget/button-group.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/button.svg b/app/client/src/assets/icons/widget/button.svg deleted file mode 100644 index 6246b31269..0000000000 --- a/app/client/src/assets/icons/widget/button.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/camera.svg b/app/client/src/assets/icons/widget/camera.svg deleted file mode 100755 index 4057fae9ac..0000000000 --- a/app/client/src/assets/icons/widget/camera.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/chart.svg b/app/client/src/assets/icons/widget/chart.svg deleted file mode 100644 index 10b7930eb1..0000000000 --- a/app/client/src/assets/icons/widget/chart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/checkbox-group.svg b/app/client/src/assets/icons/widget/checkbox-group.svg deleted file mode 100755 index 431fada640..0000000000 --- a/app/client/src/assets/icons/widget/checkbox-group.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/checkbox.svg b/app/client/src/assets/icons/widget/checkbox.svg deleted file mode 100644 index 3c20df48ff..0000000000 --- a/app/client/src/assets/icons/widget/checkbox.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/circular-progress.svg b/app/client/src/assets/icons/widget/circular-progress.svg deleted file mode 100644 index d50c9e22b1..0000000000 --- a/app/client/src/assets/icons/widget/circular-progress.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/client/src/assets/icons/widget/collapse.svg b/app/client/src/assets/icons/widget/collapse.svg deleted file mode 100644 index 8cbcb11329..0000000000 --- a/app/client/src/assets/icons/widget/collapse.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/container.svg b/app/client/src/assets/icons/widget/container.svg deleted file mode 100644 index e7d9792336..0000000000 --- a/app/client/src/assets/icons/widget/container.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/currencyInput.svg b/app/client/src/assets/icons/widget/currencyInput.svg deleted file mode 100644 index 7da986a933..0000000000 --- a/app/client/src/assets/icons/widget/currencyInput.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/client/src/assets/icons/widget/datepicker.svg b/app/client/src/assets/icons/widget/datepicker.svg deleted file mode 100644 index caea05bfd4..0000000000 --- a/app/client/src/assets/icons/widget/datepicker.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/divider.svg b/app/client/src/assets/icons/widget/divider.svg deleted file mode 100644 index db2cc65c08..0000000000 --- a/app/client/src/assets/icons/widget/divider.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/dropdown.svg b/app/client/src/assets/icons/widget/dropdown.svg deleted file mode 100644 index 12f5d912e4..0000000000 --- a/app/client/src/assets/icons/widget/dropdown.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/embed.svg b/app/client/src/assets/icons/widget/embed.svg deleted file mode 100755 index 75d04fae11..0000000000 --- a/app/client/src/assets/icons/widget/embed.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/filepicker.svg b/app/client/src/assets/icons/widget/filepicker.svg deleted file mode 100644 index cf5335aadd..0000000000 --- a/app/client/src/assets/icons/widget/filepicker.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/form.svg b/app/client/src/assets/icons/widget/form.svg deleted file mode 100644 index 88b4c3e2e9..0000000000 --- a/app/client/src/assets/icons/widget/form.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/icon-button.svg b/app/client/src/assets/icons/widget/icon-button.svg deleted file mode 100755 index af9416caab..0000000000 --- a/app/client/src/assets/icons/widget/icon-button.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/image.svg b/app/client/src/assets/icons/widget/image.svg deleted file mode 100644 index 395ba51c3d..0000000000 --- a/app/client/src/assets/icons/widget/image.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/input.svg b/app/client/src/assets/icons/widget/input.svg deleted file mode 100644 index 889009e70e..0000000000 --- a/app/client/src/assets/icons/widget/input.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/json-form.svg b/app/client/src/assets/icons/widget/json-form.svg deleted file mode 100644 index 885be38088..0000000000 --- a/app/client/src/assets/icons/widget/json-form.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/app/client/src/assets/icons/widget/list.svg b/app/client/src/assets/icons/widget/list.svg deleted file mode 100644 index 1818ca0370..0000000000 --- a/app/client/src/assets/icons/widget/list.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/location picker.svg b/app/client/src/assets/icons/widget/location picker.svg deleted file mode 100644 index 254038ecd5..0000000000 --- a/app/client/src/assets/icons/widget/location picker.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/app/client/src/assets/icons/widget/location-picker.svg b/app/client/src/assets/icons/widget/location-picker.svg deleted file mode 100644 index 68150b62e1..0000000000 --- a/app/client/src/assets/icons/widget/location-picker.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/map-chart.svg b/app/client/src/assets/icons/widget/map-chart.svg deleted file mode 100755 index 543938a355..0000000000 --- a/app/client/src/assets/icons/widget/map-chart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/map.svg b/app/client/src/assets/icons/widget/map.svg deleted file mode 100755 index b199275976..0000000000 --- a/app/client/src/assets/icons/widget/map.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/menu-button.svg b/app/client/src/assets/icons/widget/menu-button.svg deleted file mode 100755 index 22abf1ed77..0000000000 --- a/app/client/src/assets/icons/widget/menu-button.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/menu.svg b/app/client/src/assets/icons/widget/menu.svg deleted file mode 100755 index 6f87aa9903..0000000000 --- a/app/client/src/assets/icons/widget/menu.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/modal.svg b/app/client/src/assets/icons/widget/modal.svg deleted file mode 100644 index 1f67b24e84..0000000000 --- a/app/client/src/assets/icons/widget/modal.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/multi-tree-select.svg b/app/client/src/assets/icons/widget/multi-tree-select.svg deleted file mode 100644 index 7a89adeb59..0000000000 --- a/app/client/src/assets/icons/widget/multi-tree-select.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/multiselect.svg b/app/client/src/assets/icons/widget/multiselect.svg deleted file mode 100644 index 65d9822b1d..0000000000 --- a/app/client/src/assets/icons/widget/multiselect.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/phoneInput.svg b/app/client/src/assets/icons/widget/phoneInput.svg deleted file mode 100644 index 189182612a..0000000000 --- a/app/client/src/assets/icons/widget/phoneInput.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/client/src/assets/icons/widget/plus.svg b/app/client/src/assets/icons/widget/plus.svg deleted file mode 100644 index ca280afea0..0000000000 --- a/app/client/src/assets/icons/widget/plus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/progressbar-icon.svg b/app/client/src/assets/icons/widget/progressbar-icon.svg deleted file mode 100644 index a61c2afb7d..0000000000 --- a/app/client/src/assets/icons/widget/progressbar-icon.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/client/src/assets/icons/widget/radio.svg b/app/client/src/assets/icons/widget/radio.svg deleted file mode 100644 index eb82ce4707..0000000000 --- a/app/client/src/assets/icons/widget/radio.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/rating.svg b/app/client/src/assets/icons/widget/rating.svg deleted file mode 100644 index f26f77728d..0000000000 --- a/app/client/src/assets/icons/widget/rating.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/rich-text.svg b/app/client/src/assets/icons/widget/rich-text.svg deleted file mode 100644 index fc9ce1022c..0000000000 --- a/app/client/src/assets/icons/widget/rich-text.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/single-tree-select.svg b/app/client/src/assets/icons/widget/single-tree-select.svg deleted file mode 100644 index 12f5d912e4..0000000000 --- a/app/client/src/assets/icons/widget/single-tree-select.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/slash.svg b/app/client/src/assets/icons/widget/slash.svg deleted file mode 100644 index e32936f698..0000000000 --- a/app/client/src/assets/icons/widget/slash.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/statbox.svg b/app/client/src/assets/icons/widget/statbox.svg deleted file mode 100644 index 9039aac210..0000000000 --- a/app/client/src/assets/icons/widget/statbox.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/switch-group.svg b/app/client/src/assets/icons/widget/switch-group.svg deleted file mode 100755 index c3990e16db..0000000000 --- a/app/client/src/assets/icons/widget/switch-group.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/switch.svg b/app/client/src/assets/icons/widget/switch.svg deleted file mode 100644 index bb51734a86..0000000000 --- a/app/client/src/assets/icons/widget/switch.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/table.svg b/app/client/src/assets/icons/widget/table.svg deleted file mode 100644 index fa8091c0e0..0000000000 --- a/app/client/src/assets/icons/widget/table.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/tabs.svg b/app/client/src/assets/icons/widget/tabs.svg deleted file mode 100644 index 89d70ee6f3..0000000000 --- a/app/client/src/assets/icons/widget/tabs.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/text.svg b/app/client/src/assets/icons/widget/text.svg deleted file mode 100644 index be8c0c7589..0000000000 --- a/app/client/src/assets/icons/widget/text.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/assets/icons/widget/video.svg b/app/client/src/assets/icons/widget/video.svg deleted file mode 100644 index 077b0a5628..0000000000 --- a/app/client/src/assets/icons/widget/video.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/app/client/src/components/editorComponents/Debugger/hooks/useGetEntityInfo.tsx b/app/client/src/components/editorComponents/Debugger/hooks/useGetEntityInfo.tsx index f160c37324..a6a09d8868 100644 --- a/app/client/src/components/editorComponents/Debugger/hooks/useGetEntityInfo.tsx +++ b/app/client/src/components/editorComponents/Debugger/hooks/useGetEntityInfo.tsx @@ -1,11 +1,7 @@ import { isStoredDatasource } from "entities/Action"; import { ENTITY_TYPE } from "entities/AppsmithConsole"; import { isEqual, keyBy } from "lodash"; -import { - getPluginIcon, - getWidgetIcon, - jsIcon, -} from "pages/Editor/Explorer/ExplorerIcons"; +import { getPluginIcon, jsIcon } from "pages/Editor/Explorer/ExplorerIcons"; import { useMemo, useCallback } from "react"; import { AppState } from "reducers"; import { getFilteredErrors } from "selectors/debuggerSelectors"; @@ -13,6 +9,8 @@ import { getAction, getDatasource } from "selectors/entitiesSelector"; import { useSelector } from "react-redux"; import { isAction, isJSAction, isWidget } from "workers/evaluationUtils"; import { doesEntityHaveErrors } from "../helpers"; +import React from "react"; +import WidgetIcon from "pages/Editor/Explorer/Widgets/WidgetIcon"; export const useGetEntityInfo = (name: string) => { const entity = useSelector((state: AppState) => state.evaluations.tree[name]); @@ -33,7 +31,7 @@ export const useGetEntityInfo = (name: string) => { const getEntityInfo = useCallback(() => { if (isWidget(entity)) { - const icon = getWidgetIcon(entity.type); + const icon = ; const hasError = doesEntityHaveErrors(entity.widgetId, debuggerErrors); return { diff --git a/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx b/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx index 3c2e9665ce..e351777cc7 100644 --- a/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx +++ b/app/client/src/components/editorComponents/GlobalSearch/SearchResults.tsx @@ -19,7 +19,6 @@ import { } from "./utils"; import SearchContext from "./GlobalSearchContext"; import { - getWidgetIcon, getPluginIcon, homePageIcon, pageIcon, @@ -32,6 +31,7 @@ import { AppState } from "reducers"; import { keyBy, noop } from "lodash"; import { getPageList } from "selectors/editorSelectors"; import { PluginType } from "entities/Action"; +import WidgetIcon from "pages/Editor/Explorer/Widgets/WidgetIcon"; const DocumentIcon = HelpIcons.DOCUMENT; @@ -181,14 +181,13 @@ function WidgetItem(props: { const title = getItemTitle(item); const pageName = usePageName(item.pageId); const subText = `${pageName}`; - return ( <> - {getWidgetIcon(type)} + diff --git a/app/client/src/icons/WidgetIcons.test.tsx b/app/client/src/icons/WidgetIcons.test.tsx deleted file mode 100644 index ef91c74382..0000000000 --- a/app/client/src/icons/WidgetIcons.test.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from "react"; -import { WidgetIcons } from "./WidgetIcons"; -import { render, screen } from "@testing-library/react"; - -import { ThemeProvider, theme } from "constants/DefaultTheme"; - -const ListWidgetIcon = WidgetIcons["LIST_WIDGET"]; - -describe("WidgetIcons", () => { - it("checks widget icon for list widget", () => { - render( - - - , - ); - - const input = screen.queryByTestId("list-widget-icon"); - expect(input).toBeTruthy(); - }); -}); diff --git a/app/client/src/icons/WidgetIcons.tsx b/app/client/src/icons/WidgetIcons.tsx deleted file mode 100644 index 73a86d6149..0000000000 --- a/app/client/src/icons/WidgetIcons.tsx +++ /dev/null @@ -1,301 +0,0 @@ -import React, { JSXElementConstructor } from "react"; -import styled from "styled-components"; - -import { Colors } from "constants/Colors"; -import { IconProps, IconWrapper } from "constants/IconConstants"; -import { ReactComponent as SpinnerIcon } from "assets/icons/widget/alert.svg"; -import { ReactComponent as ButtonIcon } from "assets/icons/widget/button.svg"; -import { ReactComponent as CollapseIcon } from "assets/icons/widget/collapse.svg"; -import { ReactComponent as ContainerIcon } from "assets/icons/widget/container.svg"; -import { ReactComponent as DatePickerIcon } from "assets/icons/widget/datepicker.svg"; -import { ReactComponent as TableIcon } from "assets/icons/widget/table.svg"; -import { ReactComponent as VideoIcon } from "assets/icons/widget/video.svg"; -import { ReactComponent as DropDownIcon } from "assets/icons/widget/dropdown.svg"; -import { ReactComponent as MultiSelectIcon } from "assets/icons/widget/multiselect.svg"; -import { ReactComponent as MultiSelectV2Icon } from "assets/icons/widget/multiselect.svg"; -import { ReactComponent as CheckboxIcon } from "assets/icons/widget/checkbox.svg"; -import { ReactComponent as RadioGroupIcon } from "assets/icons/widget/radio.svg"; -import { ReactComponent as InputIcon } from "assets/icons/widget/input.svg"; -import { ReactComponent as SwitchIcon } from "assets/icons/widget/switch.svg"; -import { ReactComponent as TextIcon } from "assets/icons/widget/text.svg"; -import { ReactComponent as ImageIcon } from "assets/icons/widget/image.svg"; -import { ReactComponent as FilePickerIcon } from "assets/icons/widget/filepicker.svg"; -import { ReactComponent as TabsIcon } from "assets/icons/widget/tabs.svg"; -import { ReactComponent as RichTextEditorIcon } from "assets/icons/widget/rich-text.svg"; -import { ReactComponent as ChartIcon } from "assets/icons/widget/chart.svg"; -import { ReactComponent as FormIcon } from "assets/icons/widget/form.svg"; -import { ReactComponent as MapIcon } from "assets/icons/widget/map.svg"; -import { ReactComponent as ModalIcon } from "assets/icons/widget/modal.svg"; -import { ReactComponent as ListIcon } from "assets/icons/widget/list.svg"; -import { ReactComponent as RatingIcon } from "assets/icons/widget/rating.svg"; -import { ReactComponent as EmbedIcon } from "assets/icons/widget/embed.svg"; -import { ReactComponent as DividerIcon } from "assets/icons/widget/divider.svg"; -import { ReactComponent as MenuButtonIcon } from "assets/icons/widget/menu-button.svg"; -import { ReactComponent as MultiTreeSelectIcon } from "assets/icons/widget/multi-tree-select.svg"; -import { ReactComponent as SingleTreeSelectIcon } from "assets/icons/widget/single-tree-select.svg"; -import { ReactComponent as IconButtonIcon } from "assets/icons/widget/icon-button.svg"; -import { ReactComponent as StatboxIcon } from "assets/icons/widget/statbox.svg"; -import { ReactComponent as CheckboxGroupIcon } from "assets/icons/widget/checkbox-group.svg"; -import { ReactComponent as AudioRecorderIcon } from "assets/icons/widget/audio-recorder.svg"; -import { ReactComponent as AudioIcon } from "assets/icons/widget/audio.svg"; -import { ReactComponent as ButtonGroupIcon } from "assets/icons/widget/button-group.svg"; -import { ReactComponent as ProgressBarIcon } from "assets/icons/widget/progressbar-icon.svg"; -import { ReactComponent as SwitchGroupIcon } from "assets/icons/widget/switch-group.svg"; -import { ReactComponent as CameraIcon } from "assets/icons/widget/camera.svg"; -import { ReactComponent as MapChartIcon } from "assets/icons/widget/map-chart.svg"; -import { ReactComponent as PhoneInput } from "assets/icons/widget/phoneInput.svg"; -import { ReactComponent as CurrencyInput } from "assets/icons/widget/currencyInput.svg"; -import { ReactComponent as CircularProgressIcon } from "assets/icons/widget/circular-progress.svg"; -import { ReactComponent as JSONFormIcon } from "assets/icons/widget/json-form.svg"; - -/* eslint-disable react/display-name */ - -const StyledIconWrapper = styled(IconWrapper)` - svg { - path { - fill: ${Colors.CHARCOAL} !important; - } - } -`; - -export const WidgetIcons: { - [id: string]: JSXElementConstructor; -} = { - SPINNER_WIDGET: (props: IconProps) => ( - - - - ), - BUTTON_WIDGET: (props: IconProps) => ( - - - - ), - CHECKBOX_WIDGET: (props: IconProps) => ( - - - - ), - COLLAPSE_WIDGET: (props: IconProps) => ( - - - - ), - CONTAINER_WIDGET: (props: IconProps) => ( - - - - ), - DATE_PICKER_WIDGET2: (props: IconProps) => ( - - - - ), - TABLE_WIDGET: (props: IconProps) => ( - - - - ), - VIDEO_WIDGET: (props: IconProps) => ( - - - - ), - DROP_DOWN_WIDGET: (props: IconProps) => ( - - - - ), - MULTI_SELECT_WIDGET: (props: IconProps) => ( - - - - ), - SELECT_WIDGET: (props: IconProps) => ( - - - - ), - MULTI_SELECT_WIDGET_V2: (props: IconProps) => ( - - - - ), - RADIO_GROUP_WIDGET: (props: IconProps) => ( - - - - ), - INPUT_WIDGET: (props: IconProps) => ( - - - - ), - INPUT_WIDGET_V2: (props: IconProps) => ( - - - - ), - RICH_TEXT_EDITOR_WIDGET: (props: IconProps) => ( - - - - ), - SWITCH_WIDGET: (props: IconProps) => ( - - - - ), - TEXT_WIDGET: (props: IconProps) => ( - - - - ), - IMAGE_WIDGET: (props: IconProps) => ( - - - - ), - FILE_PICKER_WIDGET_V2: (props: IconProps) => ( - - - - ), - TABS_WIDGET: (props: IconProps) => ( - - - - ), - CHART_WIDGET: (props: IconProps) => ( - - - - ), - FORM_WIDGET: (props: IconProps) => ( - - - - ), - MAP_WIDGET: (props: IconProps) => ( - - - - ), - MODAL_WIDGET: (props: IconProps) => ( - - - - ), - FORM_BUTTON_WIDGET: (props: IconProps) => ( - - - - ), - LIST_WIDGET: (props: IconProps) => ( - - - - ), - RATE_WIDGET: (props: IconProps) => ( - - - - ), - IFRAME_WIDGET: (props: IconProps) => ( - - - - ), - DIVIDER_WIDGET: (props: IconProps) => ( - - - - ), - MENU_BUTTON_WIDGET: (props: IconProps) => ( - - - - ), - SINGLE_SELECT_TREE_WIDGET: (props: IconProps) => ( - - - - ), - MULTI_SELECT_TREE_WIDGET: (props: IconProps) => ( - - - - ), - ICON_BUTTON_WIDGET: (props: IconProps) => ( - - - - ), - STATBOX_WIDGET: (props: IconProps) => ( - - - - ), - CHECKBOX_GROUP_WIDGET: (props: IconProps) => ( - - - - ), - AUDIO_RECORDER_WIDGET: (props: IconProps) => ( - - - - ), - AUDIO_WIDGET: (props: IconProps) => ( - - - - ), - BUTTON_GROUP_WIDGET: (props: IconProps) => ( - - - - ), - PROGRESSBAR_WIDGET: (props: IconProps) => ( - - - - ), - SWITCH_GROUP_WIDGET: (props: IconProps) => ( - - - - ), - CAMERA_WIDGET: (props: IconProps) => ( - - - - ), - MAP_CHART_WIDGET: (props: IconProps) => ( - - - - ), - PHONE_INPUT_WIDGET: (props: IconProps) => ( - - - - ), - CURRENCY_INPUT_WIDGET: (props: IconProps) => ( - - - - ), - CIRCULAR_PROGRESS_WIDGET: (props: IconProps) => ( - - - - ), - JSON_FORM_WIDGET: (props: IconProps) => ( - - - - ), -}; - -export type WidgetIcon = typeof WidgetIcons[keyof typeof WidgetIcons]; diff --git a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx index ff6fb0da5c..74da518721 100644 --- a/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx +++ b/app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx @@ -1,8 +1,6 @@ import React, { ReactNode } from "react"; import { MenuIcons } from "icons/MenuIcons"; import { Colors } from "constants/Colors"; -import { WidgetType } from "constants/WidgetConstants"; -import { WidgetIcons } from "icons/WidgetIcons"; import { Plugin } from "api/PluginApi"; import ImageAlt from "assets/images/placeholder-image.svg"; import styled from "styled-components"; @@ -151,13 +149,6 @@ export const DATASOURCE_FIELD_ICONS_MAP: Record = { [FOREIGN_KEY]: foreignKeyIcon, }; -export const getWidgetIcon = (type: WidgetType) => { - const WidgetIcon = WidgetIcons[type]; - if (WidgetIcon) - return ; - return null; -}; - const PluginIcon = styled.img` height: ${ENTITY_ICON_SIZE}px; width: ${ENTITY_ICON_SIZE}px; diff --git a/app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx b/app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx index d771dd37bf..799390f88a 100644 --- a/app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx +++ b/app/client/src/pages/Editor/Explorer/Widgets/WidgetEntity.tsx @@ -4,12 +4,12 @@ import { WidgetProps } from "widgets/BaseWidget"; import { WidgetType } from "constants/WidgetConstants"; import { useSelector } from "react-redux"; import { AppState } from "reducers"; -import { getWidgetIcon } from "../ExplorerIcons"; import WidgetContextMenu from "./WidgetContextMenu"; import { updateWidgetName } from "actions/propertyPaneActions"; import { CanvasStructure } from "reducers/uiReducers/pageCanvasStructureReducer"; import { getSelectedWidget, getSelectedWidgets } from "selectors/ui"; import { useNavigateToWidget } from "./useNavigateToWidget"; +import WidgetIcon from "./WidgetIcon"; export type WidgetTree = WidgetProps & { children?: WidgetTree[] }; @@ -80,6 +80,7 @@ export const WidgetEntity = memo((props: WidgetEntityProps) => { const widgetsToExpand = useSelector( (state: AppState) => state.ui.widgetDragResize.selectedWidgetAncestry, ); + const icon = ; const shouldExpand = widgetsToExpand.includes(props.widgetId); @@ -129,7 +130,7 @@ export const WidgetEntity = memo((props: WidgetEntityProps) => { contextMenu={showContextMenu && contextMenu} entityId={props.widgetId} highlight={lastSelectedWidget === props.widgetId} - icon={getWidgetIcon(props.widgetType)} + icon={icon} isDefaultExpanded={ shouldExpand || (!!props.searchKeyword && !!props.childWidgets) || diff --git a/app/client/src/pages/Editor/Explorer/Widgets/WidgetIcon.tsx b/app/client/src/pages/Editor/Explorer/Widgets/WidgetIcon.tsx new file mode 100644 index 0000000000..6e1dae2c12 --- /dev/null +++ b/app/client/src/pages/Editor/Explorer/Widgets/WidgetIcon.tsx @@ -0,0 +1,26 @@ +import { IconWrapper } from "constants/IconConstants"; +import { WidgetType } from "constants/WidgetConstants"; +import React from "react"; +import { useSelector } from "react-redux"; +import { getWidgetConfigs } from "selectors/editorSelectors"; +import { ENTITY_ICON_SIZE } from "../ExplorerIcons"; + +function WidgetIcon(props: { + type: WidgetType; + width?: number; + height?: number; +}) { + const { height = ENTITY_ICON_SIZE, type, width = ENTITY_ICON_SIZE } = props; + const widgetConfig = useSelector(getWidgetConfigs); + if (!type) return null; + const svg = widgetConfig.config[type].iconSVG; + if (svg) + return ( + + + + ); + return null; +} + +export default WidgetIcon; diff --git a/app/client/src/selectors/editorSelectors.tsx b/app/client/src/selectors/editorSelectors.tsx index 53e1638454..543187f39e 100644 --- a/app/client/src/selectors/editorSelectors.tsx +++ b/app/client/src/selectors/editorSelectors.tsx @@ -36,7 +36,8 @@ import { PLACEHOLDER_APP_SLUG, PLACEHOLDER_PAGE_SLUG } from "constants/routes"; import { builderURL } from "RouteBuilder"; import { ApplicationVersion } from "actions/applicationActions"; -const getWidgetConfigs = (state: AppState) => state.entities.widgetConfig; +export const getWidgetConfigs = (state: AppState) => + state.entities.widgetConfig; const getPageListState = (state: AppState) => state.entities.pageList; export const getProviderCategories = (state: AppState) => diff --git a/app/client/src/widgets/FormButtonWidget/icon.svg b/app/client/src/widgets/FormButtonWidget/icon.svg index 8acae73d9a..6246b31269 100644 --- a/app/client/src/widgets/FormButtonWidget/icon.svg +++ b/app/client/src/widgets/FormButtonWidget/icon.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file