Skip to content

Commit

Permalink
chore: modified table customise columns, warning remove (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanjli525 authored Sep 26, 2024
1 parent 2999335 commit 59b390a
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 55 deletions.
70 changes: 61 additions & 9 deletions public/hyperswitch/icons/solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 10 additions & 7 deletions src/components/Filter.res
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,16 @@ let make = (
{customLeftView}
<RenderIf condition={allFilters->Array.length > 0}> {allFiltersUI} </RenderIf>
</div>
<RenderIf condition={fixedFilters->Array.length > 0}>
<FormRenderer.FieldsRenderer
fields={fixedFilters->Array.map(item => item.field)}
labelClass="hidden"
fieldWrapperClass="p-0"
/>
</RenderIf>
<div className="flex gap-2">
<RenderIf condition={fixedFilters->Array.length > 0}>
<FormRenderer.FieldsRenderer
fields={fixedFilters->Array.map(item => item.field)}
labelClass="hidden"
fieldWrapperClass="p-0"
/>
</RenderIf>
<PortalCapture key={`${title}CustomizeColumn`} name={`${title}CustomizeColumn`} />
</div>
</div>
<div className={`flex gap-2 flex-wrap ${verticalGap}`}>
<FormRenderer.FieldsRenderer
Expand Down
1 change: 0 additions & 1 deletion src/components/LoadedTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,6 @@ let make = (
?showborderColor
tableHeadingTextClass
nonFrozenTableParentClass
showCustomizeColumn={rightTitleElement != React.null}
/>
switch tableLocalFilter {
| true =>
Expand Down
8 changes: 4 additions & 4 deletions src/components/LoadedTableWithCustomColumns.res
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ let make = (
<RenderIf condition={!hideRightTitleElement}>
<Portal to={`${title}CustomizeColumn`}>
<Button
leftIcon=Button.CustomIcon(<Icon name="edit" size=16 />)
leftIcon=Button.CustomIcon(<Icon name="customise-columns" size=16 />)
buttonType=SecondaryFilled
buttonSize={Small}
buttonSize=XSmall
onClick={_ => setShowColumnSelector(_ => true)}
customButtonStyle="!rounded !bg-white !h-10 !text-black border-none"
customPaddingClass="px-4"
customButtonStyle="!rounded !bg-white !h-10 !text-black"
customPaddingClass="px-2"
/>
</Portal>
</RenderIf>
Expand Down
30 changes: 0 additions & 30 deletions src/components/Table.res
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ module TableRow = {
~fixLastCol=false,
~alignCellContent="",
~customCellColor="",
~showCustomizeColumn=false,
) => {
open Window
let (isCurrentRowExpanded, setIsCurrentRowExpanded) = React.useState(_ => false)
Expand Down Expand Up @@ -246,23 +245,6 @@ module TableRow = {
</AddDataAttributes>
})
->React.array}
<RenderIf condition={showCustomizeColumn}>
<div className="sticky right-0" onClick={e => e->ReactEvent.Mouse.stopPropagation}>
<tr>
<td colSpan=12 className="bg-white border-jp-gray-940 !border-l !p-0">
<div className="flex flex-row items-center">
<TableCell
cell=EllipsisText("", "w-14 h-14")
clearFormatting
isEllipsisTextRelative
customMoneyStyle
ellipseClass
/>
</div>
</td>
</tr>
</div>
</RenderIf>
</tr>
{if isCurrentRowExpanded {
<tr className="dark:border-jp-gray-dark_disable_border_color">
Expand Down Expand Up @@ -541,7 +523,6 @@ module TableHeadingCell = {
module TableHeadingRow = {
@react.component
let make = (
~title="",
~headingArray,
~isHighchartLegend,
~frozenUpto,
Expand All @@ -565,7 +546,6 @@ module TableHeadingRow = {
~columnFilterRow,
~customizeColumnNewTheme=?,
~tableHeadingTextClass="",
~showCustomizeColumn=false,
) => {
if headingArray->Array.length !== 0 {
<thead>
Expand Down Expand Up @@ -604,12 +584,6 @@ module TableHeadingRow = {
/>
})
->React.array}
<RenderIf condition={showCustomizeColumn}>
<div
className="flex jusitfy-center items-center sticky right-0 w-14 bg-white border-jp-gray-940 border-l h-14">
<PortalCapture key={`${title}CustomizeColumn`} name={`${title}CustomizeColumn`} />
</div>
</RenderIf>
</tr>
</thead>
} else {
Expand Down Expand Up @@ -682,7 +656,6 @@ let make = (
~showborderColor=true,
~tableHeadingTextClass="",
~nonFrozenTableParentClass="",
~showCustomizeColumn=false,
) => {
let isMobileView = MatchMedia.useMobileChecker()
let rowInfo: array<array<cell>> = rows
Expand Down Expand Up @@ -763,7 +736,6 @@ let make = (
fixLastCol
?alignCellContent
?customCellColor
showCustomizeColumn
/>
})
->React.array
Expand All @@ -785,7 +757,6 @@ let make = (

let customizeColumnNewTheme = isCustomiseColumn ? customizeColumnNewTheme : None
<TableHeadingRow
title
headingArray
isHighchartLegend
frozenUpto
Expand All @@ -809,7 +780,6 @@ let make = (
columnFilterRow
?customizeColumnNewTheme
tableHeadingTextClass
showCustomizeColumn
/>
}

Expand Down
4 changes: 0 additions & 4 deletions src/components/Table.resi
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ module TableRow: {
~fixLastCol: bool=?,
~alignCellContent: string=?,
~customCellColor: string=?,
~showCustomizeColumn: bool=?,
) => React.element
}
module SortAction: {
Expand Down Expand Up @@ -217,7 +216,6 @@ module TableHeadingCell: {
module TableHeadingRow: {
@react.component
let make: (
~title: string=?,
~headingArray: array<header>,
~isHighchartLegend: bool,
~frozenUpto: int,
Expand All @@ -241,7 +239,6 @@ module TableHeadingRow: {
~columnFilterRow: option<array<filterRow>>,
~customizeColumnNewTheme: customiseColumnConfig=?,
~tableHeadingTextClass: string=?,
~showCustomizeColumn: bool=?,
) => React.element
}
@react.component
Expand Down Expand Up @@ -308,5 +305,4 @@ let make: (
~showborderColor: bool=?,
~tableHeadingTextClass: string=?,
~nonFrozenTableParentClass: string=?,
~showCustomizeColumn: bool=?,
) => React.element
2 changes: 2 additions & 0 deletions src/screens/HSwitchRemoteFilter.res
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ module RemoteTableFilters = {
defaultFilterKeys=[startTimeFilterKey, endTimeFilterKey]
updateUrlWith={updateExistingKeys}
clearFilters={() => reset()}
title
/>
| _ =>
<Filter
Expand All @@ -274,6 +275,7 @@ module RemoteTableFilters = {
defaultFilterKeys=[startTimeFilterKey, endTimeFilterKey]
updateUrlWith={updateExistingKeys}
clearFilters={() => reset()}
title
/>
}
}
Expand Down
1 change: 1 addition & 0 deletions src/screens/Refunds/Refund.res
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ let make = () => {
searchVal=searchText
/>}
entityName=REFUND_FILTERS
title="Refunds"
/>
</div>
<RenderIf condition={generateReport && refundData->Array.length > 0}>
Expand Down

0 comments on commit 59b390a

Please sign in to comment.