Skip to content

Commit

Permalink
Merge branch 'develop' into jl/balance-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
portuu3 committed Feb 12, 2025
2 parents b8df383 + f1ae3cf commit 90de08e
Show file tree
Hide file tree
Showing 42 changed files with 1,000 additions and 966 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@typescript-eslint/utils": "^8.22.0",
"concurrently": "^8.2.2",
"concurrently": "^9.1.2",
"dotenv": "^16.3.2",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-prettier": "^5.2.1",
"ethers": "^6.12.1",
"ethers": "^6.13.5",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.3.0",
"lint-staged": "^15.4.3",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/fortune/exchange-oracle/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@tanstack/react-query": "^5.60.5",
"@tanstack/react-query-persist-client": "^5.51.11",
"axios": "^1.7.2",
"ethers": "^6.13.1",
"ethers": "^6.13.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/human-app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@synaps-io/verify-sdk": "^4.0.45",
"@tanstack/react-query": "^5.61.0",
"date-fns": "^4.1.0",
"ethers": "^6.12.0",
"ethers": "^6.13.5",
"i18next": "^23.8.2",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -71,7 +71,7 @@
"eslint-plugin-react-refresh": "^0.4.11",
"husky": "^9.1.6",
"jsdom": "^25.0.1",
"lint-staged": "^15.3.0",
"lint-staged": "^15.4.3",
"prettier": "^3.4.2",
"typescript": "^5.6.3",
"vite": "^5.4.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './user-stats-accordion';
export * from './user-stats-details';
export * from './user-stats-drawer';
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Grid from '@mui/material/Grid';
import { useEffect } from 'react';
import { t } from 'i18next';
import { UserStatsDetails } from '@/modules/worker/components/hcaptcha-labeling/user-stats-details';
import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats';
import {
TopNotificationType,
useNotification,
} from '@/shared/hooks/use-notification';
import { getErrorMessageForError } from '@/shared/errors';
import { useColorMode } from '@/shared/contexts/color-mode';
import { useHCaptchaUserStats } from '../hooks';
import { UserStatsDetails } from './user-stats-details';

const accordionWidth = { width: '284px' };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Divider, Grid, Typography } from '@mui/material';
import { t } from 'i18next';
import { RefreshIcon } from '@/shared/components/ui/icons';
import type { HCaptchaUserStatsSuccess } from '@/modules/worker/services/hcaptcha-user-stats';
import { useColorMode } from '@/shared/contexts/color-mode';
import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette';
import { useColorMode } from '@/shared/contexts/color-mode';
import { type HCaptchaUserStatsSuccess } from '../hooks/use-hcaptcha-user-stats';

