Skip to content

Commit

Permalink
merge branch: synced with main
Browse files Browse the repository at this point in the history
  • Loading branch information
Riddhiagrawal001 committed Jul 22, 2024
2 parents 946cd3f + c40b0d5 commit 6cc3b12
Show file tree
Hide file tree
Showing 140 changed files with 598 additions and 647 deletions.
4 changes: 2 additions & 2 deletions src/components/Accordion.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ module SectionAccordion = {
<AddDataAttributes attributes=[("data-section", title)]>
<div className={`border md:border-0 dark:border-jp-gray-950 ${headerBg}`}>
<DesktopView>
<UIUtils.RenderIf condition={!hideHeaderWeb}>
<RenderIf condition={!hideHeaderWeb}>
<h3 className={`text-base ${headingClass}`}> {title->React.string} </h3>
</UIUtils.RenderIf>
</RenderIf>
<p
className="text-gray-900 text-opacity-50 dark:text-jp-gray-text_darktheme dark:text-opacity-50">
{subtext->React.string}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Button.res
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,11 @@ let make = (
}}
{switch buttonRightText {
| Some(text) =>
<UIUtils.RenderIf condition={!(text->LogicUtils.isEmptyString)}>
<RenderIf condition={!(text->LogicUtils.isEmptyString)}>
<span className="text-jp-2-light-primary-600 font-semibold text-fs-14">
{React.string(text)}
</span>
</UIUtils.RenderIf>
</RenderIf>
| None => React.null
}}
{switch rightIcon {
Expand Down
1 change: 0 additions & 1 deletion src/components/Chip.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@react.component
let make = (~values=[], ~showButton=false, ~onButtonClick=_ => (), ~converterFn=str => str) => {
open UIUtils
<RenderIf condition={values->Array.length !== 0}>
<div className="flex flex-wrap flex-row">
{values
Expand Down
1 change: 0 additions & 1 deletion src/components/CollapsableTableRow.res
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let make = (
~heading,
~title,
) => {
open UIUtils
let isCurrentRowExpanded = expandedRowIndexArray->Array.includes(rowIndex)
let headingArray = []

Expand Down
4 changes: 2 additions & 2 deletions src/components/CustomCharts/FunnelChart.res
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let make = (
</div>
| None => React.null
}}
<UIUtils.RenderIf condition={someData}>
<RenderIf condition={someData}>
<div className="flex flex-col">
<div className="flex gap-6 justify-end">
<div className={`flex flex-col ${widthClass}`} />
Expand Down Expand Up @@ -188,6 +188,6 @@ let make = (
</div>
</div>
</div>
</UIUtils.RenderIf>
</RenderIf>
</div>
}
4 changes: 2 additions & 2 deletions src/components/CustomCharts/HighchartTimeSeriesChart.res
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ module LineChart1D = {
<HighchartsReact highcharts={highchartsModule} options key={chartKey} />
</div>
</AddDataAttributes>
<UIUtils.RenderIf condition={showTableLegend && isMobileView}>
<RenderIf condition={showTableLegend && isMobileView}>
<div
className="flex flex-row items-center gap-2 w-fit self-end cursor-pointer mr-5 mb-2"
onClick={_ => {setHideLegend(prev => !prev)}}>
Expand All @@ -705,7 +705,7 @@ module LineChart1D = {
className="text-neutral-400"
/>
</div>
</UIUtils.RenderIf>
</RenderIf>
{if showTableLegend && !hideLegend {
<div className={`${tableWidth} pl-5 pt-0 min-w-max`}>
<LoadedTable
Expand Down
1 change: 0 additions & 1 deletion src/components/CustomExpandableTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ let make = (
~getRowDetails,
~showSerial=false,
) => {
open UIUtils
if showSerial {
heading->Array.unshift(makeHeaderInfo(~key="serial_number", ~title="S.No", ()))->ignore
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DesktopView.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
let make = (~children) => {
let isMobileView = MatchMedia.useMobileChecker()

<UIUtils.RenderIf condition={!isMobileView}> children </UIUtils.RenderIf>
<RenderIf condition={!isMobileView}> children </RenderIf>
}
4 changes: 2 additions & 2 deletions src/components/DynamicChart.res
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ let make = (
<Shimmer styleClass="w-full h-96 dark:bg-black bg-white" shimmerType={Big} />
} else if comparitionWidget {
<div>
<UIUtils.RenderIf condition={featureFlagDetails.granularity}>
<RenderIf condition={featureFlagDetails.granularity}>
<div className="w-full flex justify-end p-2">
<GranularitySelectBox
selectedGranularity
Expand All @@ -830,7 +830,7 @@ let make = (
endTime={endTimeFromUrl}
/>
</div>
</UIUtils.RenderIf>
</RenderIf>
{entityAllMetrics
->Array.mapWithIndex((selectedMetrics, index) => {
switch uriConfig->Array.get(0) {
Expand Down
1 change: 0 additions & 1 deletion src/components/DynamicSingleStat.res
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ let make = (
~wrapperClass=?,
~formaPayload: option<singleStatBodyEntity => string>=?,
) => {
open UIUtils
open LogicUtils
let {filterValueJson} = React.useContext(FilterContext.filterContext)
let fetchApi = AuthHooks.useApiFetcher()
Expand Down
4 changes: 2 additions & 2 deletions src/components/DynamicTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ let make = (
} else {
React.null
}}
<UIUtils.RenderIf condition=showRemoteFilter>
<RenderIf condition=showRemoteFilter>
<LabelVisibilityContext showLabel=false>
<Filter
defaultFilters=entity.defaultFilters
Expand All @@ -359,7 +359,7 @@ let make = (
showSelectFiltersSearch=showFiltersSearch
/>
</LabelVisibilityContext>
</UIUtils.RenderIf>
</RenderIf>
</div>
if isFiltersInPortal {
<Portal to=portalKey> {children} </Portal>
Expand Down
4 changes: 2 additions & 2 deletions src/components/DynamicTableUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ module TableLoadingErrorIndicator = {
}

<div className={`flex flex-col w-full`}>
<UIUtils.RenderIf condition={!hideTitle}>
<RenderIf condition={!hideTitle}>
<TableHeading title />
</UIUtils.RenderIf>
</RenderIf>
<TableFilterSectionContext isFilterSection=true>
<div className=filtersBorder> {filters} </div>
</TableFilterSectionContext>
Expand Down
15 changes: 7 additions & 8 deletions src/components/DynamicTabs.res
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module TabInfo = {
let borderClass = ""

let lineStyle = "bg-black w-full h-0.5 rounded-full"
open UIUtils

let crossIcon = switch isRemovable {
| true =>
<svg
Expand Down Expand Up @@ -169,7 +169,6 @@ module TabInfo = {
module IndicationArrow = {
@react.component
let make = (~iconName, ~side, ~refElement: React.ref<Js.nullable<Dom.element>>, ~isVisible) => {
open UIUtils
let isMobileView = MatchMedia.useMobileChecker()
let onClick = {
_ev =>
Expand Down Expand Up @@ -526,11 +525,11 @@ let make = (
<div className={isMobileView ? `sticky top-0 z-15 ${bgClass}` : ""}>
<ErrorBoundary>
<div className="py-0 flex flex-row">
<UIUtils.RenderIf condition={!isMobileView}>
<RenderIf condition={!isMobileView}>
<IndicationArrow
iconName="caret-left" side="left" refElement=firstTabRef isVisible=isLeftArrowVisible
/>
</UIUtils.RenderIf>
</RenderIf>
<div
className={`overflow-x-auto no-scrollbar overflow-y-hidden ${outerAllignmentClass}`}
ref={scrollRef->ReactDOM.Ref.domRef}
Expand Down Expand Up @@ -578,15 +577,15 @@ let make = (
</div>
</div>
<div className="flex flex-row">
<UIUtils.RenderIf condition={!isMobileView}>
<RenderIf condition={!isMobileView}>
<IndicationArrow
iconName="caret-right"
side="right"
refElement=lastTabRef
isVisible=isRightArrowVisible
/>
</UIUtils.RenderIf>
<UIUtils.RenderIf condition={showAddMoreTabs && formattedOptions->Array.length > 0}>
</RenderIf>
<RenderIf condition={showAddMoreTabs && formattedOptions->Array.length > 0}>
<div
className="flex flex-row"
style={ReactDOMStyle.make(~marginTop="20px", ~marginLeft="7px", ())}>
Expand All @@ -604,7 +603,7 @@ let make = (
tooltipWidthClass="w-fit"
/>
</div>
</UIUtils.RenderIf>
</RenderIf>
</div>
</div>
<SelectModal
Expand Down
25 changes: 12 additions & 13 deletions src/components/Filter.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module ClearFilters = {
->Array.length > 0
}, (formState.initialValues, defaultFilterKeys))
let text = "Clear All"
<UIUtils.RenderIf condition={hasExtraFilters || outsidefilter}>
<RenderIf condition={hasExtraFilters || outsidefilter}>
<Button
text
customButtonStyle="bg-white rounded-lg !p-2 !h-10 !border mt-3"
Expand All @@ -77,7 +77,7 @@ module ClearFilters = {
onClick=handleClearFilter
buttonType={Secondary}
/>
</UIUtils.RenderIf>
</RenderIf>
}
}

Expand Down Expand Up @@ -296,14 +296,14 @@ let make = (
<div>
<div className={`flex gap-3 items-center flex-wrap ${verticalGap}`}>
{customLeftView}
<UIUtils.RenderIf condition={fixedFilters->Array.length > 0}>
<RenderIf condition={fixedFilters->Array.length > 0}>
<FormRenderer.FieldsRenderer
fields={fixedFilters->Array.map(item => item.field)}
labelClass="hidden"
fieldWrapperClass="p-0"
/>
</UIUtils.RenderIf>
<UIUtils.RenderIf condition={allFilters->Array.length > 0}>
</RenderIf>
<RenderIf condition={allFilters->Array.length > 0}>
<Menu \"as"="div" className="relative inline-block text-left">
{_menuProps =>
<div>
Expand Down Expand Up @@ -344,22 +344,21 @@ let make = (
}
`${activeClasses} font-medium`
}>
<UIUtils.RenderIf
<RenderIf
condition={option.label->LogicUtils.isNonEmptyString}>
<div className="mr-5">
{option.label->LogicUtils.snakeToTitle->React.string}
</div>
</UIUtils.RenderIf>
<UIUtils.RenderIf
condition={option.label->LogicUtils.isEmptyString}>
</RenderIf>
<RenderIf condition={option.label->LogicUtils.isEmptyString}>
<div className="mr-5">
{option.inputNames
->Array.get(0)
->Option.getOr("")
->LogicUtils.snakeToTitle
->React.string}
</div>
</UIUtils.RenderIf>
</RenderIf>
</button>
</div>}
</Menu.Item>
Expand All @@ -372,15 +371,15 @@ let make = (
</Transition>
</div>}
</Menu>
</UIUtils.RenderIf>
</RenderIf>
</div>
<div className="flex gap-3 flex-wrap">
<FormRenderer.FieldsRenderer
fields={filterList} labelClass="hidden" fieldWrapperClass="p-0 mt-3"
/>
<UIUtils.RenderIf condition={count > 0}>
<RenderIf condition={count > 0}>
<ClearFilters defaultFilterKeys ?clearFilters outsidefilter={initalCount > 0} />
</UIUtils.RenderIf>
</RenderIf>
</div>
</div>
</AddDataAttributes>}
Expand Down
18 changes: 9 additions & 9 deletions src/components/FilterSelectBox.res
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ module BaseSelect = {
{if showSelectAll && isDropDown {
if !isMobileView {
let clearAllCondition = noOfSelected > 0
<UIUtils.RenderIf
<RenderIf
condition={filteredOptions->Array.length > 1 &&
filteredOptions->Array.find(item => item.value === "Loading...")->Option.isNone}>
<div
Expand All @@ -713,7 +713,7 @@ module BaseSelect = {
/>
{{clearAllCondition ? "Clear All" : "Select All"}->React.string}
</div>
</UIUtils.RenderIf>
</RenderIf>
} else {
<div
onClick={selectAll(noOfSelected !== options->Array.length)}
Expand Down Expand Up @@ -1101,14 +1101,14 @@ module RenderListItemInBaseRadio = {
| Some(str) =>
<div key={i->Int.toString} className="flex flex-row">
listItemComponent
<UIUtils.RenderIf condition={!isHorizontal}>
<RenderIf condition={!isHorizontal}>
<ToolTip
description={str}
toolTipFor={<div className="py-4 px-4">
<Icon size=12 name="info-circle" />
</div>}
/>
</UIUtils.RenderIf>
</RenderIf>
</div>
| None => listItemComponent
}
Expand Down Expand Up @@ -1331,11 +1331,11 @@ module BaseRadio = {
? "animate-textTransition transition duration-400"
: "animate-textTransitionOff transition duration-400"}`}>
{switch searchable {
| Some(val) => <UIUtils.RenderIf condition={val}> searchInputUI </UIUtils.RenderIf>
| Some(val) => <RenderIf condition={val}> searchInputUI </RenderIf>
| None =>
<UIUtils.RenderIf condition={isDropDown && (options->Array.length > 5 || addDynamicValue)}>
<RenderIf condition={isDropDown && (options->Array.length > 5 || addDynamicValue)}>
searchInputUI
</UIUtils.RenderIf>
</RenderIf>
}}
<div
className={`${maxHeight} ${listPadding} ${overflowClass} text-jp-2-gray-300 text-fs-14 font-medium"
Expand Down Expand Up @@ -1871,12 +1871,12 @@ module BaseDropdown = {
{selectButtonText->React.string}
</div>
{buttonIcon}
<UIUtils.RenderIf condition={badgeForSelect.color === BadgeBlue}>
<RenderIf condition={badgeForSelect.color === BadgeBlue}>
<div
className="px-2 py-0.5 bg-blue-500 rounded-lg text-white text-sm font-medium leading-5 mx-1 h-fit">
{badgeForSelect.value->React.string}
</div>
</UIUtils.RenderIf>
</RenderIf>
</div>

<div
Expand Down
8 changes: 4 additions & 4 deletions src/components/HSwitchSingleStatTableWidget.res
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,11 @@ let make = (
<div
className={`h-full flex flex-col border ${borderRounded} dark:border-jp-gray-850 bg-white dark:bg-jp-gray-lightgray_background overflow-hidden singlestatBox p-2 md:mr-4`}>
<div className="p-4 flex flex-col justify-start h-full gap-2">
<UIUtils.RenderIf condition={singleStatLoading && loaderType === SideLoader}>
<RenderIf condition={singleStatLoading && loaderType === SideLoader}>
<div className="animate-spin self-end absolute">
<Icon name="spinner" size=16 />
</div>
</UIUtils.RenderIf>
</RenderIf>
<div className={"flex gap-2 items-center text-jp-gray-700 font-bold self-start"}>
<div className="font-semibold text-base text-black dark:text-white">
{title->React.string}
Expand Down Expand Up @@ -220,9 +220,9 @@ let make = (
</div>
})
->React.array}
<UIUtils.RenderIf condition={modifiedData->Array.length > 5}>
<RenderIf condition={modifiedData->Array.length > 5}>
<ShowMore value=modifiedData title tableEntity />
</UIUtils.RenderIf>
</RenderIf>
</>
} else {
<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/HSwitchSingleStatWidget.res
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ let make = (
<div
className={`h-full flex flex-col border ${borderRounded} dark:border-jp-gray-850 bg-white dark:bg-jp-gray-lightgray_background overflow-hidden singlestatBox p-2 md:mr-4`}>
<div className="p-4 flex flex-col justify-between h-full gap-auto">
<UIUtils.RenderIf condition={singleStatLoading && loaderType === SideLoader}>
<RenderIf condition={singleStatLoading && loaderType === SideLoader}>
<div className="animate-spin self-end absolute">
<Icon name="spinner" size=16 />
</div>
</UIUtils.RenderIf>
</RenderIf>
<div className="flex justify-between w-full h-1/2 items-end">
<div className="font-bold text-3xl w-1/3">
{statValue(statType)->String.toLowerCase->React.string}
Expand Down
Loading

0 comments on commit 6cc3b12

Please sign in to comment.