From d1a62a2805a36bf9365a1a36a28774c1db27a759 Mon Sep 17 00:00:00 2001 From: Another Date: Fri, 12 Jan 2024 18:04:03 -0500 Subject: [PATCH 1/9] feat: add campaigns allocance to dashboard --- src/assets/data/contracts/alfajores.json | 3 +- src/assets/images/icons/coins/RFP.svg | 14 ++ src/components/_global/BalTable/TotalsRow.vue | 2 +- .../dashboard/DashboardTable/ClaimsTable.vue | 69 +++++--- .../tables/PoolsTable/PoolsTable.vue | 13 ++ src/composables/campaigns/useAllocance.ts | 19 +++ src/lib/abi/KolectivoSimpleMinter.json | 148 ++++++++++++++++++ src/lib/config/alfajores/contracts.ts | 3 +- src/pages/dashboard.vue | 5 +- src/services/campaigns/campaigns.service.ts | 28 ++++ 10 files changed, 276 insertions(+), 28 deletions(-) create mode 100644 src/assets/images/icons/coins/RFP.svg create mode 100644 src/composables/campaigns/useAllocance.ts create mode 100644 src/lib/abi/KolectivoSimpleMinter.json create mode 100644 src/services/campaigns/campaigns.service.ts diff --git a/src/assets/data/contracts/alfajores.json b/src/assets/data/contracts/alfajores.json index 90a981f83..eb52135ab 100644 --- a/src/assets/data/contracts/alfajores.json +++ b/src/assets/data/contracts/alfajores.json @@ -68,5 +68,6 @@ "WeightedPool2TokensFactory": "", "WeightedPoolFactory": "0x997252b17F61fFc6Ca2fDDd7fa1Cb0cdb98f202D", "YearnLinearPoolFactory": "", - "Multicall": "0xca11bde05977b3631167028862be2a173976ca11" + "Multicall": "0xca11bde05977b3631167028862be2a173976ca11", + "SimpleMinter": "0xEc9EC0e51DBfA5aB969d91313C64f7eEF0348272" } diff --git a/src/assets/images/icons/coins/RFP.svg b/src/assets/images/icons/coins/RFP.svg new file mode 100644 index 000000000..5367c47f0 --- /dev/null +++ b/src/assets/images/icons/coins/RFP.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/components/_global/BalTable/TotalsRow.vue b/src/components/_global/BalTable/TotalsRow.vue index 0ffc27794..227161432 100644 --- a/src/components/_global/BalTable/TotalsRow.vue +++ b/src/components/_global/BalTable/TotalsRow.vue @@ -36,7 +36,7 @@ function getHorizontalStickyClass(index: number) { :class="[ getHorizontalStickyClass(0), isColumnStuck ? 'isSticky' : '', - 'text-left p-6 bg-white dark:bg-gray-850 border-t dark:border-gray-900 align-top', + 'text-center p-6 bg-white dark:bg-gray-850 border-t dark:border-gray-900 align-center', ]" > Total diff --git a/src/components/contextual/pages/dashboard/DashboardTable/ClaimsTable.vue b/src/components/contextual/pages/dashboard/DashboardTable/ClaimsTable.vue index 989ad9c3a..45b5dc6f5 100644 --- a/src/components/contextual/pages/dashboard/DashboardTable/ClaimsTable.vue +++ b/src/components/contextual/pages/dashboard/DashboardTable/ClaimsTable.vue @@ -3,6 +3,9 @@ import { useI18n } from 'vue-i18n'; import useBreakpoints from '@/composables/useBreakpoints'; import { ColumnDefinition } from '@/components/_global/BalTable/types'; import useNumbers, { FNumFormats } from '@/composables/useNumbers'; +import RFP from '@/assets/images/icons/coins/RFP.svg'; +import useAllocance from '@/composables/campaigns/useAllocance'; + /** * TYPES */ @@ -21,7 +24,10 @@ export type ClaimRow = { */ const { t } = useI18n(); const { fNum } = useNumbers(); - +const { currentAllocation, isLoading } = useAllocance(); +watch(currentAllocation, () => { + console.debug(currentAllocation); +}); /** * STATE */ @@ -29,8 +35,8 @@ const { fNum } = useNumbers(); const columns = ref[]>([ { name: t('token'), - id: 'icons', - accessor: 'icons', + id: 'icon', + accessor: 'uri', Cell: 'iconsColumnCell', width: 50, noGrow: true, @@ -41,7 +47,7 @@ const columns = ref[]>([ align: 'right', width: 150, totalsCell: 'totalAmountCell', - accessor: ({ amount }) => `${fNum(amount, FNumFormats.token)} BAL`, + accessor: ({ amount }) => `${fNum(amount, FNumFormats.token)}`, }, { name: t('value'), @@ -49,7 +55,7 @@ const columns = ref[]>([ align: 'right', width: 150, totalsCell: 'totalValueCell', - accessor: ({ value }) => fNum(value, FNumFormats.fiat), + accessor: ({ value }) => value, }, { name: '', @@ -61,7 +67,19 @@ const columns = ref[]>([ }, ]); -const rewardsData = []; +const selectedRows = ref([]); + +const handleButtonClick = () => { + console.log(selectedRows.value); +}; + +const rewardsData = [ + { + icon: RFP, + amount: currentAllocation, + value: 'NFT XP', + }, +]; const { upToLargeBreakpoint } = useBreakpoints(); @@ -76,32 +94,35 @@ const { upToLargeBreakpoint } = useBreakpoints(); - - + Claim + diff --git a/src/components/tables/PoolsTable/PoolsTable.vue b/src/components/tables/PoolsTable/PoolsTable.vue index e60ef93a0..d28e2b90a 100644 --- a/src/components/tables/PoolsTable/PoolsTable.vue +++ b/src/components/tables/PoolsTable/PoolsTable.vue @@ -281,6 +281,12 @@ function lockedUntil(lockEndDate?: number) { } function iconAddresses(pool: Pool) { + console.debug({ pool }); + console.debug( + poolMetadata(pool.id)?.hasIcon + ? [pool.address] + : orderedTokenAddresses(pool) + ); return poolMetadata(pool.id)?.hasIcon ? [pool.address] : orderedTokenAddresses(pool); @@ -312,6 +318,13 @@ function goToPoolPage(id: string) { }, }); } + +watch( + () => props.data, + () => { + console.debug(props.data[0].name); + } +);