Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pro #1696

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open

Pro #1696

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
2721500
Init Pro
vrtnd Oct 31, 2023
e535c89
Fix
vrtnd Nov 1, 2023
c3f6ce1
Merge branch 'main' into pro
vrtnd Nov 1, 2023
ea134f3
Merge branch 'main' into pro
vrtnd Nov 2, 2023
36fe1aa
Merge branch 'main' into pro
vrtnd Nov 6, 2023
8dd804c
Fix calendar
vrtnd Nov 6, 2023
b256514
Main page
vrtnd Nov 8, 2023
5c4f08e
Fix
vrtnd Nov 8, 2023
8c7aa1f
fix
vrtnd Nov 8, 2023
e84fa2c
fix
vrtnd Nov 8, 2023
e8f8111
add chain charts
vrtnd Nov 11, 2023
5bd15a1
fix selected items
vrtnd Nov 11, 2023
fac631d
rmv chain/pro
vrtnd Nov 11, 2023
6828c95
rmv chain/pro
vrtnd Nov 11, 2023
2e4ad2a
Add protocols charts
vrtnd Nov 12, 2023
831bf74
Fix types
vrtnd Nov 12, 2023
b7b03f5
Fix
vrtnd Nov 12, 2023
fe6bfbd
Add period filter
vrtnd Nov 13, 2023
beb6564
Merge remote-tracking branch 'origin' into pro
vrtnd Nov 13, 2023
574965c
Cumulative filter + fixes
vrtnd Nov 16, 2023
a9d0fe9
Chain table /pro
vrtnd Nov 19, 2023
073553c
Fix table layout
vrtnd Nov 20, 2023
c4346d1
Fix layout
vrtnd Nov 20, 2023
f4a0f9b
Add per page btn and sorting
vrtnd Dec 5, 2023
0a35f67
Add payment modal
vrtnd Dec 21, 2023
bd7344b
downgrade wagmi
vrtnd Dec 21, 2023
46a8f72
Fix layout
vrtnd Dec 24, 2023
e241c66
Center layout
vrtnd Dec 24, 2023
5574970
Add pro features list
vrtnd Dec 29, 2023
36026bf
Gate csv download button
vrtnd Dec 30, 2023
baddd82
Move csv download button
vrtnd Dec 30, 2023
1e831ea
Move csv download button
vrtnd Dec 30, 2023
605006b
Merge remote-tracking branch 'origin' into pro
vrtnd Feb 9, 2024
fa86dbf
Premium Api key managment page
vrtnd Feb 12, 2024
240edef
Revert styled update
vrtnd Feb 12, 2024
cd35a63
Receive success payment message
vrtnd Feb 12, 2024
61b542a
Pro Api: Add subscriptions api management, display subscriptions
vrtnd Feb 16, 2024
3797e8f
Merge remote-tracking branch 'origin/main' into pro
vrtnd Feb 16, 2024
a808aa6
Add github auth
vrtnd Feb 21, 2024
271c316
rebuild
vrtnd Feb 21, 2024
5145558
rebuild
vrtnd Feb 21, 2024
e9e49df
rebuild
vrtnd Feb 21, 2024
cb06c57
Fix copy button
vrtnd Feb 21, 2024
93544d4
Dynamic signature host
vrtnd Feb 22, 2024
7d8a5a2
user signature request.origin
vrtnd Feb 22, 2024
422fd02
Manage active subscription, dilter subs by amount
vrtnd Feb 24, 2024
8aa3b51
Fix types
vrtnd Feb 24, 2024
9a80f3e
Merge remote-tracking branch 'origin/main' into pro
vrtnd Feb 26, 2024
e2a75ad
Pro Api: Email settings
vrtnd Mar 5, 2024
d5378c4
Merge remote-tracking branch 'origin/main' into pro
vrtnd Mar 5, 2024
892f07f
fix deps + remove deps
0xngmi Apr 16, 2024
8457617
remove dead code + fix
0xngmi Apr 16, 2024
2a192c2
Protocol: Display Options and Derivatives
vrtnd Apr 16, 2024
2b02abb
Merge
vrtnd Apr 16, 2024
874d207
Pro API: Fixes
vrtnd Apr 16, 2024
329ca8b
Pro API: Fixes
vrtnd Apr 16, 2024
9b9238e
update api docs
0xngmi Apr 17, 2024
c152990
remove endpoints
0xngmi Apr 17, 2024
f3700bc
always enable pro api page
0xngmi Apr 17, 2024
5d10a37
remove deps
0xngmi Apr 17, 2024
4612fad
remove dead code
0xngmi Apr 17, 2024
2e4e8be
fix merge
0xngmi Apr 17, 2024
1babb92
another merge fix
0xngmi Apr 17, 2024
650319c
set projectId
0xngmi Apr 17, 2024
7054655
Remove duplicates
vrtnd Apr 17, 2024
114cf5a
Merge remote-tracking branch 'origin/pro' into pro
vrtnd Apr 17, 2024
6e1d960
Fix types
vrtnd Apr 17, 2024
629189c
Rmv console.log
vrtnd Apr 17, 2024
cc733c8
Fixes
vrtnd Apr 17, 2024
d0b4f5e
Rmv duplicates + fixes
vrtnd Apr 18, 2024
f1df64f
Rmv duplicates + fixes
vrtnd Apr 18, 2024
977b796
Fix
vrtnd Apr 18, 2024
e41dcf4
fix issue with excluded parent tokens
0xngmi Apr 22, 2024
4f8aac8
Add new csv download
vrtnd May 17, 2024
4d3e13a
Merge remote-tracking branch 'origin/main' into pro
vrtnd May 20, 2024
d3246fd
fix types
vrtnd May 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/components/ButtonStyled/CsvButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@ const Badge: React.FC<BadgeProps> = ({ text, color, isLight }) => {
)
}

