diff --git a/motivator/src/components/assessor/DialogUserData.tsx b/motivator/src/archive/components/DialogUserData.tsx similarity index 97% rename from motivator/src/components/assessor/DialogUserData.tsx rename to motivator/src/archive/components/DialogUserData.tsx index 795ce062..38c8d937 100644 --- a/motivator/src/components/assessor/DialogUserData.tsx +++ b/motivator/src/archive/components/DialogUserData.tsx @@ -12,8 +12,8 @@ import { } from '@/components/ui/dialog' import { Label } from '@/components/ui/label' import { User } from '@/types/data/user' -import AddrAvatar from '../globals/AddrAvatar' -import { DataCard } from './DataCard' +import AddrAvatar from '../../components/globals/AddrAvatar' +import { DataCard } from '../../components/assessor/DataCard' import EthLogo from '~/ethereum-eth-logo.svg' import DaiLogo from '~/dai.svg' import { useEffect, useState } from 'react' @@ -23,17 +23,17 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { VolumeChart } from '../statistics/VolumeChart' -import { LP_VolumeChart } from '../statistics/LP_VolumeChart ' +import { VolumeChart } from './statistics/VolumeChart' +import { LP_VolumeChart } from './statistics/LP_VolumeChart ' import { useGetOffChainActions } from '../../hooks/offChainActions/useGetOffChainActions' -import { Tag } from './Tag' +import { Tag } from '../../components/assessor/Tag' import { OffChainActions } from '../../types/enum/status' -import { Card } from '../ui/card' +import { Card } from '../../components/ui/card' import { transformNumberK } from '../../utils/utils' -import { WeekSelector } from '../globals/WeekSelector' -import Statistics from '../statistics/Statistics' -import { LP_LineChart } from '../statistics/LP_LineChart' -import { LineChart } from '../statistics/LineChart' +import { WeekSelector } from './WeekSelector' +import Statistics from './Statistics' +import { LP_LineChart } from './statistics/LP_LineChart' +import { LineChart } from './statistics/LineChart' type Props = { user: User } diff --git a/motivator/src/components/assessor/ReducedDataUsers.tsx b/motivator/src/archive/components/ReducedDataUsers.tsx similarity index 94% rename from motivator/src/components/assessor/ReducedDataUsers.tsx rename to motivator/src/archive/components/ReducedDataUsers.tsx index 038217e7..0196e4a2 100644 --- a/motivator/src/components/assessor/ReducedDataUsers.tsx +++ b/motivator/src/archive/components/ReducedDataUsers.tsx @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react' import { User } from '@/types/data/user' import AddrAvatar from '@/components/globals/AddrAvatar' -import { Button } from '../ui/button' -import { Input } from '../ui/input' +import { Button } from '../../components/ui/button' +import { Input } from '../../components/ui/input' import { toast } from 'sonner' import { useAddRewardUsers } from '../../hooks/reward/useAddRewardUsers' diff --git a/motivator/src/components/statistics/Statistics.tsx b/motivator/src/archive/components/Statistics.tsx similarity index 97% rename from motivator/src/components/statistics/Statistics.tsx rename to motivator/src/archive/components/Statistics.tsx index 72bef3b0..91391691 100644 --- a/motivator/src/components/statistics/Statistics.tsx +++ b/motivator/src/archive/components/Statistics.tsx @@ -3,7 +3,7 @@ import { Card } from '@/components/ui/card' import React, { useEffect, useState } from 'react' import { transformNumberK } from '@/utils/utils' import { DataCard } from '@/components/assessor/DataCard' -import { WeekSelector } from '@/components/globals/WeekSelector' +import { WeekSelector } from '@/archive/components/WeekSelector' import { Label } from '@/components/ui/label' import EthLogo from '~/ethereum-eth-logo.svg' import DaiLogo from '~/dai.svg' @@ -11,7 +11,7 @@ import { Tag } from '@/components/assessor/Tag' import { useGetOffChainActions } from '@/hooks/offChainActions/useGetOffChainActions' import { OffChainActions } from '@/types/enum/status' import { User } from '@/types/data/user' -import { useGetTotalsForUserAndWeek } from '../../hooks/statistics/useGetTotalsForUserAndWeek' +import { useGetTotalsForUserAndWeek } from '../hooks/statistics/useGetTotalsForUserAndWeek' import { useGetWeekTotalsAvailableForUser } from '../../hooks/global/useGetWeekTotalsAvailableForUser' type Props = { user: User diff --git a/motivator/src/components/globals/WeekSelector.tsx b/motivator/src/archive/components/WeekSelector.tsx similarity index 96% rename from motivator/src/components/globals/WeekSelector.tsx rename to motivator/src/archive/components/WeekSelector.tsx index 4d28f82b..65b6bc19 100644 --- a/motivator/src/components/globals/WeekSelector.tsx +++ b/motivator/src/archive/components/WeekSelector.tsx @@ -9,7 +9,7 @@ import { SelectTrigger, SelectValue, } from '@/components/ui/select' -import { Label } from '../ui/label' +import { Label } from '../../components/ui/label' type Props = { weekSelected: number diff --git a/motivator/src/components/statistics/LP_LineChart.tsx b/motivator/src/archive/components/statistics/LP_LineChart.tsx similarity index 97% rename from motivator/src/components/statistics/LP_LineChart.tsx rename to motivator/src/archive/components/statistics/LP_LineChart.tsx index 1fd8c484..e1810689 100644 --- a/motivator/src/components/statistics/LP_LineChart.tsx +++ b/motivator/src/archive/components/statistics/LP_LineChart.tsx @@ -1,7 +1,7 @@ import React from 'react' import { AreaChart } from '@tremor/react' -import { DataSetChartLP } from '@/components/assessor/DialogUserData' -import { cn } from '../../utils/utils' +import { DataSetChartLP } from '../DialogUserData' +import { cn } from '../../../utils/utils' export type Props = { title: string diff --git a/motivator/src/components/statistics/LP_VolumeChart .tsx b/motivator/src/archive/components/statistics/LP_VolumeChart .tsx similarity index 90% rename from motivator/src/components/statistics/LP_VolumeChart .tsx rename to motivator/src/archive/components/statistics/LP_VolumeChart .tsx index c537d1cb..494c5b8c 100644 --- a/motivator/src/components/statistics/LP_VolumeChart .tsx +++ b/motivator/src/archive/components/statistics/LP_VolumeChart .tsx @@ -1,6 +1,6 @@ import { BarChart } from '@tremor/react' -import { DataSetChartVolumeLP } from '@/components/assessor/DialogUserData' -import { transformNumberK } from '../../utils/utils' +import { DataSetChartVolumeLP } from '../DialogUserData' +import { transformNumberK } from '../../../utils/utils' export type Props = { title: string diff --git a/motivator/src/components/statistics/LineChart.tsx b/motivator/src/archive/components/statistics/LineChart.tsx similarity index 98% rename from motivator/src/components/statistics/LineChart.tsx rename to motivator/src/archive/components/statistics/LineChart.tsx index 7a95236d..f0a71eb4 100644 --- a/motivator/src/components/statistics/LineChart.tsx +++ b/motivator/src/archive/components/statistics/LineChart.tsx @@ -1,7 +1,7 @@ import React from 'react' import { AreaChart } from '@tremor/react' -import { DataSetChartTrading } from '@/components/assessor/DialogUserData' -import { cn } from '../../utils/utils' +import { DataSetChartTrading } from '../DialogUserData' +import { cn } from '../../../utils/utils' // const valueFormatter = function (number: number) { // return ( diff --git a/motivator/src/components/statistics/VolumeChart.tsx b/motivator/src/archive/components/statistics/VolumeChart.tsx similarity index 90% rename from motivator/src/components/statistics/VolumeChart.tsx rename to motivator/src/archive/components/statistics/VolumeChart.tsx index a17d54cc..922ed218 100644 --- a/motivator/src/components/statistics/VolumeChart.tsx +++ b/motivator/src/archive/components/statistics/VolumeChart.tsx @@ -1,6 +1,6 @@ import { BarChart } from '@tremor/react' -import { DataSetChartTrading } from '@/components/assessor/DialogUserData' -import { transformNumberK } from '../../utils/utils' +import { DataSetChartTrading } from '../DialogUserData' +import { transformNumberK } from '../../../utils/utils' export type Props = { title: string diff --git a/motivator/src/hooks/offChainActions/useGetOffChainActions.ts b/motivator/src/archive/hooks/offChainActions/useGetOffChainActions.ts similarity index 100% rename from motivator/src/hooks/offChainActions/useGetOffChainActions.ts rename to motivator/src/archive/hooks/offChainActions/useGetOffChainActions.ts diff --git a/motivator/src/hooks/statistics/useGetPNLAndVolume.ts b/motivator/src/archive/hooks/statistics/useGetPNLAndVolume.ts similarity index 89% rename from motivator/src/hooks/statistics/useGetPNLAndVolume.ts rename to motivator/src/archive/hooks/statistics/useGetPNLAndVolume.ts index 9cc0e0fe..6f4424ee 100644 --- a/motivator/src/hooks/statistics/useGetPNLAndVolume.ts +++ b/motivator/src/archive/hooks/statistics/useGetPNLAndVolume.ts @@ -1,5 +1,5 @@ import { useQuery } from '@tanstack/react-query' -import { getPNLAndVolume } from '@/server/actions/statistics/getPNLAndVolume' +import { getPNLAndVolume } from '@/archive/server/actions/statistics/getPNLAndVolume' type Props = { userAddr: string diff --git a/motivator/src/hooks/statistics/useGetTotalsForUserAndWeek.ts b/motivator/src/archive/hooks/statistics/useGetTotalsForUserAndWeek.ts similarity index 82% rename from motivator/src/hooks/statistics/useGetTotalsForUserAndWeek.ts rename to motivator/src/archive/hooks/statistics/useGetTotalsForUserAndWeek.ts index 3eff0d3f..a1a83567 100644 --- a/motivator/src/hooks/statistics/useGetTotalsForUserAndWeek.ts +++ b/motivator/src/archive/hooks/statistics/useGetTotalsForUserAndWeek.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query' -import { getPNLAndVolume } from '@/server/actions/statistics/getPNLAndVolume' -import { getTotalsForUser } from '../../server/actions/globals/getTotalsForUser' +import { getPNLAndVolume } from '@/archive/server/actions/statistics/getPNLAndVolume' +import { getTotalsForUser } from '../../../server/actions/globals/getTotalsForUser' type Props = { userAddr: string diff --git a/motivator/src/hooks/statistics/usegetTotalsVolPnlActions.ts b/motivator/src/archive/hooks/statistics/usegetTotalsVolPnlActions.ts similarity index 100% rename from motivator/src/hooks/statistics/usegetTotalsVolPnlActions.ts rename to motivator/src/archive/hooks/statistics/usegetTotalsVolPnlActions.ts diff --git a/motivator/src/server/actions/statistics/getPNLAndVolume.ts b/motivator/src/archive/server/actions/statistics/getPNLAndVolume.ts similarity index 100% rename from motivator/src/server/actions/statistics/getPNLAndVolume.ts rename to motivator/src/archive/server/actions/statistics/getPNLAndVolume.ts diff --git a/motivator/src/server/actions/statistics/getTotalsVolPnlActions.ts b/motivator/src/archive/server/actions/statistics/getTotalsVolPnlActions.ts similarity index 100% rename from motivator/src/server/actions/statistics/getTotalsVolPnlActions.ts rename to motivator/src/archive/server/actions/statistics/getTotalsVolPnlActions.ts diff --git a/motivator/src/components/assessor/DataTableAssessor.tsx b/motivator/src/components/assessor/DataTableAssessor.tsx index b56a8847..d3069369 100644 --- a/motivator/src/components/assessor/DataTableAssessor.tsx +++ b/motivator/src/components/assessor/DataTableAssessor.tsx @@ -23,16 +23,16 @@ import { Reward, Statistics, Totals, -} from '../../types/data/assessorSlot' -import { DialogUserData } from './DialogUserData' +} from '@/types/data/assessorSlot' +import { DialogUserData } from '@/archive/components/DialogUserData' import InputReward from '../globals/InputReward' import { Address } from 'viem' import { DialogConfirmSubmit } from './DialogConfirmSubmit' -import { useGetAssessorSlotIDFromURL } from '../../hooks/global/useGetAssessorSlotIDFromURL' +import { useGetAssessorSlotIDFromURL } from '@/hooks/global/useGetAssessorSlotIDFromURL' import TotalPoints from './TotalPoints' import { useRouter } from 'next/navigation' -import { transformNumberK } from '../../utils/utils' +import { transformNumberK } from '@/utils/utils' export type UserDatatable = { id: { id: string; assessorSlotId: string } @@ -78,90 +78,90 @@ export const columns: ColumnDef[] = [ }, }, - { - accessorKey: 'stat', - cell: ({ row }) => { - const stat = row.getValue('stat') as UserDatatable['stat'] + // { + // accessorKey: 'stat', + // cell: ({ row }) => { + // const stat = row.getValue('stat') as UserDatatable['stat'] - return ( -
-
- {' '} -

- Volume -

-
-
-

- Pool ETH -

-
- -

- {transformNumberK( - Number( - stat.totals.totalVolumePoolEth - ) - )} -

-
-
-
-

- Pool Dai -

-
- -

- {transformNumberK( - Number( - stat.totals.totalVolumePoolDai - ) - )} -

-
-
-
-
+ // return ( + //
+ //
+ // {' '} + //

+ // Volume + //

+ //
+ //
+ //

+ // Pool ETH + //

+ //
+ // + //

+ // {transformNumberK( + // Number( + // stat.totals.totalVolumePoolEth + // ) + // )} + //

+ //
+ //
+ //
+ //

+ // Pool Dai + //

+ //
+ // + //

+ // {transformNumberK( + // Number( + // stat.totals.totalVolumePoolDai + // ) + // )} + //

+ //
+ //
+ //
+ //
-
-

- Actions -

-
- {/* */} -

- {Number(stat.totals.totalActions)} -

-
-
-
- ) - }, - }, + //
+ //

