diff --git a/next.config.mjs b/next.config.mjs index c7615d2..0c0fa0a 100755 --- a/next.config.mjs +++ b/next.config.mjs @@ -2,9 +2,9 @@ const nextConfig = { // output: 'export', compiler: { - removeConsole: { - exclude: ['error'], - }, + // removeConsole: { + // exclude: ['error'], + // }, }, async rewrites() { return [ diff --git a/src/app/globals.css b/src/app/globals.css index b293933..7903e56 100755 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -135,4 +135,5 @@ body { td, th { border-color: var(--chakra-colors-bg) !important; + vertical-align: top; } \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index f8e00e2..f572357 100755 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -65,7 +65,7 @@ export default function Home() { } function handleTabsChange(index: number) { - if (index === 1) { + if (index === 0) { setRoute('pools'); } else { setRoute('strategies'); @@ -80,9 +80,9 @@ export default function Home() { (async () => { const tab = searchParams.get('tab'); if (tab === 'pools') { - setTabIndex(1); - } else { setTabIndex(0); + } else { + setTabIndex(1); } })(); }, [searchParams]); @@ -184,19 +184,19 @@ export default function Home() { color="light_grey" _selected={{ color: 'purple' }} onClick={() => { - mixpanel.track('Strategies opened'); + mixpanel.track('All pools clicked'); }} > - Strategies✨ + Find yields { - mixpanel.track('All pools clicked'); + mixpanel.track('Strategies opened'); }} > - Find yields + Strategies✨ - + - + diff --git a/src/components/Filters.tsx b/src/components/Filters.tsx index 48308e2..2a25ee8 100755 --- a/src/components/Filters.tsx +++ b/src/components/Filters.tsx @@ -1,217 +1,400 @@ import React from 'react'; -import Select, { StylesConfig } from 'react-select'; -import * as chroma from 'chroma.ts'; -import { useSetAtom } from 'jotai'; +import { useAtomValue, useSetAtom } from 'jotai'; import { - Accordion, - AccordionButton, - AccordionItem, - AccordionPanel, + Avatar, + AvatarBadge, + AvatarGroup, Box, - Stack, + HStack, + IconButton, + Tag, + TagLabel, Text, + Tooltip, } from '@chakra-ui/react'; -import { HamburgerIcon } from '@chakra-ui/icons'; -import { ALL_FILTER, filters, updateFiltersAtom } from '@/store/protocols'; - -export interface Option { - readonly value: string; - readonly label: string; - readonly color: string; - readonly isFixed?: boolean; - readonly isDisabled?: boolean; -} +import { CheckIcon, CloseIcon } from '@chakra-ui/icons'; +import { + ALL_FILTER, + filterAtoms, + filters, + updateFiltersAtom, +} from '@/store/protocols'; +import { getTokenInfoFromName } from '@/utils'; +import { Category, PoolType } from '@/store/pools'; -const colourStyles: StylesConfig = { - control: (styles) => ({ - ...styles, - padding: '10px 0', - backgroundColor: 'var(--chakra-colors-bg)', - borderColor: 'var(--chakra-colors-bg)', - }), - option: (styles, { data, isDisabled, isFocused, isSelected }) => { - const color = chroma.color(data.color); - return { - ...styles, - backgroundColor: 'var(--chakra-colors-bg)', - color: isDisabled - ? '#ccc' - : isSelected - ? chroma.contrast(color, 'white') > 2 - ? 'white' - : 'black' - : data.color, - cursor: isDisabled ? 'not-allowed' : 'default', - - ':active': { - ...styles[':active'], - backgroundColor: !isDisabled - ? isSelected - ? data.color - : color.alpha(0.3).css() - : undefined, - }, - }; - }, - container: (styles) => { - return { - ...styles, - width: '100%', - }; - }, - dropdownIndicator: (styles) => { - return { - ...styles, - color: 'var(--chakra-colors-purple)', - }; - }, - clearIndicator: (styles) => { - return { - ...styles, - color: 'var(--chakra-colors-purple)', - }; - }, - indicatorSeparator: (styles) => { - return { - ...styles, - backgroundColor: 'var(--chakra-colors-purple)', - }; - }, - menu: (styles) => { - return { - ...styles, - backgroundColor: 'var(--chakra-colors-highlight)', - }; - }, - multiValue: (styles, { data }) => { - const color = chroma.color(data.color); - return { - ...styles, - fontWeight: 'bold', - backgroundColor: 'none', - borderColor: color.alpha(0.7).css(), - borderWidth: '1px', - borderRadius: '5px', - }; - }, - multiValueLabel: (styles, { data }) => ({ - ...styles, - color: data.color, - }), - multiValueRemove: (styles, { data }) => ({ - ...styles, - color: data.color, - ':hover': { - backgroundColor: data.color, - color: 'white', - }, - }), -}; - -export default function Filters() { - // const colors: readonly string[] = ['#00B8D9', '#407cd5', '#7967e5', '#FF5630', - // '#FF8B00','#FFC400', '#36B37E', '#00875A', '#253858', '#666666'] - - const colors = ['rgba(132, 132, 195, 1)']; - const updateFilters = useSetAtom(updateFiltersAtom); +export function ProtocolFilters() { + const protocolsFilter = useAtomValue(filterAtoms.protocolsAtom); - const protocolOptions: readonly Option[] = filters.protocols.map( - (p, index) => { - return { value: p, label: p, color: colors[index % colors.length] }; - }, - ); + function isProtocolSelected(protocolName: string) { + return ( + protocolsFilter.includes(ALL_FILTER) || + protocolsFilter.includes(protocolName) + ); + } - const categories: readonly Option[] = filters.categories.map((p, index) => { - return { value: p, label: p, color: colors[index % colors.length] }; - }); + function atleastOneProtocolSelected() { + return protocolsFilter.length > 0; + } + const updateFilters = useSetAtom(updateFiltersAtom); - const poolTypes: readonly Option[] = filters.types.map((p, index) => { - return { value: p, label: p, color: colors[index % colors.length] }; - }); return ( - - -

- - - Filters - - - -

- - - Protocols: - - { - console.log(x, Array.isArray(x), b); - updateFilters( - 'categories', - x.map((p) => p.value), - ); - }} - /> - - - - Protocol types: - -