import React, { useState } from 'react'; import Rectangle1 from '@/assets/Rectangle-199.png'; import Rectangle2 from '@/assets/Rectangle-200.png'; import Rectangle3 from '@/assets/Rectangle-201.png'; import { Combobox, Flex, ResolvedAddress, Text } from '@/components'; import { IndexedNFAStyles as S } from '../indexed-nfa.styles'; type SortItem = { value: string; label: string; }; const orderResults: SortItem[] = [ { value: 'newest', label: 'Newest' }, { value: 'oldest', label: 'Oldest' }, ]; const Header: React.FC = () => { const [selectedValue, setSelectedValue] = useState(orderResults[0]); const handleSortChange = (item: SortItem | undefined): void => { //TODO integrate with context and sort if (item) { setSelectedValue(item); } }; return ( <> Hosted NFAs {({ Field, Options }) => ( <> {(selected) => selected?.label || 'Select'} {(item) => item.label} )} ); }; const thumbnailMocks = [Rectangle1, Rectangle2, Rectangle3]; // TODO: replace mocks with fetched data const apMocks = new Array(20).fill(0).map((_, index) => ({ thumbnail: thumbnailMocks[ Math.floor( Math.random() * (Math.floor(2) - Math.ceil(0) + 1) + Math.ceil(0) ) ], domain: `domain${index}.com`, owner: '0x7ED735b7095C05d78dF169F991f2b7f1A1F1A049', createdAt: `${Math.floor(Math.random() * 30)}m ago`, })); const AccessPointsListFragment: React.FC = () => { //TODO add infinite scroll return ( {apMocks.map((item, index) => ( {item.domain} {item.owner} 220 views 2 months ago ))} ); }; export const IndexedNFAMainFragment: React.FC = () => { return (
); };