export function UserStatsDetails({
stats,
refetch,
}: {
}: Readonly<{
stats: HCaptchaUserStatsSuccess;
refetch: () => void;
}) {
}>) {
const { colorPalette, isDarkMode } = useColorMode();
const statsColor = isDarkMode
? onlyDarkModeColor.additionalTextColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import Drawer from '@mui/material/Drawer';
import CssBaseline from '@mui/material/CssBaseline';
import { Grid, Typography } from '@mui/material';
import { t } from 'i18next';
import { UserStatsDetails } from '@/modules/worker/components/hcaptcha-labeling/user-stats-details';
import type { HCaptchaUserStatsSuccess } from '@/modules/worker/services/hcaptcha-user-stats';
import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats';
import { Loader } from '@/shared/components/ui/loader';
import { Alert } from '@/shared/components/ui/alert';
import { getErrorMessageForError } from '@/shared/errors';
import { type HCaptchaUserStatsSuccess, useHCaptchaUserStats } from '../hooks';
import { UserStatsDetails } from './user-stats-details';

export interface UserStatsDrawerNavigationProps {
isOpen: boolean;
Expand All @@ -17,10 +16,10 @@ export interface UserStatsDrawerNavigationProps {
function UserStatsDrawerContent({
stats,
refetch,
}: {
}: Readonly<{
stats: HCaptchaUserStatsSuccess;
refetch: () => void;
}) {
}>) {
return (
<>
<Typography variant="mobileHeaderLarge">
Expand All @@ -31,7 +30,9 @@ function UserStatsDrawerContent({
);
}

export function UserStatsDrawer({ isOpen }: UserStatsDrawerNavigationProps) {
export function UserStatsDrawer({
isOpen,
}: Readonly<UserStatsDrawerNavigationProps>) {
const {
data: hcaptchaUserStats,
error: hcaptchaUserStatsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { breakpoints } from '@/shared/styles/breakpoints';
import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user';
import { routerPaths } from '@/router/router-paths';

export function EnableLabeler() {
export function EnableLabelerPage() {
const isMobile = useIsMobile();
const { user } = useAuthenticatedUser();
const { mutate, error, isError, isPending } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ import { useIsMobile } from '@/shared/hooks/use-is-mobile';
import { env } from '@/shared/env';
import { breakpoints } from '@/shared/styles/breakpoints';
import { Counter } from '@/shared/components/ui/counter';
import { useHCaptchaUserStats } from '@/modules/worker/services/hcaptcha-user-stats';
import {
PageCardError,
PageCardLoader,
} from '@/shared/components/ui/page-card';
import { getErrorMessageForError } from '@/shared/errors';
import { useDailyHmtSpent } from '@/modules/worker/services/daily-hmt-spent';
import { getTomorrowDate } from '@/shared/helpers/date';
import { useSolveHCaptchaMutation } from '@/modules/worker/services/solve-hcaptcha';
import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user';
import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications';
import { useColorMode } from '@/shared/contexts/color-mode';
import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette';
import { routerPaths } from '@/router/router-paths';
import {
PageCardLoader,
PageCardError,
} from '@/shared/components/ui/page-card';
import { useHCaptchaUserStats, useDailyHmtSpent } from './hooks';

export function HcaptchaLabelingPage() {
const { colorPalette, isDarkMode } = useColorMode();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './use-daily-hmt-spent';
export * from './use-hcaptcha-user-stats';
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { z } from 'zod';
import { useQuery } from '@tanstack/react-query';
import { apiPaths } from '@/api/api-paths';
import { apiClient } from '@/api/api-client';
import { apiPaths } from '@/api/api-paths';

const dailyHmtSpentSchema = z.object({
spend: z.number(),
});

export type DailyHmtSpentSchemaSuccess = z.infer<typeof dailyHmtSpentSchema>;
type DailyHmtSpentResponse = z.infer<typeof dailyHmtSpentSchema>;

export async function getDailyHmtSpent() {
async function fetchDailyHmtSpent(): Promise<DailyHmtSpentResponse> {
return apiClient(apiPaths.worker.dailyHmtSpend.path, {
successSchema: dailyHmtSpentSchema,
authenticated: true,
Expand All @@ -18,8 +18,8 @@ export async function getDailyHmtSpent() {
}

export function useDailyHmtSpent() {
return useQuery({
queryFn: getDailyHmtSpent,
queryKey: ['getDailyHmtSpent'],
return useQuery<DailyHmtSpentResponse>({
queryKey: ['dailyHmtSpent'],
queryFn: fetchDailyHmtSpent,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const hcaptchaUserStatsSchema = z.object({

export type HCaptchaUserStatsSuccess = z.infer<typeof hcaptchaUserStatsSchema>;

export async function getHCaptchaUsersStats() {
async function getHCaptchaUsersStats() {
return apiClient(apiPaths.worker.hCaptchaUserStats.path, {
authenticated: true,
successSchema: hcaptchaUserStatsSchema,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './enable-labeler.page';
export * from './hcaptcha-labeling.page';
export * from './components/user-stats-accordion';
export * from './components/user-stats-drawer';

This file was deleted.

2 changes: 1 addition & 1 deletion packages/apps/human-app/frontend/src/router/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
} from '@/shared/components/layout/drawer-menu-items/drawer-menu-items-worker';
import { operatorDrawerBottomMenuItems } from '@/shared/components/layout/drawer-menu-items/drawer-menu-items-operator';
import { browserAuthProvider } from '@/shared/contexts/browser-auth-provider';
import { UserStatsDrawer } from '@/modules/worker/components/hcaptcha-labeling/user-stats-drawer';
import { useAuth } from '@/modules/auth/hooks/use-auth';
import { UserStatsDrawer } from '@/modules/worker/hcaptcha-labeling';
import { routerPaths } from './router-paths';

export function Router() {
Expand Down
23 changes: 7 additions & 16 deletions packages/apps/human-app/frontend/src/router/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import type { RouteProps } from 'react-router-dom';
import { t } from 'i18next';
import { ProtectedPage } from '@/modules/worker/views/protected/protected.page';
import { SignInWorkerPage } from '@/modules/signin/worker';
import { routerPaths } from '@/router/router-paths';
import { SendResetLinkWorkerSuccessPage } from '@/modules/worker/views/send-reset-link/send-reset-link-success.page';
import { ResetPasswordWorkerPage } from '@/modules/worker/views/reset-password/reset-password.page';
import { SendResetLinkWorkerPage } from '@/modules/worker/views/send-reset-link/send-reset-link.page';
import { ResetPasswordWorkerSuccessPage } from '@/modules/worker/views/reset-password/reset-password-success.page';
import { JobsDiscoveryPage } from '@/modules/worker/views/jobs-discovery/jobs-discovery.page';
import { JobsPage } from '@/modules/worker/views/jobs/jobs.page';
import { EnableLabeler } from '@/modules/worker/views/hcaptcha-labeling/enable-labeler.page';
import { HcaptchaLabelingPage } from '@/modules/worker/views/hcaptcha-labeling/hcaptcha-labeling.page';
import { UserStatsAccordion } from '@/modules/worker/components/hcaptcha-labeling/user-stats-accordion';
import { env } from '@/shared/env';
import { RegistrationPage } from '@/modules/worker/views/registration/registration.page';
import { WorkerProfilePage } from '@/modules/worker/components/profile/profile.page';
Expand All @@ -31,7 +26,13 @@ import { ConnectWalletOperatorPage } from '@/modules/operator/views/sign-up/conn
import { OperatorProfilePage } from '@/modules/operator/views/profile/profile.page';
import { Playground } from '@/modules/playground/views/playground.page';
import { HomePage } from '@/modules/homepage/views/home.page';
import {
HcaptchaLabelingPage,
UserStatsAccordion,
EnableLabelerPage,
} from '@/modules/worker/hcaptcha-labeling';
import { SignUpWorkerPage } from '@/modules/signup/worker';
import { SignInWorkerPage } from '@/modules/signin/worker';

export const unprotectedRoutes: RouteProps[] = [
{
Expand Down Expand Up @@ -84,16 +85,6 @@ export const protectedRoutes: {
routerProps: RouteProps;
pageHeaderProps: PageHeaderProps;
}[] = [
{
routerProps: {
path: '/protected',
element: <ProtectedPage />,
},
pageHeaderProps: {
headerIcon: <ProfileIcon />,
headerText: t('protectedPagesHeaders.profile'),
},
},
{
routerProps: {
path: routerPaths.worker.jobsDiscovery,
Expand Down Expand Up @@ -152,7 +143,7 @@ export const protectedRoutes: {
{
routerProps: {
path: routerPaths.worker.enableLabeler,
element: <EnableLabeler />,
element: <EnableLabelerPage />,
},
pageHeaderProps: {
headerIcon: <HandIcon />,
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/human-app/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"cache-manager-redis-yet": "^5.1.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"ethers": "^6.12.1",
"ethers": "^6.13.5",
"joi": "^17.13.3",
"jsonwebtoken": "^9.0.2",
"jwt-decode": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/apps/job-launcher/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"axios": "^1.1.3",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.12",
"ethers": "^6.12.1",
"ethers": "^6.13.5",
"file-saver": "^2.0.5",
"formik": "^2.4.2",
"jwt-decode": "^4.0.0",
Expand All @@ -36,7 +36,7 @@
"wagmi": "^2.14.6",
"web-vitals": "^4.2.2",
"xml2js": "^0.6.2",
"yup": "^1.2.0"
"yup": "^1.6.1"
},
"scripts": {
"lint": "eslint \"**/*.{ts,tsx}\"",
Expand Down
8 changes: 4 additions & 4 deletions packages/apps/reputation-oracle/server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ S3_SECRET_KEY=devdevdev
S3_BUCKET=reputation
S3_USE_SSL=false

# Sendgrid
SENDGRID_API_KEY=SG.testkey
SENDGRID_FROM_EMAIL=[email protected]
SENDGRID_FROM_NAME="Reputation oracle"
# Email
SENDGRID_API_KEY=
EMAIL_FROM=[email protected]
EMAIL_FROM_NAME="Reputation oracle"

# Web3
WEB3_ENV=testnet
Expand Down
3 changes: 2 additions & 1 deletion packages/apps/reputation-oracle/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"dotenv": "^16.3.2",
"ethers": "^6.13.1",
"ethers": "^6.13.5",
"helmet": "^7.1.0",
"joi": "^17.13.3",
"json-stable-stringify": "^1.1.1",
Expand All @@ -69,6 +69,7 @@
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@faker-js/faker": "^9.4.0",
"@golevelup/ts-jest": "^0.6.1",
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/reputation-oracle/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { QualificationModule } from './modules/qualification/qualification.modul
import { EscrowCompletionModule } from './modules/escrow-completion/escrow-completion.module';
import { WebhookIncomingModule } from './modules/webhook/webhook-incoming.module';
import { WebhookOutgoingModule } from './modules/webhook/webhook-outgoing.module';
import { EmailModule } from './modules/email/module';

@Module({
providers: [
Expand Down Expand Up @@ -68,6 +69,7 @@ import { WebhookOutgoingModule } from './modules/webhook/webhook-outgoing.module
HCaptchaModule,
QualificationModule,
EscrowCompletionModule,
EmailModule,
],
controllers: [AppController],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ServerConfigService } from './server-config.service';
import { DatabaseConfigService } from './database-config.service';
import { PGPConfigService } from './pgp-config.service';
import { S3ConfigService } from './s3-config.service';
import { SendgridConfigService } from './sendgrid-config.service';
import { EmailConfigService } from './email-config.service';
import { Web3ConfigService } from './web3-config.service';
import { ReputationConfigService } from './reputation-config.service';
import { KycConfigService } from './kyc-config.service';
Expand All @@ -23,7 +23,7 @@ import { HCaptchaConfigService } from './hcaptcha-config.service';
Web3ConfigService,
S3ConfigService,
ReputationConfigService,
SendgridConfigService,
EmailConfigService,
KycConfigService,
PGPConfigService,
NetworkConfigService,
Expand All @@ -37,7 +37,7 @@ import { HCaptchaConfigService } from './hcaptcha-config.service';
Web3ConfigService,
S3ConfigService,
ReputationConfigService,
SendgridConfigService,
EmailConfigService,
KycConfigService,
PGPConfigService,
NetworkConfigService,
Expand Down
Loading

0 comments on commit 90de08e

Please sign in to comment.