Skip to content
Merged
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
12 changes: 11 additions & 1 deletion .github/workflows/cd-packages.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
name: Publish packages

permissions:
id-token: write # required for OIDC on npm
contents: write # needed to push tags

on:
push:
branches:
- main
paths:
- "packages/core/**"
- "packages/libs/**"
- "packages/sdk/typescript/human-protocol-sdk/**"

jobs:
publish:
name: Publish packages to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
token: ${{ secrets.GH_GITBOOK_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
registry-url: "https://registry.npmjs.org"
# Ensure npm 11.5.1 or later is installed to support OIDC
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: yarn install --immutable
# If there is no new version for dependency package (e.g. core)
Expand All @@ -31,7 +42,6 @@ jobs:
run: yarn workspaces foreach --all --no-private -pt npm publish --tolerate-republish --json | tee publish.log
env:
SKIP_PREPACK: true
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Tag published packages
run: node scripts/tag-published-packages.mjs publish.log
- name: Push created tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {
Box,
Button,
CircularProgress,
FormControl,
MenuItem,
Select as MuiSelect,
Stack,
Typography,
TextField,
} from '@mui/material';
import ErrorIcon from '@mui/icons-material/Error';
import SuccessIcon from '@mui/icons-material/CheckCircle';
Expand All @@ -23,6 +25,20 @@ interface ReportAbuseModalProps {

const ABUSE_ERROR = 'Abuse has already been reported';

const REASON_OPTIONS = [
'sexual_content',
'nudity',
'violence',
'gore',
'hate_or_racism',
'drugs',
'terrorism',
'child_abuse',
'self_harm',
'weapons',
'criminal_activity',
] as const;

function ErrorState({ error }: { error: string }) {
const { t } = useTranslation();

Expand Down Expand Up @@ -101,11 +117,11 @@ export function ReportAbuseModal({
const isIdleOrLoading = isIdle || isPending;

const handleReportAbuse = () => {
reason.trim().length > 0 &&
reason.length > 0 &&
reportAbuseMutation({
escrow_address: escrowAddress,
chain_id: chainId,
reason: reason.trim(),
reason,
});
};

Expand All @@ -120,27 +136,30 @@ export function ReportAbuseModal({
{t('worker.reportAbuse.modalHeader')}
</Typography>
{isIdleOrLoading && (
<Typography variant={isMobile ? 'body2' : 'body1'} textAlign="center">
{t('worker.reportAbuse.modalParagraph')}
</Typography>
<>
<Typography variant={isMobile ? 'body2' : 'body1'} textAlign="center">
{t('worker.reportAbuse.modalParagraph')}
</Typography>
<FormControl fullWidth sx={{ my: { xs: 2, md: 3 } }}>
<MuiSelect
value={reason}
displayEmpty
onChange={(e) => {
setReason(e.target.value);
}}
>
{REASON_OPTIONS.map((value) => (
<MenuItem key={value} value={value}>
{t(`worker.reportAbuse.reasons.${value}`)}
</MenuItem>
))}
</MuiSelect>
</FormControl>
</>
)}
{isPending && <CircularProgress size={40} sx={{ mx: 'auto', my: 7 }} />}
{isError && <ErrorState error={error} />}
{isSuccess && <SuccessState />}
<TextField
fullWidth
multiline
rows={3}
label={t('worker.reportAbuse.modalReason')}
value={reason}
sx={{
display: isIdle ? 'flex' : 'none',
my: { xs: 4, md: 5 },
}}
onChange={(e) => {
setReason(e.target.value);
}}
/>
<Box display="flex" gap={2} width="100%">
<Button
fullWidth
Expand All @@ -156,7 +175,7 @@ export function ReportAbuseModal({
fullWidth
onClick={handleReportAbuse}
variant="contained"
disabled={!reason.trim() || isPending}
disabled={!reason || isPending}
sx={{ display: isIdleOrLoading ? 'flex' : 'none' }}
>
{isMobile
Expand Down
15 changes: 14 additions & 1 deletion packages/apps/human-app/frontend/src/shared/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,20 @@
"modalSuccessParagraph": "Your issue has been successfully reported. Our team has received the details and will review them shortly.",
"modalHeaderAlreadyReportedError": "Report Already Submitted",
"modalParagraphAlreadyReportedError": "This case of abuse has already been reported. Our team is currently reviewing it.",
"modalUnknownError": "Something went wrong."
"modalUnknownError": "Something went wrong.",
"reasons": {
"sexual_content": "Sexual content",
"nudity": "Nudity",
"violence": "Violence",
"gore": "Gore",
"hate_or_racism": "Hate or racism",
"drugs": "Drugs",
"terrorism": "Terrorism",
"child_abuse": "Child abuse",
"self_harm": "Self harm",
"weapons": "Weapons",
"criminal_activity": "Criminal activity"
}
}
},
"operator": {
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/logger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@human-protocol/logger",
"version": "1.1.1",
"version": "1.1.2",
"description": "Unified logging package for HUMAN Protocol",
"type": "commonjs",
"main": "dist/index.js",
Expand Down
Loading