Skip to content

Commit 20d591e

Browse files
committed
Fix merge artifacts
1 parent 0a6b98b commit 20d591e

5 files changed

Lines changed: 12 additions & 15 deletions

File tree

File renamed without changes.

src/app/components/Rofl/RoflAppsList.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,22 @@ import { TableHeaderAge } from '../TableHeaderAge'
88
import { TableCellAge } from '../TableCellAge'
99
import { RoflAppStatusBadge } from './RoflAppStatusBadge'
1010
import { RoflAppLink } from './RoflAppLink'
11+
import { HighlightPattern } from '../HighlightedText'
1112

1213
type RoflAppsListProps = {
1314
apps?: RoflApp[]
1415
isLoading: boolean
1516
limit: number
1617
pagination: TablePaginationProps | false
17-
highlightedPartOfName?: string
18+
highlightPattern?: HighlightPattern
1819
}
1920

2021
export const RoflAppsList: FC<RoflAppsListProps> = ({
2122
isLoading,
2223
limit,
2324
pagination,
2425
apps,
25-
highlightedPartOfName,
26+
highlightPattern,
2627
}) => {
2728
const { t } = useTranslation()
2829
const { isTablet } = useScreenSize()
@@ -61,7 +62,7 @@ export const RoflAppsList: FC<RoflAppsListProps> = ({
6162
id={app.id}
6263
name={app?.metadata['net.oasis.rofl.name']}
6364
network={app.network}
64-
highlightedPartOfName={highlightedPartOfName}
65+
highlightPattern={highlightPattern}
6566
/>
6667
) : (
6768
t('rofl.nameNotProvided')

src/app/pages/RoflAppDetailsPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ export const RoflAppDetailsViewSearchResult: FC<{
229229
export const RoflAppDetailsVerticalListView: FC<{
230230
isLoading?: boolean
231231
app: RoflApp | undefined
232-
highlightedPartOfName?: string
233-
}> = ({ app, isLoading, highlightedPartOfName }) => {
232+
highlightPattern?: HighlightPattern
233+
}> = ({ app, isLoading, highlightPattern }) => {
234234
const { t } = useTranslation()
235235
const { isMobile } = useScreenSize()
236236

@@ -239,7 +239,7 @@ export const RoflAppDetailsVerticalListView: FC<{
239239

240240
return (
241241
<StyledDescriptionList titleWidth={isMobile ? '100px' : '200px'} standalone>
242-
<NameRow name={app.metadata['net.oasis.rofl.name']} highlightedPartOfName={highlightedPartOfName} />
242+
<NameRow name={app.metadata['net.oasis.rofl.name']} highlightPattern={highlightPattern} />
243243
<StatusBadgeRow hasActiveInstances={!!app.num_active_instances} removed={app.removed} />
244244
<DetailsRow title={t('rofl.appId')}>
245245
<RoflAppLink id={app.id} network={app.network} withSourceIndicator={false} />

src/app/pages/RoflAppsPage/hook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useTranslation } from 'react-i18next'
1010
import { useTypedSearchParam } from '../../hooks/useTypedSearchParam'
1111
import { useNavigate, useSearchParams } from 'react-router-dom'
1212
import { RouteUtils } from '../../utils/route-utils'
13+
import { textSearch } from '../../components/Search/search-utils'
1314

1415
const limit = NUMBER_OF_ITEMS_ON_SEPARATE_PAGE
1516

@@ -34,9 +35,8 @@ export const useROFLAppFiltering = () => {
3435
const [wantedNameInput, setWantedNameInput] = useTypedSearchParam(ROFL_SEARCH_ARG_NAME, '', {
3536
deleteParams: ['page'],
3637
})
37-
const wantedNamePattern = wantedNameInput.length < 3 ? undefined : wantedNameInput
38-
const nameError = !!wantedNameInput && !wantedNamePattern ? t('tableSearch.error.tooShort') : undefined
39-
const hasFilters = !!wantedNamePattern
38+
const { result: wantedNamePattern, warning: nameError } = textSearch.roflAppName(wantedNameInput, t)
39+
const hasFilters = !!wantedNamePattern.length
4040
const clearFilters = () => {
4141
setSearchParams(searchParams => {
4242
searchParams.delete('name')

src/app/pages/RoflAppsPage/index.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const RoflAppsView: FC<{ network: Network; layer: Runtime; tableView: TableLayou
5151
isLoading={isLoading}
5252
limit={limit}
5353
pagination={tablePagination}
54-
highlightedPartOfName={wantedNamePattern}
54+
highlightPattern={wantedNamePattern}
5555
/>
5656
)}
5757

@@ -63,11 +63,7 @@ const RoflAppsView: FC<{ network: Network; layer: Runtime; tableView: TableLayou
6363
))}
6464
{!isLoading &&
6565
roflApps?.map(app => (
66-
<RoflAppDetailsVerticalListView
67-
key={app.id}
68-
app={app}
69-
highlightedPartOfName={wantedNamePattern}
70-
/>
66+
<RoflAppDetailsVerticalListView key={app.id} app={app} highlightPattern={wantedNamePattern} />
7167
))}
7268
</VerticalList>
7369
)}

0 commit comments

Comments
 (0)