Skip to content

Commit c142e59

Browse files
committed
Pass custom filter options in ROFL updates tab
1 parent 67f393d commit c142e59

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.changelog/1777.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ROFL apps support

src/app/components/RuntimeTransactionMethod/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ export const getRuntimeTxMethodOptions = (t: TFunction, layer: Layer): SelectOpt
7474
)
7575
}
7676

77+
export const getRuntimeRoflUpdatesMethodOptions = (t: TFunction): SelectOptionBase[] => {
78+
const options = ['rofl.Create', 'rofl.Remove', 'rofl.Update']
79+
80+
return options.map(
81+
(method): SelectOptionBase => ({
82+
value: method,
83+
label: getRuntimeTransactionLabel(t, method),
84+
}),
85+
)
86+
}
87+
7788
/**
7889
* The method call body. Defined by the runtime.
7990
*

src/app/pages/RoflAppDetailsPage/RoflAppUpdatesCard.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { FC } from 'react'
2+
import { useTranslation } from 'react-i18next'
23
import Box from '@mui/material/Box'
34
import { useScreenSize } from '../../hooks/useScreensize'
45
import { NUMBER_OF_ITEMS_ON_SEPARATE_PAGE } from '../../config'
56
import { updatesContainerId } from '../../utils/tabAnchors'
67
import { LinkableCardLayout } from '../../components/LinkableCardLayout'
78
import { RuntimeTransactions } from '../../components/Transactions'
89
import { RuntimeTransactionTypeFilter } from '../../components/Transactions/RuntimeTransactionTypeFilter'
10+
import { getRuntimeRoflUpdatesMethodOptions } from '../..//components/RuntimeTransactionMethod'
911
import { RoflAppDetailsContext, useRoflAppUpdates } from './hooks'
1012

1113
export const RoflAppUpdatesCard: FC<RoflAppDetailsContext> = context => {
14+
const { t } = useTranslation()
1215
const { method, setMethod, scope } = context
13-
1416
const { isMobile } = useScreenSize()
17+
const customOptions = getRuntimeRoflUpdatesMethodOptions(t)
1518

1619
return (
1720
<LinkableCardLayout
@@ -24,13 +27,24 @@ export const RoflAppUpdatesCard: FC<RoflAppDetailsContext> = context => {
2427
}}
2528
>
2629
{!isMobile && (
27-
<RuntimeTransactionTypeFilter layer={scope.layer} value={method} setValue={setMethod} />
30+
<RuntimeTransactionTypeFilter
31+
layer={scope.layer}
32+
value={method}
33+
setValue={setMethod}
34+
customOptions={customOptions}
35+
/>
2836
)}
2937
</Box>
3038
}
3139
>
3240
{isMobile && (
33-
<RuntimeTransactionTypeFilter layer={scope.layer} value={method} setValue={setMethod} expand />
41+
<RuntimeTransactionTypeFilter
42+
layer={scope.layer}
43+
value={method}
44+
setValue={setMethod}
45+
expand
46+
customOptions={customOptions}
47+
/>
3448
)}
3549
<RoflAppUpdates {...context} />
3650
</LinkableCardLayout>

0 commit comments

Comments
 (0)