From 6c3f3cf326c31b3bd2aa8931c169c86238d9ad88 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Tue, 12 Dec 2023 12:20:09 +0530 Subject: [PATCH 1/3] refactor: dead code removal. (#92) --- src/components/MultiLineInputBox.res | 140 - src/components/NProgressIndicator.res | 6 - src/components/Navbar.res | 100 - src/components/NewCalendarList.res | 12 - src/components/NewDateRangePicker.res | 2 +- src/components/NewPagination.res | 7 - src/components/NoDataFound.res | 14 +- src/components/NoteUI.res | 8 - src/components/Pagination.res | 6 - src/components/PaginationRevamp.res | 203 -- src/components/PopOver.res | 50 - src/components/RedirectSearchInput.res | 11 - src/components/RemoteFiltersUtils.res | 168 +- src/components/RouterTabs.res | 68 - src/components/SDKFunnelChart.res | 732 ----- src/components/SankeyUtils.res | 37 +- src/components/SectionAccordion.res | 105 - src/components/ServerComponent.res | 14 - src/components/SidebarStyleUtils.res | 55 - src/components/StagedProgressBar.res | 93 - src/components/StaticTable.res | 211 -- src/components/SynchronizedCharts.res | 294 -- src/components/ThemeSelector.res | 82 - src/components/ThemeToggle.res | 41 - src/components/TimeInput.res | 17 - src/components/TimeRangeInput.res | 242 -- src/components/TimeRangeInputUtils.res | 33 - src/components/Timer.res | 27 - src/components/TopActions.res | 146 - src/components/UploadImage.res | 50 - .../hyperswitch/HyperSwitchApp.res | 11 +- src/genericUtils/AtomsStorage.res | 8 - src/genericUtils/BreadCrumbNavigation.res | 2 - src/genericUtils/UseEvent.res | 12 - src/hooks/AnalyticsHooks.res | 174 - src/hooks/AuthHooks.res | 227 +- src/hooks/DateRefreshHooks.res | 2 +- src/hooks/ModalsState.res | 13 - src/hooks/NewThemeHooks.res | 42 - .../AnalyticsCommonComponents.res | 2809 ----------------- 40 files changed, 31 insertions(+), 6243 deletions(-) delete mode 100644 src/components/MultiLineInputBox.res delete mode 100644 src/components/NProgressIndicator.res delete mode 100644 src/components/NoteUI.res delete mode 100644 src/components/PaginationRevamp.res delete mode 100644 src/components/PopOver.res delete mode 100644 src/components/RouterTabs.res delete mode 100644 src/components/SDKFunnelChart.res delete mode 100644 src/components/SectionAccordion.res delete mode 100644 src/components/ServerComponent.res delete mode 100644 src/components/SidebarStyleUtils.res delete mode 100644 src/components/StagedProgressBar.res delete mode 100644 src/components/StaticTable.res delete mode 100644 src/components/SynchronizedCharts.res delete mode 100644 src/components/ThemeSelector.res delete mode 100644 src/components/ThemeToggle.res delete mode 100644 src/components/TimeRangeInput.res delete mode 100644 src/components/TimeRangeInputUtils.res delete mode 100644 src/components/Timer.res delete mode 100644 src/components/TopActions.res delete mode 100644 src/components/UploadImage.res delete mode 100644 src/genericUtils/AtomsStorage.res delete mode 100644 src/hooks/NewThemeHooks.res delete mode 100644 src/screens/analyticsScreens/AnalyticsCommonComponents.res diff --git a/src/components/MultiLineInputBox.res b/src/components/MultiLineInputBox.res deleted file mode 100644 index 166cffabc..000000000 --- a/src/components/MultiLineInputBox.res +++ /dev/null @@ -1,140 +0,0 @@ -@react.component -let make = ( - ~input: ReactFinalForm.fieldRenderPropsInput, - ~placeholder, - ~isDisabled, - ~rows=?, - ~cols=?, - ~customClass="", - ~readOnly=?, - ~maxLength=?, - ~class="", - ~roundedBorder=false, - ~prefix=?, - ~handleRemove=_ => (), - ~setShow=_ => (), -) => { - let (focus, setFocus) = React.useState(_ => false) - let (error, setError) = React.useState(_ => None) - let cursorClass = if isDisabled { - "cursor-not-allowed" - } else { - "" - } - - let handleRemove = _ => { - input.onChange(""->Identity.stringToFormReactEvent) - setError(_ => None) - setFocus(_ => false) - handleRemove() - } - - let className = `rounded-md border border-jp-gray-lightmode_steelgray border-opacity-75 font-normal p-2 text-jp-gray-900 text-opacity-75 placeholder-jp-gray-900 placeholder-opacity-25 hover:bg-jp-gray-lightmode_steelgray hover:bg-opacity-20 hover:border-jp-gray-900 hover:border-opacity-20 focus:text-opacity-100 focus:outline-none focus:border-blue-800 focus:border-opacity-100 dark:text-jp-gray-text_darktheme dark:text-opacity-75 dark:border-jp-gray-960 dark:hover:border-jp-gray-960 dark:hover:bg-jp-gray-970 dark:bg-jp-gray-darkgray_background dark:placeholder-jp-gray-text_darktheme dark:placeholder-opacity-25 dark:focus:text-opacity-100 dark:focus:border-blue-800 ${cursorClass} ${customClass}` - let value = switch input.value->Js.Json.classify { - | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString - | _ => "" - } - - let onBlur = _ => { - let value = value->Js_string.trim - - let lengthError = - maxLength->Belt.Option.flatMap(length => - value->Js_string.length <= length - ? None - : Some(`Maximum length should be ${length->Belt.Int.toString}`) - ) - - let error = lengthError - - if value === "" || error->Belt.Option.isNone { - setFocus(_ => false) - input.onChange(value->Identity.stringToFormReactEvent) - setShow(_ => false) - } else { - setError(_ => error) - setShow(_ => false) - } - } - - let isError = error->Belt.Option.isSome - - let borderColor = isError - ? "border rounded-md border-red-600 dark:border-red-600" - : focus - ? "border-opacity-100 border-blue-800" - : roundedBorder - ? "border-gray-300 dark:border-jp-gray-800" - : "border-opacity-75 border-gray-300 dark:border-jp-gray-800" - - let textAreaComponent = -