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

v0.69.58 #292

Open
wants to merge 82 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
8b89a52
fix acc reset on not auth
ivopaunov Aug 28, 2024
b144502
fix cmp details layout
ivopaunov Aug 28, 2024
89dce20
fix access and refresh tokens update logic
ivopaunov Aug 28, 2024
81232f8
log out on refresh token expire
ivopaunov Aug 28, 2024
4f6f9e2
add logOut to account context
ivopaunov Aug 28, 2024
f19a988
fix create campaign
ivopaunov Aug 28, 2024
9cc4cfd
fix log out
ivopaunov Aug 29, 2024
1ab4dea
remove redundant callback for login btn
ivopaunov Aug 29, 2024
dc0bc1f
wip: fixing login flow and access tokens update
ivopaunov Aug 29, 2024
55d5c90
fix account context loaded state
ivopaunov Aug 29, 2024
f1f72e2
fix auth router
ivopaunov Aug 29, 2024
ac117bd
fix dashboard table loading state
ivopaunov Aug 29, 2024
a53d931
update access tokens with timeout fn before expire no on request
ivopaunov Aug 30, 2024
855a633
cleanup and fix one extra update at campaigns data context
ivopaunov Aug 30, 2024
98f5ba5
Merge pull request #281 from AmbireTech/auth-fix
ivopaunov Aug 30, 2024
2f4b9d1
v0.69.50
ivopaunov Aug 30, 2024
6800bc2
cleanup logs
ivopaunov Aug 30, 2024
8b4591f
fix table keys
ivopaunov Aug 30, 2024
80871c3
wip: fixing access token if tab not open
ivopaunov Aug 30, 2024
daa85da
fix access tokens update
ivopaunov Sep 1, 2024
8961fa4
fix crash on notifications when error provided
ivopaunov Sep 1, 2024
8baa74f
Merge pull request #282 from AmbireTech/auth-fix
ivopaunov Sep 1, 2024
2a5b984
v0.69.51
ivopaunov Sep 1, 2024
e4e8e8f
fix auth errors and notifications
ivopaunov Sep 2, 2024
71182ca
fix side nav links
ivopaunov Sep 2, 2024
87a7d6a
update analytics err notification
ivopaunov Sep 2, 2024
f5cce55
cleanup and update account context
ivopaunov Sep 2, 2024
774b190
Merge pull request #284 from AmbireTech/auth-fix
ivopaunov Sep 2, 2024
cb79da1
v0.69.52
ivopaunov Sep 2, 2024
f706318
fix - analytics extra update #285
ivopaunov Sep 3, 2024
a0a8523
wip: adding error status to analytics data
ivopaunov Sep 4, 2024
2547be9
add error to useCampaignsAnalyticsData
ivopaunov Sep 5, 2024
87933fa
add error to CustomTable
ivopaunov Sep 5, 2024
1e28986
add error to analytics tables
ivopaunov Sep 5, 2024
6e2566f
admin analytics add error to data table
ivopaunov Sep 5, 2024
231f1e9
Merge pull request #287 from AmbireTech/analytics-error-status
ivopaunov Sep 5, 2024
2bca367
v0.69.53
ivopaunov Sep 5, 2024
6664304
update and fix loading overlay styles and logic
ivopaunov Sep 5, 2024
2f187cd
Merge pull request #288 from AmbireTech/analytics-error-status
ivopaunov Sep 5, 2024
666550b
v0.69.54
ivopaunov Sep 5, 2024
352d06b
allow robots v 0.69.55
ivopaunov Sep 5, 2024
e5322f6
wip: cleanup and fix billing pdf-s
ivopaunov Sep 9, 2024
6406148
fix billing printable styles
ivopaunov Sep 9, 2024
8b9117e
update default Text to span
ivopaunov Sep 10, 2024
0e009f6
wip: cleanup billing pdfs
ivopaunov Sep 10, 2024
1dbf657
cleanup and fix invoices
ivopaunov Sep 10, 2024
5d629ad
cleanup statement when no data
ivopaunov Sep 10, 2024
9bd6f2e
update admin analytics layout
ivopaunov Sep 10, 2024
496f8b2
update billing table styles
ivopaunov Sep 10, 2024
c69c3bd
Merge pull request #290 from AmbireTech/print-fix
ivopaunov Sep 10, 2024
0aca492
v0.69.56
ivopaunov Sep 10, 2024
220d1f7
fix side nav and billing details texts
ivopaunov Sep 10, 2024
55a84f4
v0.69.57
ivopaunov Sep 10, 2024
e80fe65
fix table actions
ivopaunov Sep 13, 2024
0e6e6da
update admin - account info form
ivopaunov Sep 13, 2024
6ec2fc3
update admin - account details
ivopaunov Sep 13, 2024
b7262bb
update admin - account deposit form
ivopaunov Sep 13, 2024
710e164
Merge pull request #291 from AmbireTech/misc-bug-fixes
ivopaunov Sep 13, 2024
9e9ce74
v0.69.58
ivopaunov Sep 13, 2024
7eab8ce
update custom table types and mapping
ivopaunov Sep 16, 2024
c2f699c
wip: upgrading table data
ivopaunov Sep 17, 2024
a4220ac
fix table cols
ivopaunov Sep 17, 2024
b380203
wip: table sorting
ivopaunov Sep 17, 2024
8a5a3dd
add sort btn and actions to table, remove mobile styles
ivopaunov Sep 17, 2024
3cfaf0b
wip: table sorting fixing and optimization
ivopaunov Sep 18, 2024
93a591d
wip: updating table data
ivopaunov Sep 18, 2024
87114c8
wip: updating tables data
ivopaunov Sep 18, 2024
7b8fc08
fix sorting heading
ivopaunov Sep 18, 2024
fdede8e
fix edit campaign advanced targeting
ivopaunov Sep 18, 2024
1761902
fix dashboard period sorting value
ivopaunov Sep 19, 2024
ea84ba9
fix admin validator sort values
ivopaunov Sep 19, 2024
0baa2e2
Merge pull request #293 from AmbireTech/table-sorting
ivopaunov Sep 19, 2024
0288bbd
v0.69.59
ivopaunov Sep 19, 2024
ea9f3dc
add default sortings
ivopaunov Sep 20, 2024
d812b48
fix login logo color
ivopaunov Sep 20, 2024
31432e9
fix account activity data
ivopaunov Sep 20, 2024
84ed9ce
align number to tight in the table
ivopaunov Sep 20, 2024
355d2bc
Merge pull request #294 from AmbireTech/table-sorting
ivopaunov Sep 20, 2024
4fa771a
v0.69.60
ivopaunov Sep 20, 2024
d53ae6c
add filter by placement for admin analytics
ivopaunov Sep 24, 2024
32295d6
Merge pull request #296 from AmbireTech/bidding-mode
ivopaunov Sep 24, 2024
52eeb86
v0.69.61
ivopaunov Sep 24, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adex-interface",
"version": "0.69.49",
"version": "0.69.61",
"private": true,
"dependencies": {
"@ambire/login-sdk-core": "^0.0.21",
Expand Down
2 changes: 1 addition & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow: /
Allow: /
7 changes: 2 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ function GlobalStyles() {
<Global
styles={(theme: MantineTheme) => ({
[theme.other.media.print]: {
body: {
visibility: 'hidden'
},
'body #printable': {
visibility: 'visible'
'#root': {
display: 'none'
}
}
})}
Expand Down
21 changes: 17 additions & 4 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Billing from 'components/Billing'
import GetStarted from 'components/GetStarted'
import CampaignAnalytics from 'components/CampaignAnalytics'
import { createBrowserRouter, Navigate, useLocation, useRouteError, Link } from 'react-router-dom'
import { Button } from '@mantine/core'
import { Button, Loader, Center } from '@mantine/core'

import useAccount from 'hooks/useAccount'
import Deposit from 'components/Deposit'
Expand All @@ -33,14 +33,27 @@ function ErrorBoundary() {
}

function RequireAuth({ children, admin }: { children: JSX.Element; admin?: boolean }) {
const { authenticated, isAdmin } = useAccount()
const {
authenticated,
isAdmin,
adexAccount: { loaded }
} = useAccount()

const location = useLocation()

if (!loaded) {
return (
<Center>
<Loader type="dots" />
</Center>
)
}

if (!authenticated) {
return <Navigate to="/login" state={{ from: location }} replace />
}

if (admin && isAdmin) {
if (admin && !isAdmin) {
return <Navigate to="/404" state={{ from: location }} replace />
}

Expand Down Expand Up @@ -107,7 +120,7 @@ export const router = createBrowserRouter(
{
path: 'admin/:tabValue',
element: (
<RequireAuth>
<RequireAuth admin>
<CampaignsDataProvider type="admin">
<AdminPanel />
</CampaignsDataProvider>
Expand Down
30 changes: 9 additions & 21 deletions src/components/AdminPanel/AccountDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useMemo } from 'react'
import { SimpleGrid, Box, Title, Paper, Loader, Center } from '@mantine/core'
import { SimpleGrid, Box, Loader, Center, Fieldset } from '@mantine/core'
import useAdmin from 'hooks/useAdmin'
import { useParams } from 'react-router-dom'
import Dashboard from 'components/Dashboard'
Expand Down Expand Up @@ -39,34 +39,22 @@ function AccountDetails() {
// { maxWidth: 'md', cols: 1, spacing: 'xl' }
// ]}
>
<Paper p="sm" withBorder>
<Title order={5} c="brand">
Account info form
</Title>
<Fieldset legend="Account info form">
<AccountInfo accountData={accountData} />
</Paper>
<Paper p="sm" withBorder>
<Title order={5} c="brand">
Deposit form
</Title>
</Fieldset>
<Fieldset legend="Deposit form">
<AdminDeposit accountData={accountData} />
</Paper>
</Fieldset>
</SimpleGrid>
<SimpleGrid spacing="xl" mt="xl">
<Paper p="sm" withBorder>
<Title order={5} c="brand">
Activity
</Title>
<Fieldset legend="Activity">
<FundsActivity accountData={accountData} />
</Paper>
</Fieldset>
</SimpleGrid>
<SimpleGrid spacing="xl" mt="xl">
<Paper p="sm" withBorder>
<Title order={5} c="brand">
Campaigns
</Title>
<Fieldset legend="Campaigns">
<Dashboard isAdminPanel accountId={accountId} />
</Paper>
</Fieldset>
</SimpleGrid>
</Box>
)
Expand Down
40 changes: 26 additions & 14 deletions src/components/AdminPanel/AccountDetailsElements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { useMemo } from 'react'
import { Account } from 'types'
import { Box, Text, MantineColor } from '@mantine/core'

import CustomTable, { TableElement } from 'components/common/CustomTable'
import CustomTable, { DataElement } from 'components/common/CustomTable'
import { parseBigNumTokenAmountToDecimal, toOperationEntry } from 'helpers'

export const FundsActivity = ({ accountData }: { accountData: Account }) => {
const elements = useMemo(() => {
const data: TableElement['elements'] = [
const data: DataElement[] = [
...accountData.fundsDeposited.deposits.map((x) => toOperationEntry('deposit', x)),
...accountData.fundsOnCampaigns.perCampaign.map((x) => toOperationEntry('campaignOpen', x)),
...accountData.refundsFromCampaigns.perCampaign.map((x) =>
Expand All @@ -16,21 +16,32 @@ export const FundsActivity = ({ accountData }: { accountData: Account }) => {
]
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())

.map((x) => {
.map((x, i) => {
const sign = x.type === 'campaignOpen' ? '-' : '+'
const color: MantineColor = sign === '-' ? 'darkred' : 'darkgreen'
return {
name: <Text c={color} tt="capitalize" fw="bold">{`${sign} ${x.name}`}</Text>,
date: x.date?.toLocaleDateString() || '',
amount: (
<Text c={color} tt="capitalize" fw="bold">{`${sign} ${parseBigNumTokenAmountToDecimal(
x.amount,
x.token.decimals
)}`}</Text>
),
id: x.id + i,
columns: [
{
value: x.type,
element: <Text c={color} tt="capitalize" fw="bold">{`${sign} ${x.name}`}</Text>
},
{ value: x.date.getTime(), element: x.date?.toLocaleDateString() || '' },
{
value: Number(x.amount),
element: (
<Text
c={color}
tt="capitalize"
fw="bold"
style={{ whiteSpace: 'nowrap' }}
>{`${sign} ${parseBigNumTokenAmountToDecimal(x.amount, x.token.decimals)}`}</Text>
)
},

token: x.token.name,
actionId: x.id
{ value: x.token.name },
{ value: x.id }
]
}
})

Expand All @@ -43,7 +54,8 @@ export const FundsActivity = ({ accountData }: { accountData: Account }) => {
<Box>
<CustomTable
headings={['Type', 'Date', 'Amount', 'Token', 'Tx/Campaign id']}
elements={elements}
data={elements}
defaultSortIndex={1}
pageSize={10}
/>
</Box>
Expand Down
61 changes: 40 additions & 21 deletions src/components/AdminPanel/Accounts.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useMemo, useCallback, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Loader, Box, Badge, TextInput, Stack, Group } from '@mantine/core'
import { Box, Badge, TextInput, Stack, Group, LoadingOverlay } from '@mantine/core'

import CustomTable from 'components/common/CustomTable'
import CustomTable, { DataElement } from 'components/common/CustomTable'
import useAdmin from 'hooks/useAdmin'
import VisibilityIcon from 'resources/icons/Visibility'

Expand Down Expand Up @@ -49,7 +49,7 @@ const AdminAnalytics = () => {
).toLocaleString()
const totalAccounts = accArr.length

const elements = accArr
const elements: DataElement[] = accArr
.filter((x) =>
(
x.name +
Expand Down Expand Up @@ -80,19 +80,33 @@ const AdminAnalytics = () => {
.map((a) => {
return {
id: a.id,
accountId: a.name || a.id,
verified: a?.billingDetails?.verified ? '✅' : '❌',
email: a.info?.email,
balance: parseBigNumTokenAmountToDecimal(
a.availableBalance,
a.balanceToken.decimals
).toFixed(2),
campaigns: a.fundsOnCampaigns.perCampaign.length,
fudsOnCampaigns: parseBigNumTokenAmountToDecimal(
a.fundsOnCampaigns.total - a.refundsFromCampaigns.total,
a.balanceToken.decimals
).toFixed(2),
created: new Date(a.created).toLocaleDateString()
columns: [
{ value: a.name || a.id },
{
value: a?.billingDetails?.verified ? 1 : 0,
element: a?.billingDetails?.verified ? '✅' : '❌'
},
{ value: a.info?.email || '' },
{
value: a.availableBalance,
element: parseBigNumTokenAmountToDecimal(
a.availableBalance,
a.balanceToken.decimals
).toFixed(2)
},
{ value: a.fundsOnCampaigns.perCampaign.length },
{
value: a.fundsOnCampaigns.total - a.refundsFromCampaigns.total,
element: parseBigNumTokenAmountToDecimal(
a.fundsOnCampaigns.total - a.refundsFromCampaigns.total,
a.balanceToken.decimals
).toFixed(2)
},
{
value: new Date(a.created).getTime(),
element: new Date(a.created).toLocaleDateString()
}
]
}
})

Expand Down Expand Up @@ -125,11 +139,10 @@ const AdminAnalytics = () => {
]
}, [handlePreview])

return initialDataLoading ? (
<Loader size="xl" type="dots" color="violet" />
) : (
return (
<Stack>
<Group align="center" justify="left" gap="xs" mb="md" wrap="wrap">
<Group align="center" justify="left" gap="sm" mb="md" wrap="wrap" pos="relative">
<LoadingOverlay visible={initialDataLoading} loaderProps={{ children: ' ' }} />
<Box>Totals: </Box>
<Badge leftSection="Accounts" size="lg">
({data.totalAccounts})
Expand All @@ -148,7 +161,13 @@ const AdminAnalytics = () => {
miw={420}
/>
</Group>
<CustomTable headings={headings} elements={data.elements} pageSize={10} actions={actions} />
<CustomTable
headings={headings}
data={data.elements}
pageSize={10}
actions={actions}
loading={initialDataLoading}
/>
</Stack>
)
}
Expand Down
Loading
Loading