Skip to content

Commit

Permalink
fix: Removed Sublevel remote link type & Pageloader CSS fixes. (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored Dec 26, 2023
1 parent 195aee0 commit aeb4927
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 47 deletions.
53 changes: 13 additions & 40 deletions src/screens/HyperSwitch/Sidebar/Sidebar.res
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,6 @@ module NestedSidebarItem = {
</Link>
</UIUtils.RenderIf>
}

| SubLevelRemoteLink(tabOption) => {
let {name, link, access, ?remoteIcon} = tabOption
let (remoteUi, link) = if remoteIcon->Belt.Option.getWithDefault(false) {
(<Icon name="external-link-alt" size=14 className="ml-3" />, link)
} else {
(React.null, `${link}${getSearchParamByLink(link)}`)
}
<UIUtils.RenderIf condition={access !== NoAccess}>
<a
ref={nestedSidebarItemRef->ReactDOM.Ref.domRef}
href={link}
target="_blank"
className={`${textColor} relative overflow-hidden flex flex-row items-center cursor-pointer ${paddingClass} ${selectedClass} `}>
<SidebarSubOption name isSectionExpanded isSelected isSideBarExpanded />
remoteUi
</a>
</UIUtils.RenderIf>
}
}}
</UIUtils.RenderIf>
}
Expand Down Expand Up @@ -308,23 +289,18 @@ module NestedSectionItem = {
</UIUtils.RenderIf>
</div>
<UIUtils.RenderIf condition={isElementShown}>
{
let subSectionsArr =
section.links
->Array.mapWithIndex((subLevelItem, index) => {
let isSelected = subLevelItem->isSubLevelItemSelected
<NestedSidebarItem
key={string_of_int(index)}
isSelected
isSideBarExpanded
isSectionExpanded
tabInfo=subLevelItem
/>
})
->React.array

subSectionsArr
}
{section.links
->Array.mapWithIndex((subLevelItem, index) => {
let isSelected = subLevelItem->isSubLevelItemSelected
<NestedSidebarItem
key={string_of_int(index)}
isSelected
isSideBarExpanded
isSectionExpanded
tabInfo=subLevelItem
/>
})
->React.array}
</UIUtils.RenderIf>
</div>
}
Expand All @@ -341,9 +317,7 @@ module SidebarNestedSection = {
) => {
let isSubLevelItemSelected = tabInfo => {
switch tabInfo {
| SubLevelRemoteLink(item)
| SubLevelLink(item) =>
linkSelectionCheck(firstPart, item.link)
| SubLevelLink(item) => linkSelectionCheck(firstPart, item.link)
}
}

Expand Down Expand Up @@ -410,7 +384,6 @@ module SidebarNestedSection = {
acc &&
switch subLevelItem {
| SubLevelLink({access}) => access === NoAccess
| SubLevelRemoteLink({access}) => access === NoAccess
}
})
<UIUtils.RenderIf condition={!areAllSubLevelsHidden}>
Expand Down
4 changes: 1 addition & 3 deletions src/screens/HyperSwitch/Sidebar/SidebarTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ type nestedOption = {
iconSize?: int,
}

type subLevelItem =
| SubLevelRemoteLink(nestedOption)
| SubLevelLink(nestedOption)
type subLevelItem = SubLevelLink(nestedOption)

type sectionType = {
name: string,
Expand Down
3 changes: 1 addition & 2 deletions src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ let make = () => {
[],
(insideAcc, item) => {
switch item {
| SubLevelLink(obj)
| SubLevelRemoteLink(obj) => {
| SubLevelLink(obj) => {
if (
checkStringStartsWithSubstring(~itemToCheck=sectionObj.name, ~searchText) ||
checkStringStartsWithSubstring(~itemToCheck=obj.name, ~searchText)
Expand Down
3 changes: 1 addition & 2 deletions src/screens/HyperSwitch/Utils/PageLoaderWrapper.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ let make = (
}
| Error(_err) =>
<DefaultLandingPage
height=sectionHeight
title="Oops, we hit a little bump on the road!"
customStyle={`py-16 !m-0 ${customStyleForDefaultLandingPage}`}
customStyle={`py-16 !m-0 ${customStyleForDefaultLandingPage} ${sectionHeight}`}
overriddingStylesTitle="text-2xl font-semibold"
buttonText="Refresh"
overriddingStylesSubtitle="!text-sm text-grey-700 opacity-50 !w-3/4"
Expand Down

0 comments on commit aeb4927

Please sign in to comment.