import { useAccount } from '@gear-js/react-hooks';
import { useState } from 'react';
import { CodeCard, useCodes, Code } from '@/features/code';
import { LocalCode, useLocalCodes } from '@/features/local-indexer';
import { Filters, FilterGroup, Radio } from '@/features/filters';
import { useChain } from '@/hooks';
import { List, SearchForm, Skeleton } from '@/shared/ui';
import CardPlaceholderSVG from '@/shared/assets/images/placeholders/card.svg?react';
import styles from './Codes.module.scss';
const DEFAULT_FILTER_VALUES = {
owner: 'all',
};
const Codes = () => {
const { account } = useAccount();
const { isDevChain } = useChain();
const [searchQuery, setSearchQuery] = useState('');
const [filterValues, setFilterValues] = useState(DEFAULT_FILTER_VALUES);
const filterParams = {
query: searchQuery,
uploadedBy: filterValues.owner === 'user' ? account?.decodedAddress : undefined,
};
const storageCodes = useCodes(filterParams);
const localCodes = useLocalCodes(filterParams);
const codes = isDevChain ? localCodes : storageCodes;
const renderItem = (code: Code | LocalCode) =>