Skip to content

Commit 409ed3f

Browse files
authored
Release 2025-07-25 (#3471)
2 parents af8153a + 1700d88 commit 409ed3f

File tree

57 files changed

+1240
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1240
-674
lines changed

packages/apps/fortune/exchange-oracle/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"pg": "8.13.1",
5555
"reflect-metadata": "^0.2.2",
5656
"rxjs": "^7.2.0",
57-
"typeorm": "^0.3.23",
57+
"typeorm": "^0.3.25",
5858
"typeorm-naming-strategies": "^4.1.0"
5959
},
6060
"devDependencies": {

packages/apps/human-app/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@emotion/styled": "^11.11.0",
2121
"@faker-js/faker": "^9.7.0",
2222
"@fontsource/inter": "^5.0.17",
23+
"@fontsource/roboto": "^5.2.6",
2324
"@hcaptcha/react-hcaptcha": "^0.3.6",
2425
"@hookform/resolvers": "^5.0.1",
2526
"@human-protocol/sdk": "workspace:*",

packages/apps/human-app/frontend/src/main.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import '@fontsource/inter/400.css';
1212
import '@fontsource/inter/500.css';
1313
import '@fontsource/inter/600.css';
1414
import '@fontsource/inter/800.css';
15+
import '@fontsource/roboto';
16+
import '@fontsource/roboto/400.css';
17+
import '@fontsource/roboto/500.css';
1518
import { WalletConnectProvider } from '@/shared/contexts/wallet-connect';
1619
import { Web3AuthProvider } from '@/modules/auth-web3/context/web3-auth-context';
1720
import { JWTExpirationCheck } from '@/shared/contexts/jwt-expiration-check';

packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import AccessTimeIcon from '@mui/icons-material/AccessTime';
2-
import { Grid, Link as MuiLink, Typography } from '@mui/material';
2+
import { Box, Grid, Link as MuiLink, Typography } from '@mui/material';
33
import { useEffect, useState } from 'react';
44
import { useTranslation } from 'react-i18next';
55
import { env } from '@/shared/env';
66
import { useColorMode } from '@/shared/contexts/color-mode';
7-
import { useIsMobile } from '@/shared/hooks/use-is-mobile';
87
import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks';
98
import { useActiveProposalQuery } from '../hooks/use-active-proposal-query';
109

@@ -13,8 +12,8 @@ export function GovernanceBanner() {
1312
const { data, isLoading, isError } = useActiveProposalQuery();
1413
const { isVerificationCompleted } = useWorkerIdentityVerificationStatus();
1514
const { colorPalette } = useColorMode();
15+
const { text, background } = colorPalette.banner;
1616
const [timeRemaining, setTimeRemaining] = useState('00:00:00');
17-
const isMobile = useIsMobile('lg');
1817

1918
useEffect(() => {
2019
if (!data?.deadline) return;
@@ -55,52 +54,41 @@ export function GovernanceBanner() {
5554
return (
5655
<Grid
5756
container
58-
alignItems="center"
59-
sx={{
60-
backgroundColor: colorPalette.banner.background.primary,
61-
color: colorPalette.banner.text.secondary,
62-
borderRadius: '8px',
63-
padding: '16px',
64-
gap: '16px',
65-
mt: -8,
66-
}}
67-
direction={isMobile ? 'column' : 'row'}
57+
alignItems={{ xs: 'flex-start', sm: 'center' }}
58+
justifyContent={{ xs: 'flex-start', sm: 'space-between' }}
59+
bgcolor={background.primary}
60+
color={text.secondary}
61+
borderRadius="8px"
62+
p={2}
63+
gap={2}
64+
mt={{ xs: 0, md: -8 }}
6865
>
6966
{/* Left side: Countdown & "X votes" */}
7067
<Grid
7168
item
7269
xs={12}
7370
sm="auto"
74-
sx={{ display: 'flex', alignItems: 'center' }}
71+
display="flex"
72+
alignItems="center"
73+
flexWrap={{ xs: 'wrap', sm: 'nowrap' }}
74+
gap={{ xs: 2, md: 0 }}
7575
>
76-
<AccessTimeIcon sx={{ mr: 1 }} />
77-
<Typography
78-
variant="body2"
79-
sx={{
80-
color: colorPalette.banner.text.secondary,
81-
}}
82-
>
83-
{t('governance.timeToReveal', 'Time to reveal vote')}:
84-
</Typography>
85-
86-
<Typography
87-
variant="body1"
88-
sx={{
89-
ml: 1,
90-
color: colorPalette.banner.text.primary,
91-
}}
92-
>
93-
{timeRemaining}
94-
</Typography>
76+
<Box display="flex" alignItems="center">
77+
<AccessTimeIcon sx={{ mr: 1 }} />
78+
<Typography variant="body2" color={text.secondary}>
79+
{t('governance.timeToReveal', 'Time to reveal vote')}:
80+
</Typography>
81+
<Typography variant="body1" ml={1} color={text.primary}>
82+
{timeRemaining}
83+
</Typography>
84+
</Box>
9585
<Typography
9686
variant="body1"
97-
sx={{
98-
ml: 8,
99-
color: colorPalette.banner.text.primary,
100-
backgroundColor: colorPalette.banner.background.secondary,
101-
borderRadius: '8px',
102-
padding: '4px 8px',
103-
}}
87+
ml={{ xs: 0, md: 8 }}
88+
color={text.primary}
89+
bgcolor={background.secondary}
90+
borderRadius="8px"
91+
padding="4px 8px"
10492
>
10593
{totalVotes} {t('governance.votes', 'votes')}
10694
</Typography>
@@ -111,22 +99,16 @@ export function GovernanceBanner() {
11199
item
112100
xs={12}
113101
sm
114-
sx={{
115-
display: 'flex',
116-
justifyContent: isMobile ? 'flex-start' : 'flex-end',
117-
mt: isMobile ? 2 : 0,
118-
mr: isMobile ? 0 : 2,
119-
}}
102+
display="flex"
103+
justifyContent={{ xs: 'flex-start', sm: 'flex-end' }}
120104
>
121105
<MuiLink
122106
href={env.VITE_GOVERNANCE_URL}
123107
underline="none"
124108
target="_blank"
125109
rel="noopener noreferrer"
126-
sx={{
127-
fontWeight: 500,
128-
color: colorPalette.banner.text.secondary,
129-
}}
110+
color={text.secondary}
111+
fontWeight={500}
130112
>
131113
{t('governance.moreDetails', 'More details')} &rarr;
132114
</MuiLink>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useMutation } from '@tanstack/react-query';
2+
import { ApiClientError } from '@/api/http-api-client';
3+
import * as jobsService from '../../services/jobs.service';
4+
import type { ReportAbuseBody } from '../../types';
5+
6+
interface ReportAbuseMutationOptions {
7+
onError?: (status: number) => void;
8+
}
9+
10+
export function useReportAbuseMutation({
11+
onError,
12+
}: ReportAbuseMutationOptions) {
13+
return useMutation({
14+
mutationFn: (data: ReportAbuseBody) => jobsService.reportAbuse(data),
15+
mutationKey: ['reportAbuse'],
16+
onError: (error) => {
17+
if (error instanceof ApiClientError) {
18+
onError?.(error.status);
19+
}
20+
},
21+
});
22+
}

packages/apps/human-app/frontend/src/modules/worker/jobs/components/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export * from './evm-address';
22
export * from './jobs-tab-panel';
33
export * from './my-jobs-table-actions';
44
export * from './escrow-address-search-form';
5-
export * from './reject-button';
65
export * from './reward-amount';
76
export * from './sorting';
7+
export * from './more-button';
8+
export * from './report-abuse-modal';
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/* eslint-disable camelcase -- ...*/
2+
import { useState } from 'react';
3+
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
4+
import { Button, MenuList, ListItemButton, Popover } from '@mui/material';
5+
import { useParams } from 'react-router-dom';
6+
import { useTranslation } from 'react-i18next';
7+
import { useModal } from '@/shared/contexts/modal-context';
8+
import { useIsMobile } from '@/shared/hooks/use-is-mobile';
9+
import { useResignJobMutation } from '../my-jobs/hooks';
10+
import { type MyJob } from '../schemas';
11+
import { ReportAbuseModal } from './report-abuse-modal';
12+
13+
interface MoreButtonProps {
14+
job: MyJob;
15+
isDisabled: boolean;
16+
}
17+
18+
export function MoreButton({ job, isDisabled }: MoreButtonProps) {
19+
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
20+
const { address: oracleAddress } = useParams<{ address: string }>();
21+
const { mutate: rejectTaskMutation } = useResignJobMutation();
22+
const { openModal, closeModal } = useModal();
23+
const isMobile = useIsMobile();
24+
const { t } = useTranslation();
25+
26+
const isOpen = Boolean(anchorEl);
27+
28+
const handleCancelTask = () => {
29+
setAnchorEl(null);
30+
rejectTaskMutation({
31+
oracle_address: oracleAddress ?? '',
32+
assignment_id: job.assignment_id,
33+
});
34+
};
35+
36+
const handleOpenReportAbuseModal = () => {
37+
setAnchorEl(null);
38+
openModal({
39+
content: (
40+
<ReportAbuseModal
41+
close={closeModal}
42+
escrowAddress={job.escrow_address}
43+
chainId={job.chain_id}
44+
/>
45+
),
46+
showCloseButton: false,
47+
});
48+
};
49+
50+
return (
51+
<>
52+
<Button
53+
disabled={isDisabled}
54+
sx={{
55+
minWidth: 'unset',
56+
width: { xs: '48px', md: '30px' },
57+
height: { xs: '48px', md: '30px' },
58+
p: 1,
59+
border: isMobile ? '1px solid #858ec6' : 'none',
60+
borderRadius: '4px',
61+
color: '#858ec6',
62+
}}
63+
onClick={(e) => {
64+
!isDisabled && setAnchorEl(e.currentTarget);
65+
}}
66+
>
67+
<MoreHorizIcon />
68+
</Button>
69+
<Popover
70+
open={isOpen}
71+
anchorEl={anchorEl}
72+
onClose={() => {
73+
setAnchorEl(null);
74+
}}
75+
anchorOrigin={{
76+
vertical: isMobile ? 'top' : 'bottom',
77+
horizontal: 'right',
78+
}}
79+
transformOrigin={{
80+
vertical: isMobile ? 'bottom' : 'top',
81+
horizontal: 'right',
82+
}}
83+
slotProps={{
84+
paper: {
85+
elevation: 8,
86+
sx: {
87+
mt: isMobile ? -1 : 1,
88+
},
89+
},
90+
}}
91+
>
92+
<MenuList>
93+
<ListItemButton onClick={handleCancelTask}>
94+
{t('worker.reportAbuse.cancel')}
95+
</ListItemButton>
96+
<ListItemButton onClick={handleOpenReportAbuseModal}>
97+
{t('worker.reportAbuse.reportAbuse')}
98+
</ListItemButton>
99+
</MenuList>
100+
</Popover>
101+
</>
102+
);
103+
}
Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/* eslint-disable camelcase -- ...*/
2-
import { Link, useParams } from 'react-router-dom';
1+
import { Link } from 'react-router-dom';
32
import { useTranslation } from 'react-i18next';
43
import { TableButton } from '@/shared/components/ui/table-button';
5-
import { useResignJobMutation } from '../my-jobs/hooks';
64
import { MyJobStatus } from '../types';
75
import { type MyJob } from '../schemas';
8-
import { RejectButton } from './reject-button';
6+
import { MoreButton } from './more-button';
97

108
interface MyJobsTableRejectActionProps {
119
job: MyJob;
@@ -15,10 +13,7 @@ export function MyJobsTableActions({
1513
job,
1614
}: Readonly<MyJobsTableRejectActionProps>) {
1715
const { t } = useTranslation();
18-
const { mutate: rejectTaskMutation, isPending: isRejectPending } =
19-
useResignJobMutation();
20-
const { address: oracleAddress } = useParams<{ address: string }>();
21-
const buttonDisabled = job.status !== MyJobStatus.ACTIVE || isRejectPending;
16+
const isDisabled = job.status !== MyJobStatus.ACTIVE;
2217

2318
if (!job.url) {
2419
return null;
@@ -28,24 +23,19 @@ export function MyJobsTableActions({
2823
<>
2924
<TableButton
3025
component={Link}
31-
disabled={buttonDisabled}
26+
disabled={isDisabled}
3227
fullWidth
3328
target="_blank"
3429
to={job.url}
35-
sx={{ maxWidth: { xs: 'unset', sm: '160px' } }}
30+
sx={{
31+
height: { xs: '48px', md: '30px' },
32+
maxWidth: { xs: 'unset', sm: '160px' },
33+
flex: { xs: 1, md: 'unset' },
34+
}}
3635
>
3736
{t('worker.jobs.solve')}
3837
</TableButton>
39-
<RejectButton
40-
disabled={buttonDisabled}
41-
loading={isRejectPending}
42-
onClick={() => {
43-
rejectTaskMutation({
44-
oracle_address: oracleAddress ?? '',
45-
assignment_id: job.assignment_id,
46-
});
47-
}}
48-
/>
38+
<MoreButton job={job} isDisabled={isDisabled} />
4939
</>
5040
);
5141
}

packages/apps/human-app/frontend/src/modules/worker/jobs/components/reject-button.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)