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

File architecture #144

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ 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'
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
168 changes: 84 additions & 84 deletions motivator/src/components/assessor/DataTableAssessor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -78,90 +78,90 @@ export const columns: ColumnDef<UserDatatable>[] = [
},
},

{
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 (
<div className="flex gap-6 items-center justify-evenly">
<div className="flex items-center">
{' '}
<p className="[writing-mode:vertical-lr] rotate-180">
Volume
</p>
<div className="flex flex-col">
<div className="items-center flex-col flex">
<p className="font-extralight text-center text-xs">
Pool ETH
</p>
<div className="flex items-center gap-1">
<EthLogo className="h-4 w-4" />
<p className="font-bold">
{transformNumberK(
Number(
stat.totals.totalVolumePoolEth
)
)}
</p>
</div>
</div>
<div className="items-center flex-col flex">
<p className="font-extralight text-center text-xs">
Pool Dai
</p>
<div className="flex items-center gap-1">
<DaiLogo className="h-4 w-4" />
<p className="font-bold">
{transformNumberK(
Number(
stat.totals.totalVolumePoolDai
)
)}
</p>
</div>
</div>
</div>
</div>
// return (
// <div className="flex gap-6 items-center justify-evenly">
// <div className="flex items-center">
// {' '}
// <p className="[writing-mode:vertical-lr] rotate-180">
// Volume
// </p>
// <div className="flex flex-col">
// <div className="items-center flex-col flex">
// <p className="font-extralight text-center text-xs">
// Pool ETH
// </p>
// <div className="flex items-center gap-1">
// <EthLogo className="h-4 w-4" />
// <p className="font-bold">
// {transformNumberK(
// Number(
// stat.totals.totalVolumePoolEth
// )
// )}
// </p>
// </div>
// </div>
// <div className="items-center flex-col flex">
// <p className="font-extralight text-center text-xs">
// Pool Dai
// </p>
// <div className="flex items-center gap-1">
// <DaiLogo className="h-4 w-4" />
// <p className="font-bold">
// {transformNumberK(
// Number(
// stat.totals.totalVolumePoolDai
// )
// )}
// </p>
// </div>
// </div>
// </div>
// </div>

<div className="items-center flex-col flex">
<p className="font-extralight text-center text-xs">
Actions
</p>
<div className="flex items-center">
{/* <EthLogo className="h-4 w-4" /> */}
<p className="font-bold">
{Number(stat.totals.totalActions)}
</p>
</div>
</div>
</div>
)
},
},
// <div className="items-center flex-col flex">
// <p className="font-extralight text-center text-xs">
// Actions
// </p>
// <div className="flex items-center">
// {/* <EthLogo className="h-4 w-4" /> */}
// <p className="font-bold">
// {Number(stat.totals.totalActions)}
// </p>
// </div>
// </div>
// </div>
// )
// },
// },

{
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 (
<DialogUserData
user={{
addressName: stat.totals.user_address,
stat: stat,
pnl: pnl,
id: row.index.toString(),
reward: reward?.reward,
status: reward?.status,
}}
/>
)
},
},
// return (
// <DialogUserData
// user={{
// addressName: stat.totals.user_address,
// stat: stat,
// pnl: pnl,
// id: row.index.toString(),
// reward: reward?.reward,
// status: reward?.status,
// }}
// />
// )
// },
// },
{
accessorKey: 'reward',
enableHiding: true,
Expand Down
3 changes: 2 additions & 1 deletion motivator/src/components/assessor/DialogConfirmSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion motivator/src/components/assessor/TotalPoints.tsx
Original file line number Diff line number Diff line change
@@ -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 = {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading
Loading