Skip to content

Commit 195f16e

Browse files
authored
Merge pull request #1859 from oasisprotocol/mz/roflSearch
Include ROFL apps in search results
2 parents 26c3939 + 5926d94 commit 195f16e

9 files changed

Lines changed: 290 additions & 123 deletions

File tree

.changelog/1859.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Include ROFL apps in search results

src/app/components/Rofl/RoflAppsList.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import { RoflApp } from '../../../oasis-nexus/api'
4-
import { Table, TableCellAlign, TableColProps } from '..//Table'
4+
import { useScreenSize } from '../../hooks/useScreensize'
5+
import { Table, TableCellAlign, TableColProps } from '../Table'
56
import { TablePaginationProps } from '../Table/TablePagination'
67
import { TableHeaderAge } from '../TableHeaderAge'
78
import { TableCellAge } from '../TableCellAge'
@@ -17,12 +18,18 @@ type RoflAppsListProps = {
1718

1819
export const RoflAppsList: FC<RoflAppsListProps> = ({ isLoading, limit, pagination, apps }) => {
1920
const { t } = useTranslation()
21+
const { isTablet } = useScreenSize()
22+
2023
const tableColumns: TableColProps[] = [
2124
{ key: 'order', content: '' },
2225
{ key: 'name', content: t('common.name') },
2326
{ key: 'status', content: t('common.status') },
2427
{ key: 'id', content: t('rofl.appId') },
25-
{ key: 'instances', content: t('rofl.instances'), align: TableCellAlign.Right },
28+
{
29+
key: 'instances',
30+
content: isTablet ? t('rofl.instances') : t('rofl.activeInstances'),
31+
align: TableCellAlign.Right,
32+
},
2633
{ key: 'created', content: t('rofl.created'), align: TableCellAlign.Right },
2734
{
2835
key: 'lastActivity',
@@ -39,8 +46,8 @@ export const RoflAppsList: FC<RoflAppsListProps> = ({ isLoading, limit, paginati
3946
key: 'order',
4047
},
4148
{
42-
content: app.metadata?.name ? (
43-
<RoflAppLink id={app.id} name={app.metadata?.name} network={app.network} />
49+
content: app?.metadata['net.oasis.rofl.name'] ? (
50+
<RoflAppLink id={app.id} name={app?.metadata['net.oasis.rofl.name']} network={app.network} />
4451
) : (
4552
t('rofl.nameNotProvided')
4653
),

src/app/components/Search/search-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
isValidTxHash,
66
isValidOasisAddress,
77
isValidEthAddress,
8+
isValidRoflAppId,
89
} from '../../utils/helpers'
910
import { RouteUtils, SpecifiedPerEnabledLayer } from '../../utils/route-utils'
1011
import { AppError, AppErrors } from '../../../types/errors'
@@ -133,6 +134,11 @@ export const validateAndNormalize = {
133134
return searchTerm.replace(/\s/g, '').toLowerCase()
134135
}
135136
},
137+
roflApp: (searchTerm: string) => {
138+
if (isValidRoflAppId(searchTerm.replace(/\s/g, '').toLowerCase())) {
139+
return searchTerm.replace(/\s/g, '').toLowerCase()
140+
}
141+
},
136142
evmAccount: (searchTerm: string): string | undefined => {
137143
if (isValidEthAddress(`0x${searchTerm}`)) {
138144
return `0x${searchTerm.toLowerCase()}`

0 commit comments

Comments
 (0)