File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -14,26 +14,17 @@ import type {TopLevelViewPropsType} from '../types'
1414import type { ViewType } from '../views'
1515import { allViews } from '../views'
1616import { Column } from '../components/layout'
17+ import { partitionByIndex } from '../../lib/partition-by-index'
1718import { HomeScreenButton , CELL_MARGIN } from './button'
1819import { trackedOpenUrl } from '../components/open-url'
1920import { EditHomeButton , OpenSettingsButton } from '../components/nav-buttons'
2021
21- function partitionByIndex < T > (arr: T[]): [T[], T[]] {
22- return arr . reduce (
23- ( acc , val , idx ) => {
24- return idx % 2 === 0
25- ? [ acc [ 0 ] . concat ( val ) , acc [ 1 ] ]
26- : [ acc [ 0 ] , acc [ 1 ] . concat ( val ) ]
27- } ,
28- [ [ ] , [ ] ] ,
29- )
22+ type Props = TopLevelViewPropsType & {
23+ order : string [ ] ,
24+ views : ViewType [ ] ,
3025}
3126
32- function HomePage({
33- navigation ,
34- order ,
35- views = allViews ,
36- } : { order : string [ ] , views : ViewType [ ] } & TopLevelViewPropsType ) {
27+ function HomePage ( { navigation, order, views = allViews } : Props ) {
3728 const sortedViews = sortBy ( views , view => order . indexOf ( view . view ) )
3829
3930 const columns = partitionByIndex ( sortedViews )
You can’t perform that action at this time.
0 commit comments