diff --git a/.vscode/settings.json b/.vscode/settings.json index 6df2707d..69cff663 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "markdown.preview.fontSize": 16, "terminal.integrated.fontSize": 16, "editor.fontSize": 14, - "editor.scrollbar.verticalScrollbarSize": 12 + "editor.scrollbar.verticalScrollbarSize": 12, + "typescript.tsdk": "node_modules/typescript/lib" } \ No newline at end of file diff --git a/package.json b/package.json index 93f86bd7..5ac75277 100644 --- a/package.json +++ b/package.json @@ -38,5 +38,9 @@ }, "devDependencies": { "husky": "^7.0.1" + }, + "resolutions": { + "**/@types/react": "^17.0.38" } + } diff --git a/packages/react-app/package.json b/packages/react-app/package.json index 6b942ef5..9d22dc56 100644 --- a/packages/react-app/package.json +++ b/packages/react-app/package.json @@ -42,7 +42,7 @@ "@hookform/resolvers": "^2.7.1", "@netlify/plugin-nextjs": "^3.8.0", "@testing-library/react-hooks": "^8.0.0", - "@types/mongoose-paginate-v2": "^1.4.1", + "@types/mongoose-paginate-v2": "~1.4.1", "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6", "axios": "^0.24.0", "chakra-react-select": "^4.4.2", @@ -53,7 +53,7 @@ "framer-motion": "^4.1.17", "lint-staged": "^11.0.0", "mongo-cursor-pagination": "^7.6.1", - "mongoose": "^5.13.4", + "mongoose": "^5.13.15", "next": "^12.1.0", "next-auth": "4.0.0-next.26", "next-seo": "^4.26.0", @@ -80,11 +80,11 @@ "@testing-library/react-hooks": "^8.0.0", "@types/dompurify": "^2.3.3", "@types/enzyme": "^3.10.10", - "@types/jest": "^27.0.2", + "@types/jest": "~27.5.0", "@types/next-auth": "^3.15.0", "@types/node": "^16.4.7", "@types/nprogress": "^0.2.0", - "@types/react": "^17.0.14", + "@types/react": "^17.0.2", "@types/react-csv": "^1.1.2", "@types/react-datepicker": "^4.3.4", "@types/react-html-parser": "^2.0.2", @@ -95,7 +95,7 @@ "enzyme-to-json": "^3.6.2", "eslint": "^7.30.0", "eslint-config-next": "^11.0.1", - "jest": "^27.3.1", + "jest": "~27.5.0", "react-dom": "^17.0.2", "react-test-renderer": "^17.0.2", "ts-jest": "^27.0.7", diff --git a/packages/react-app/setupTests.ts b/packages/react-app/setupTests.ts index 9aba2f79..50bcd2cf 100644 --- a/packages/react-app/setupTests.ts +++ b/packages/react-app/setupTests.ts @@ -3,3 +3,14 @@ import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; import '@testing-library/jest-dom'; configure({ adapter: new Adapter() }); + +window.matchMedia = (query) => ({ + matches: false, + media: query, + onchange: null, + addListener: jest.fn(), + removeListener: jest.fn(), + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + dispatchEvent: jest.fn(), +}); \ No newline at end of file diff --git a/packages/react-app/src/components/pages/Bounties/Bounty/index.tsx b/packages/react-app/src/components/pages/Bounties/Bounty/index.tsx index 5dc42a36..8c53f045 100644 --- a/packages/react-app/src/components/pages/Bounties/Bounty/index.tsx +++ b/packages/react-app/src/components/pages/Bounties/Bounty/index.tsx @@ -42,6 +42,7 @@ import { useRouter } from 'next/router'; import { BountyMarkPaidButton } from './markPaid'; import { WarningIcon } from '@chakra-ui/icons'; import { useUser } from '@app/hooks/useUser'; +import { useBounty } from '@app/hooks/useBounties'; type SetState = (arg: T) => void; @@ -347,6 +348,9 @@ const BountyDetails = ({ ? MiscUtils.shortDate(new Date(bounty.dueAt)) : 'unspecified'; + const bountyTemplate: BountyCollection | null | undefined = bounty.repeatTemplateId ? + useBounty(bounty.repeatTemplateId).bounty : null; + return ( @@ -476,6 +480,48 @@ const BountyDetails = ({ + {bountyTemplate && + + + + repeats every + + + + + {bountyTemplate.repeatDays?.toString() + + (bountyTemplate.repeatDays > 1 ? ' days' : ' day')} + + + + + + {bountyTemplate.endRepeatsDate ? 'ending' : 'ending after'} + + + + + {bountyTemplate.endRepeatsDate ? + MiscUtils.shortDate(new Date(bountyTemplate.endRepeatsDate)) : + bountyTemplate.numRepeats.toString() + ' repeats'} + + + + + } {bounty.tags && { return (
)}> - + Title {errors.title?.message} - + Description