const GrayButton = styled(ButtonDark)`
background: ${({ theme }) => (theme.mode === 'dark' ? '#22242a' : '#eaeaea')};
`

const CSVDownloadButton = ({
onClick,
style = {},
isLight = false,
customText = ''
customText = '',
isGray = false
}: {
onClick: () => void
style?: CSSProperties
isLight?: boolean
customText?: string
isGray?: boolean
}) => {
const { isVerified } = useVerified()
const router = useRouter()
const Button = isLight ? ButtonLight : ButtonDark
const Button = isGray ? GrayButton : isLight ? ButtonLight : ButtonDark

const text = customText || 'Download .csv'
if (!isVerified && IS_PRO_API_ENABLED) {
return (
Expand Down
13 changes: 11 additions & 2 deletions src/components/Filters/yields/Dropdowns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { IDropdownMenusProps } from './types'
import { YIELDS_SETTINGS } from '~/contexts/LocalStorage'
import { ColumnFilters } from '../common/ColumnFilters'
import { NotifyButton } from './NotifyButton'
import CSVDownloadButton from '~/components/ButtonStyled/CsvButton'

const BAD_DEBT_KEY = YIELDS_SETTINGS.NO_BAD_DEBT.toLowerCase()

Expand Down Expand Up @@ -48,7 +49,8 @@ export function YieldFilterDropdowns({
showLTV,
showTotalSupplied,
showTotalBorrowed,
showAvailable
showAvailable,
onCSVDownload
}: IDropdownMenusProps) {
const router = useRouter()

Expand Down Expand Up @@ -241,8 +243,15 @@ export function YieldFilterDropdowns({
)}

{!isMobile && (
<div style={{ marginInlineStart: 'auto' }}>
<div style={{ marginInlineStart: 'auto', display: 'flex', gap: '8px' }}>
<NotifyButton />
{onCSVDownload ? (
<CSVDownloadButton
isGray
style={{ color: 'inherit', fontWeight: 'normal', borderRadius: '8px' }}
onClick={onCSVDownload}
/>
) : null}
</div>
)}
</>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Filters/yields/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface IDropdownMenusProps {
showTotalSupplied?: boolean
showTotalBorrowed?: boolean
showAvailable?: boolean
onCSVDownload?: () => void
}

export interface IYieldFiltersProps extends IDropdownMenusProps {
Expand All @@ -46,4 +47,5 @@ export interface IYieldFiltersProps extends IDropdownMenusProps {
strategyInputsData?: Array<{ name: string; symbol: string; image?: string | null; image2?: string | null }>
noOfStrategies?: number
showSearchOnMobile?: boolean
onCSVDownload?: () => void
}
24 changes: 23 additions & 1 deletion src/components/RecentProtocols/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import { ProtocolsChainsSearch } from '~/components/Search'
import { Dropdowns, TableFilters, TableHeader } from '~/components/Table/shared'
import { FiltersByChain, HideForkedProtocols, TVLRange } from '~/components/Filters'
import { useCalcStakePool2Tvl } from '~/hooks/data'
import { getPercentChange } from '~/utils'
import { download, getPercentChange } from '~/utils'
import { IFormattedProtocol } from '~/api/types'

import { FlexRow } from '~/layout/ProtocolAndPool'
import { ButtonLight } from '../ButtonStyled'
import { ArrowUpRight, Plus, X } from 'react-feather'
import styled from 'styled-components'
import CSVDownloadButton from '../ButtonStyled/CsvButton'
import { useDialogState, Dialog } from 'ariakit/dialog'
import { DialogForm } from '../Filters/common/Base'
import { useMutation } from 'react-query'
Expand Down Expand Up @@ -149,6 +152,24 @@ export function RecentProtocols({
}, [protocols, chain, chainList, forkedList, toHideForkedProtocols, minTvl, maxTvl])

const protocolsData = useCalcStakePool2Tvl(data)
const downloadCSV = () => {
const headers = ['Name', 'Chain', 'TVL', 'Change 1d', 'Change 7d', 'Change 1m', 'Listed At']
const csvData = protocolsData.map((row) => {
return {
Name: row.name,
Chain: row.chains.join(', '),
TVL: row.tvl,
'Change 1d': row.change_1d,
'Change 7d': row.change_7d,
'Change 1m': row.change_1m,
'Listed At': new Date(row.listedAt * 1000).toLocaleDateString()
}
})
download(
'protocols.csv',
[headers, ...csvData.map((row) => headers.map((header) => row[header]).join(','))].join('\n')
)
}

const { pathname } = useRouter()

Expand Down Expand Up @@ -304,6 +325,7 @@ export function RecentProtocols({
<Dropdowns>
<FiltersByChain chainList={chainList} selectedChains={selectedChains} pathname={pathname} />
<TVLRange />
<CSVDownloadButton onClick={downloadCSV} isLight style={{ color: 'inherit', fontWeight: 'normal' }} />
</Dropdowns>
{forkedList && <HideForkedProtocols />}
</TableFilters>
Expand Down
37 changes: 36 additions & 1 deletion src/components/Treasuries/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
import VirtualTable from '~/components/Table/Table'

import { fetchWithErrorLogging } from '~/utils/async'
import CSVDownloadButton from '../ButtonStyled/CsvButton'
import { download } from '~/utils'

const fetch = fetchWithErrorLogging

Expand Down Expand Up @@ -60,6 +62,37 @@ export function TreasuriesPage({ treasuries, treasuriesColumns }) {

const [projectName, setProjectName] = React.useState('')

const downloadCSV = () => {
const headers = [
'Name',
'Category',
'Own Tokens',
'Stablecoins',
'Major Tokens',
'Other Tokens',
'TVL',
'Change 1d',
'Change 7d',
'Change 1m'
]
const data = treasuries.map((row) => {
return {
Name: row.name,
Category: row.category,
'Own Tokens': row.ownTokens,
Stablecoins: row.stablecoins,
'Major Tokens': row.majors,
'Other Tokens': row.others,
TVL: row.tvl,
'Change 1d': row.change_1d,
'Change 7d': row.change_7d,
'Change 1m': row.change_1m
}
})
const csv = [headers.join(',')].concat(data.map((row) => headers.map((header) => row[header]).join(','))).join('\n')
download('treasuries.csv', csv)
}

React.useEffect(() => {
const projectsColumns = instance.getColumn('name')
const id = setTimeout(() => {
Expand All @@ -71,7 +104,9 @@ export function TreasuriesPage({ treasuries, treasuriesColumns }) {
return (
<>
<TableHeaderAndSearch>
<Header>Protocol Treasuries</Header>
<Header>
Protocol Treasuries <CSVDownloadButton onClick={downloadCSV} isLight />
</Header>

<SearchWrapper>
<SearchIcon size={16} />
Expand Down
68 changes: 67 additions & 1 deletion src/components/YieldsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { AnnouncementWrapper } from '~/components/Announcement'
import LocalLoader from '../LocalLoader'
import { useFormatYieldQueryParams } from './hooks'
import { toFilterPool } from './utils'
import CSVDownloadButton from '../ButtonStyled/CsvButton'
import { download } from '~/utils'

const YieldPage = ({ pools, projectList, chainList, categoryList, tokens, tokenSymbolsList }) => {
const { query, pathname, push } = useRouter()
Expand Down Expand Up @@ -115,6 +117,70 @@ const YieldPage = ({ pools, projectList, chainList, categoryList, tokens, tokenS
exactTokens,
pathname
])
const downloadCSV = React.useCallback(() => {
const headers = [
'Pool',
'Project',
'Chain',
'TVL',
'APY',
'APY Base',
'APY Reward',
'Change 1d',
'Change 7d',
'Outlook',
'Confidence',
'Category',
'IL 7d',
'APY Base 7d',
'APY Net 7d',
'APY Mean 30d',
'Volume 1d',
'Volume 7d',
'APY Base Inception',
'APY Including LSD APY',
'APY Base Including LSD APY',
'APY Base Borrow',
'APY Reward Borrow',
'APY Borrow',
'Total Supply USD',
'Total Borrow USD',
'Total Available USD'
]
const csvData = poolsData.map((row) => {
return {
Pool: row.pool,
Project: row.project,
Chain: row.chains,
TVL: row.tvl,
APY: row.apy,
'APY Base': row.apyBase,
'APY Reward': row.apyReward,
'Change 1d': row.change1d,
'Change 7d': row.change7d,
Outlook: row.outlook,
Confidence: row.confidence,
Category: row.category,
'IL 7d': row.il7d,
'APY Base 7d': row.apyBase7d,
'APY Net 7d': row.apyNet7d,
'APY Mean 30d': row.apyMean30d,
'Volume 1d': row.volumeUsd1d,
'Volume 7d': row.volumeUsd7d,
'APY Base Inception': row.apyBaseInception,
'APY Including LSD APY': row.apyIncludingLsdApy,
'APY Base Including LSD APY': row.apyBaseIncludingLsdApy,
'APY Base Borrow': row.apyBaseBorrow,
'APY Reward Borrow': row.apyRewardBorrow,
'APY Borrow': row.apyBorrow,
'Total Supply USD': row.totalSupplyUsd,
'Total Borrow USD': row.totalBorrowUsd,
'Total Available USD': row.totalAvailableUsd
}
})
const csv = [headers].concat(csvData.map((row) => headers.map((header) => row[header]))).join('\n')
download('yields.csv', csv)
}, [poolsData])

return (
<>
Expand Down Expand Up @@ -142,7 +208,6 @@ const YieldPage = ({ pools, projectList, chainList, categoryList, tokens, tokenS
</a>
</AnnouncementWrapper>
)}

<YieldFiltersV2
header="Yield Rankings"
poolsNumber={poolsData.length}
Expand Down Expand Up @@ -174,6 +239,7 @@ const YieldPage = ({ pools, projectList, chainList, categoryList, tokens, tokenS
showTotalBorrowed={true}
showAvailable={true}
showLTV={true}
onCSVDownload={downloadCSV}
/>

{loading ? (
Expand Down
27 changes: 26 additions & 1 deletion src/containers/BridgedContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { SortingState, getCoreRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table'
import * as React from 'react'
import { Header } from '~/Theme'
import CSVDownloadButton from '~/components/ButtonStyled/CsvButton'

import { ProtocolsChainsSearch } from '~/components/Search'
import { bridgedColumns } from '~/components/Table/Defi/columns'
import VirtualTable from '~/components/Table/Table'
import { download } from '~/utils'
import { sluggify } from '~/utils/cache-client'

export default function ChainsContainer({ assets, chains, flows1d }) {
const [sorting, setSorting] = React.useState<SortingState>([])
Expand Down Expand Up @@ -33,6 +36,26 @@ export default function ChainsContainer({ assets, chains, flows1d }) {
getSortedRowModel: getSortedRowModel()
})

const onCSVDownload = () => {
const csvData = data.map((row) => {
return {
Chain: row.name,
Total: row.total?.total,
Change_24h: row?.change_24h,
Canonical: row?.canonical?.total,
OwnTokens: row?.ownTokens?.total,
ThirdParty: row?.thirdParty?.total,
Native: row?.native?.total
}
})
const headers = Object.keys(csvData[0])
const csv = [headers.join(',')]
.concat(csvData.map((row) => headers.map((header) => row[header]).join(',')))
.join('\n')

download('bridged-chains.csv', csv)
}

return (
<>
<ProtocolsChainsSearch
Expand All @@ -42,7 +65,9 @@ export default function ChainsContainer({ assets, chains, flows1d }) {
name: 'All Chains'
}}
/>
<Header>Bridged TVL for All chains</Header>
<Header style={{ display: 'flex', justifyContent: 'space-between' }}>
Bridged TVL for All chains <CSVDownloadButton onClick={onCSVDownload} />
</Header>
<VirtualTable instance={instance} cellStyles={{ overflow: 'visible' }} />
</>
)
Expand Down
Loading