+ // Actions + //

+ //
+ // {/* */} + //

+ // {Number(stat.totals.totalActions)} + //

+ //
+ //
+ //
+ // ) + // }, + // }, - { - accessorKey: 'pnl', - enableHiding: false, - cell: ({ row }) => { - const stat = row.getValue('stat') as UserDatatable['stat'] - const pnl = row.getValue('pnl') as UserDatatable['pnl'] - const reward = row.getValue('reward') as UserDatatable['reward'] + // { + // accessorKey: 'pnl', + // enableHiding: false, + // cell: ({ row }) => { + // const stat = row.getValue('stat') as UserDatatable['stat'] + // const pnl = row.getValue('pnl') as UserDatatable['pnl'] + // const reward = row.getValue('reward') as UserDatatable['reward'] - return ( - - ) - }, - }, + // return ( + // + // ) + // }, + // }, { accessorKey: 'reward', enableHiding: true, diff --git a/motivator/src/components/assessor/DialogConfirmSubmit.tsx b/motivator/src/components/assessor/DialogConfirmSubmit.tsx index ebda09c1..2b3abd8d 100644 --- a/motivator/src/components/assessor/DialogConfirmSubmit.tsx +++ b/motivator/src/components/assessor/DialogConfirmSubmit.tsx @@ -20,7 +20,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' -import { useGetTotalPointsDistributed } from '@/hooks/dataComponents/useGetTotalPointsDistributed' +import { useGetTotalPointsDistributed } from '@/hooks/global/useGetTotalPointsDistributed' import { cn } from '@/utils/utils' import { useSubmitAssessorSlot } from '@/hooks/assessorSlot/useSubmitAssessorSlot' import { useRouter } from 'next/navigation' @@ -85,6 +85,7 @@ export function DialogConfirmSubmit({ assessorSlotId }: Props) { toast.error('Error on Submit') setIsSubmited(false) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [status, statusAssessorSlotRQT, AssessorSlot]) return ( diff --git a/motivator/src/components/assessor/TotalPoints.tsx b/motivator/src/components/assessor/TotalPoints.tsx index 16c873a0..8f9428a3 100644 --- a/motivator/src/components/assessor/TotalPoints.tsx +++ b/motivator/src/components/assessor/TotalPoints.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { useGetTotalPointsDistributed } from '../../hooks/dataComponents/useGetTotalPointsDistributed' +import { useGetTotalPointsDistributed } from '../../hooks/global/useGetTotalPointsDistributed' import { cn } from '../../utils/utils' type Props = {} diff --git a/motivator/src/hooks/dataComponents/useGetTotalPointsDistributed.tsx b/motivator/src/hooks/global/useGetTotalPointsDistributed.tsx similarity index 93% rename from motivator/src/hooks/dataComponents/useGetTotalPointsDistributed.tsx rename to motivator/src/hooks/global/useGetTotalPointsDistributed.tsx index 89bbd4d2..f8b66272 100644 --- a/motivator/src/hooks/dataComponents/useGetTotalPointsDistributed.tsx +++ b/motivator/src/hooks/global/useGetTotalPointsDistributed.tsx @@ -1,5 +1,5 @@ import { useGlobalState } from '../../store/globalStore' -import { useGetAssessorSlotIDFromURL } from '../global/useGetAssessorSlotIDFromURL' +import { useGetAssessorSlotIDFromURL } from './useGetAssessorSlotIDFromURL' import { useGetRewardedUsers } from '../reward/useGetRewardedUsers' import { useEffect, useRef, useState } from 'react' diff --git a/motivator/src/server/actions/assessor/getAssessorSlotWithAddr.ts b/motivator/src/server/actions/assessor/getAssessorSlotWithAddr.ts index 71752ed3..feb7ebde 100644 --- a/motivator/src/server/actions/assessor/getAssessorSlotWithAddr.ts +++ b/motivator/src/server/actions/assessor/getAssessorSlotWithAddr.ts @@ -3,7 +3,7 @@ import { and, eq, ne } from 'drizzle-orm' import { db } from '@db/dbRouter' import { assessor_slot, assessor_slot_user, reward } from '@db/schema' import { AssessorSlot, Statistics, Totals } from '@/types/data/assessorSlot' -import { getPNLAndVolume } from '../statistics/getPNLAndVolume' +import { getPNLAndVolume } from '../../../archive/server/actions/statistics/getPNLAndVolume' import { getTotalsForUser } from '../globals/getTotalsForUser' // Send Rewards to specifics users based on their actions /** diff --git a/motivator/src/server/actions/assessor/getAssessorSlotWithID.ts b/motivator/src/server/actions/assessor/getAssessorSlotWithID.ts index ada1a661..10e9bb9c 100644 --- a/motivator/src/server/actions/assessor/getAssessorSlotWithID.ts +++ b/motivator/src/server/actions/assessor/getAssessorSlotWithID.ts @@ -3,8 +3,8 @@ import { and, eq, ne } from 'drizzle-orm' import { db } from '@db/dbRouter' import { assessor_slot, assessor_slot_user, reward } from '@db/schema' import { AssessorSlot, Statistics, Totals } from '@/types/data/assessorSlot' -import { getTotalsVolPnlActions } from '../statistics/getTotalsVolPnlActions' -import { getPNLAndVolume } from '../statistics/getPNLAndVolume' +import { getTotalsVolPnlActions } from '../../../archive/server/actions/statistics/getTotalsVolPnlActions' +import { getPNLAndVolume } from '../../../archive/server/actions/statistics/getPNLAndVolume' import { getTotalsForUser } from '../globals/getTotalsForUser' // Send Rewards to specifics users based on their actions /** diff --git a/motivator/src/server/actions/globals/getAllAssessorSlotsAudit.ts b/motivator/src/server/actions/globals/getAllAssessorSlotsAudit.ts index 12141ca6..98d40867 100644 --- a/motivator/src/server/actions/globals/getAllAssessorSlotsAudit.ts +++ b/motivator/src/server/actions/globals/getAllAssessorSlotsAudit.ts @@ -3,8 +3,8 @@ import { and, eq, ne } from 'drizzle-orm' import { db } from '@db/dbRouter' import { assessor_slot, assessor_slot_user, audit, reward } from '@db/schema' import { AssessorSlot, Statistics, Totals } from '@/types/data/assessorSlot' -import { getTotalsVolPnlActions } from '../statistics/getTotalsVolPnlActions' -import { getPNLAndVolume } from '../statistics/getPNLAndVolume' +import { getTotalsVolPnlActions } from '../../../archive/server/actions/statistics/getTotalsVolPnlActions' +import { getPNLAndVolume } from '../../../archive/server/actions/statistics/getPNLAndVolume' import { getTotalsForUser } from './getTotalsForUser' import { Grade } from '../../../types/enum/grade' import { Address } from 'viem' diff --git a/motivator/src/server/db/schema.ts b/motivator/src/server/db/schema.ts index 6bab7a9a..762bd51c 100644 --- a/motivator/src/server/db/schema.ts +++ b/motivator/src/server/db/schema.ts @@ -1,12 +1,8 @@ -import { relations, sql } from 'drizzle-orm' import { - PgTableWithColumns, boolean, date, - decimal, doublePrecision, integer, - numeric, pgTable, text, timestamp, @@ -17,14 +13,6 @@ export const user = pgTable('users', { address: text('address').unique().primaryKey(), }) -// export const stats = pgTable('stats', { -// user_address: text('user_address') -// .references(() => user.address) -// .primaryKey(), -// actions: integer('actions').default(0), -// volume: integer('volume').default(0), -// }) - export const assessor = pgTable('assessor', { address: text('address').unique().primaryKey(), }) @@ -33,6 +21,7 @@ export const assessor_slot = pgTable('assessor_slot', { id: uuid('id').defaultRandom().unique().primaryKey(), assessor_ID: text('assessor_id').references(() => assessor.address), done: boolean('done').default(false), + // TO DELETE week: integer('week').default(1), }) @@ -54,6 +43,7 @@ export const assessor_slot_user = pgTable('assessor_slot_user', { user_address: text('user_address').references(() => user.address), }) +// TO DELETE export const statistics = pgTable('statistics', { id: uuid('id').defaultRandom().unique().primaryKey(), timestamp: timestamp('timestamp', { @@ -76,7 +66,7 @@ export const statistics = pgTable('statistics', { tvl_shorts: doublePrecision('tvl_shorts'), tvl_lps: doublePrecision('tvl_lps'), }) - +// TO DELETE export const totals = pgTable('totals', { id: uuid('id').defaultRandom().unique().primaryKey(), user_address: text('user_address').references(() => user.address), @@ -86,7 +76,7 @@ export const totals = pgTable('totals', { totalVolumePoolDai: doublePrecision('total_volume_pool_Dai'), // totalPnl: doublePrecision('total_pnl'), }) - +//TO DELETE export const offChainActions = pgTable('off_chain_actions', { id: uuid('id').defaultRandom().unique().primaryKey(), user_address: text('user_address').references(() => user.address),