diff --git a/.eslintrc.json b/.eslintrc.json index 41c333dc..a66b3b17 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,15 +19,18 @@ "cypress" ], "rules": { + "function-call-argument-newline": ["off"], "function-paren-newline": ["off"], "import/prefer-default-export": ["off"], "max-len": ["error", { "code": 120 }], "newline-per-chained-call": ["off"], "no-console": ["off"], "no-nested-ternary": ["off"], + "no-promise-executor-return": ["off"], "no-underscore-dangle": ["off"], "semi": ["error", "always"], "react/jsx-filename-extension": ["off"], + "react/function-component-definition": ["off"], "react/jsx-props-no-spreading": ["off"], "react/no-danger": ["off"], "@next/next/no-html-link-for-pages": ["off"], diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index cd5d7ae2..6e611509 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -12,7 +12,7 @@ jobs: test: name: Build and Test runs-on: ubuntu-latest - timeout-minutes: 7 + timeout-minutes: 10 strategy: matrix: @@ -40,5 +40,5 @@ jobs: run: yarn test:build - name: Test API run: yarn jest - # - name: Test API Homepage - # run: yarn cypress:ci + - name: Test API Homepage + run: yarn cypress:ci diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bf0346fe..f1c927e7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,5 @@ jobs: - name: Install Node.js dependencies run: yarn install - - name: Run linters - uses: wearerequired/lint-action@v1 - with: - eslint: true \ No newline at end of file + - name: Run ESLint + run: yarn run eslint ./src --ext .js,.jsx,.ts,.tsx -c ./.eslintrc.json \ No newline at end of file diff --git a/__tests__/cypress/integration/client.test.js b/__tests__/cypress/integration/client.test.js index 629730d7..962c8064 100644 --- a/__tests__/cypress/integration/client.test.js +++ b/__tests__/cypress/integration/client.test.js @@ -21,6 +21,16 @@ describe('Igbo API Homepage', () => { cy.contains('Email:'); }); + it('render the Privacy page', () => { + cy.findByText('Privacy').click(); + cy.findByText('Privacy Policy').should('exist'); + }); + + it('render the Terms or Service page', () => { + cy.findByText('Terms of Service').click(); + cy.findByText('Terms and Conditions').should('exist'); + }); + describe('Try it Out', () => { it('enter a word and select flag', () => { cy.visit('/'); diff --git a/jest.config.js b/jest.config.js index 710b2977..108d6c18 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,7 @@ module.exports = { displayName: 'igbo-api-admin', testMatch: ['**/__tests__/*.js'], - testTimeout: 15000, + testTimeout: 20000, testEnvironment: 'node', moduleFileExtensions: ['ts', 'js', 'json'], globalSetup: './testSetup.js', diff --git a/package.json b/package.json index 861a1e81..50464562 100644 --- a/package.json +++ b/package.json @@ -145,14 +145,14 @@ "babel-loader": "^8.1.0", "cross-env": "^7.0.2", "cypress": "^6.0.0", - "eslint": "^7.10.0", - "eslint-config-airbnb": "^18.2.0", - "eslint-config-next": "^12.0.7", - "eslint-config-prettier": "^6.12.0", - "eslint-plugin-cypress": "^2.11.2", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsx-a11y": "^6.3.1", - "eslint-plugin-react": "^7.21.3", + "eslint": "8.34.0", + "eslint-config-airbnb": "19.0.4", + "eslint-config-next": "13.1.6", + "eslint-config-prettier": "8.6.0", + "eslint-plugin-cypress": "2.12.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-jsx-a11y": "6.7.1", + "eslint-plugin-react": "7.32.2", "husky": "^4.3.0", "jest": "^29.2.2", "lint-staged": "^10.4.0", @@ -167,6 +167,9 @@ "tag": true } }, + "resolutions": { + "esquery": "1.4.0" + }, "nodemonConfig": { "delay": "1500ms" } diff --git a/src/pages/_app.js b/src/pages/_app.js index 529d009d..f39371d3 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -7,6 +7,7 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import { appWithTranslation } from 'next-i18next'; import Head from 'next/head'; +import ChakraTheme from '../shared/constants/ChakraTheme'; import en from '../public/locales/en'; import ig from '../public/locales/ig'; import * as gtag from '../lib/gtag'; @@ -49,7 +50,7 @@ const MainApp = ({ Component, pageProps, ...rest }) => { Igbo API - The First African Language API <> - + {/* Global Site Tag (gtag.js) - Google Analytics */} diff --git a/src/pages/about.js b/src/pages/about.js index 71cccaa7..b9f968e7 100644 --- a/src/pages/about.js +++ b/src/pages/about.js @@ -41,7 +41,7 @@ const About = () => { Nkọwa okwu - {' , our official online Igbo-English dictionary app.'} + , our official online Igbo-English dictionary app.

) : (

{

  • - Terms of service + Terms of Service
  • diff --git a/src/pages/terms.js b/src/pages/terms.js index 72d8a9fc..9717bd0f 100644 --- a/src/pages/terms.js +++ b/src/pages/terms.js @@ -32,17 +32,17 @@ const Terms = () => ( '). - The Website is operated by Nkowa Okwu LLC. Access to and use of the + The Website is operated by Nkọwa okwu LLC. Access to and use of the Website, or any of its associated Products or Services, is provided by - Nkowa Okwu LLC. Please read these terms and conditions (the '{' '} + Nkọwa okwu LLC. Please read these terms and conditions (the '{' '} Terms') carefully. By using, browsing, and/or reading the Website, this signifies that you have read, understood, and agree to be bound by the Terms. If you do not agree with the Terms, you must cease the use of the Website, or any of Services, immediately. - (c)Nkowa Okwu LLC. reserves the right to review and change any of the - Terms by updating this page at its sole discretion. When Nkowa Okwu LLC. + (c)Nkọwa okwu LLC. reserves the right to review and change any of the + Terms by updating this page at its sole discretion. When Nkọwa okwu LLC. updates the Terms, it will use reasonable endeavors to provide you with notice of updates to the Terms. Any changes to the Terms take immediate effect from the date of their publication. Before you continue, we @@ -55,21 +55,21 @@ const Terms = () => ( You accept the Terms by remaining on the Website. You may also accept the Terms by clicking to accept or agree to the Terms where this option is - made available to you by Nkowa Okwu LLC. in the user interface. Nkowa Okwu + made available to you by Nkọwa okwu LLC. in the user interface. Nkọwa okwu LLC reserves the right to change the Terms at any time. - 3. Subscription and Registration to use Nkowa Okwu + 3. Subscription and Registration to use Nkọwa okwu Services - All users by default have access to all Nkowa okwu Learning free tiers + All users by default have access to all Nkọwa okwu Learning free tiers and no credit card information is required ('No{' '} Subscription Fee') for this tier. - In order to access the advanced features of Nkowa okwu Learning, you + In order to access the advanced features of Nkọwa okwu Learning, you must first purchase a subscription through the Website (the '{' '} Subscription') and pay the applicable fee for the selected Subscription (the ' Subscription Fee'). @@ -96,7 +96,7 @@ const Terms = () => ( Password - You warrant that any information you give to Nkowa Okwu LLC. in the + You warrant that any information you give to Nkọwa okwu LLC. in the course of completing the registration process will always be accurate, correct and up to date. @@ -113,7 +113,7 @@ const Terms = () => ( You may not use the Services and may not accept the Terms if: - you are not of legal age to form a binding contract with Nkowa Okwu + you are not of legal age to form a binding contract with Nkọwa okwu LLC.; or @@ -149,13 +149,13 @@ const Terms = () => ( access and use of the Website is limited, non-transferable and allows - for the sole use of the Website by you for the purposes of Nkowa Okwu LLC. + for the sole use of the Website by you for the purposes of Nkọwa okwu LLC. providing the Services; you will not use the Services or the Website in connection with any commercial endeavors except those that are specifically endorsed or - approved by the management of Nkowa Okwu LLC.; + approved by the management of Nkọwa okwu LLC.; you will not use the Services or Website for any illegal and/or @@ -167,7 +167,7 @@ const Terms = () => ( you agree that commercial advertisements, affiliate links, and other forms of solicitation may be removed from the Website without notice and may result in termination of the Services. Appropriate legal action will - be taken by Nkowa Okwu LLC. for any illegal or unauthorised use of the + be taken by Nkọwa okwu LLC. for any illegal or unauthorised use of the Website; and @@ -196,7 +196,7 @@ const Terms = () => ( with the Subscription Fee. - You agree and acknowledge that Nkowa Okwu LLC. can vary the + You agree and acknowledge that Nkọwa okwu LLC. can vary the Subscription Fee at any time and that the varied Subscription Fee will come into effect following the conclusion of the existing Subscription Period. @@ -219,12 +219,12 @@ const Terms = () => ( Services and compilation of the Website (including but not limited to text, graphics, logos, button icons, video images, audio clips, Website, code, scripts, design elements, and interactive features) or the Services - are owned or controlled for these purposes and are reserved by Nkowa Okwu + are owned or controlled for these purposes and are reserved by Nkọwa okwu LLC. or its contributors. All trademarks, service marks, and trade names are owned, registered, - and/or licensed by Nkowa Okwu LLC., who grants to you a worldwide, + and/or licensed by Nkọwa okwu LLC., who grants to you a worldwide, non-exclusive, royalty-free, revocable license whilst you are a Member to: @@ -239,12 +239,12 @@ const Terms = () => ( - Nkowa Okwu LLC. does not grant you any other rights whatsoever in relation + Nkọwa okwu LLC. does not grant you any other rights whatsoever in relation to the Website or the Services. All other rights are expressly reserved by - Nkowa Okwu LLC.. + Nkọwa okwu LLC.. - Nkowa Okwu LLC. retains all rights, title, and interest in and to the + Nkọwa okwu LLC. retains all rights, title, and interest in and to the Website and all related Services. Nothing you do on or in relation to the Website will transfer any: @@ -264,7 +264,7 @@ const Terms = () => ( - You may not, without the prior written permission of Nkowa Okwu LLC. + You may not, without the prior written permission of Nkọwa okwu LLC. and the permission of any other relevant rights owners: broadcast, republish, up-load to a third party, transmit, post, distribute, show or play in public, adapt or change in any way the Services or third-party @@ -277,8 +277,8 @@ const Terms = () => ( 8. Privacy - Nkowa Okwu LLC. takes your privacy seriously and any information provided - through your use of the Website and/or Services are subject to Nkowa Okwu + Nkọwa okwu LLC. takes your privacy seriously and any information provided + through your use of the Website and/or Services are subject to Nkọwa okwu LLC.'s Privacy Policy, which is available on the Website. @@ -298,7 +298,7 @@ const Terms = () => ( are not expressly stated in the Terms are excluded; and - Nkowa Okwu LLC. will not be liable for any special, indirect or + Nkọwa okwu LLC. will not be liable for any special, indirect or consequential loss or damage (unless such loss or damage is reasonably foreseeable resulting from our failure to meet an applicable Consumer Guarantee), loss of profit or opportunity, or damage to goodwill arising @@ -313,9 +313,9 @@ const Terms = () => ( the Website and the Services is provided to you "as is" and "as available" without warranty or condition of any kind. None of the affiliates, directors, officers, employees, agents, contributors - and licensors of Nkowa Okwu LLC. make any express or implied + and licensors of Nkọwa okwu LLC. make any express or implied representation or warranty about the Services or any products or Services - (including the products or Services of Nkowa Okwu LLC.) referred to on the + (including the products or Services of Nkọwa okwu LLC.) referred to on the Website. includes (but is not restricted to) loss or damage you might suffer as a result of any of the following: @@ -337,7 +337,7 @@ const Terms = () => ( costs incurred as a result of you using the Website, the Services or - any of the products of Nkowa Okwu LLC.; and + any of the products of Nkọwa okwu LLC.; and the Services or operation in respect to links that are provided for @@ -350,19 +350,19 @@ const Terms = () => ( - By using our services, you agree that Nkowa Okwu LLC. is not to be held + By using our services, you agree that Nkọwa okwu LLC. is not to be held liable for any decisions you make based on any of our services or guidance, and any consequences, as a result, are your own. Under no - circumstances can you hold Nkowa Okwu LLC. liable for any actions you take + circumstances can you hold Nkọwa okwu LLC. liable for any actions you take nor can you hold us or any of our employees liable for any loss or costs incurred by you as a result of any guidance, advice, coaching, materials, - or techniques used or provided by Nkowa Okwu LLC. + or techniques used or provided by Nkọwa okwu LLC. All our information on both the website and in consultations is intended to assist you and does not in any way, nor is it intended to substitute professional, financial, or legal advice. Results are not - guaranteed and Nkowa Okwu LLC. takes no responsibility for your actions, + guaranteed and Nkọwa okwu LLC. takes no responsibility for your actions, choices, or decisions. @@ -371,13 +371,13 @@ const Terms = () => ( - Nkowa Okwu LLC.'s total liability arising out of or in connection + Nkọwa okwu LLC.'s total liability arising out of or in connection with the Services or these Terms, however arising, including under contract, tort (including negligence), in equity, under statute or otherwise, will not exceed the resupply of the Services to you. - You expressly understand and agree that Nkowa Okwu LLC., its + You expressly understand and agree that Nkọwa okwu LLC., its affiliates, employees, agents, contributors and licensors shall not be liable to you for any direct, indirect, incidental, special consequential or exemplary damages which may be incurred by you, however, caused and @@ -392,7 +392,7 @@ const Terms = () => ( The Terms will continue to apply until terminated by either you or by - Nkowa Okwu LLC. as set out below. + Nkọwa okwu LLC. as set out below. (b)If you want to terminate the Terms, you may do so by: @@ -403,10 +403,10 @@ const Terms = () => ( And closing your accounts for all of the services which you use, where - Nkowa Okwu LLC. has made this option available to you. + Nkọwa okwu LLC. has made this option available to you. - (c)Nkowa Okwu LLC. may at any time, terminate the Terms with you if: + (c)Nkọwa okwu LLC. may at any time, terminate the Terms with you if: you do not renew the Subscription at the end of the Subscription @@ -416,18 +416,18 @@ const Terms = () => ( you have breached any provision of the Terms or intend to breach any provision; - Nkowa Okwu LLC. is required to do so by law; + Nkọwa okwu LLC. is required to do so by law; - the provision of the Services to you by Nkowa Okwu LLC. is, in the - opinion of Nkowa Okwu LLC., no longer commercially viable. + the provision of the Services to you by Nkọwa okwu LLC. is, in the + opinion of Nkọwa okwu LLC., no longer commercially viable. - Subject to local applicable laws, Nkowa Okwu LLC. reserves the right to + Subject to local applicable laws, Nkọwa okwu LLC. reserves the right to discontinue or cancel your membership at any time and may suspend or deny, in its sole discretion, your access to all or any portion of the Website or the Services without notice if you breach any provision of the Terms or - any applicable law or if your conduct impacts Nkowa Okwu LLC.'s name + any applicable law or if your conduct impacts Nkọwa okwu LLC.'s name or reputation or violates the rights of those of another party. @@ -435,7 +435,7 @@ const Terms = () => ( 13. Indemnity - You agree to indemnify Nkowa Okwu LLC., its affiliates, employees, agents, + You agree to indemnify Nkọwa okwu LLC., its affiliates, employees, agents, contributors, third party content providers, and licensors from and against: @@ -529,7 +529,7 @@ const Terms = () => ( 15. Venue and Jurisdiction - The Services offered by Nkowa Okwu LLC. are intended to be viewed + The Services offered by Nkọwa okwu LLC. are intended to be viewed globally. In the event of any dispute arising out of or in relation to the Website, you agree that the exclusive venue for resolving any dispute shall be in the jurisdiction courts. diff --git a/src/routers/siteRouter.js b/src/routers/siteRouter.js index c1e79fb7..3e9f69f6 100644 --- a/src/routers/siteRouter.js +++ b/src/routers/siteRouter.js @@ -8,8 +8,6 @@ const handle = nextApp.getRequestHandler(); const routes = compact([ /^\/$/, - /^\/about/, - process.env.NODE_ENV !== 'production' ? /^\/signup/ : null, ]); const siteRouter = express.Router(); diff --git a/src/services/database.js b/src/services/database.js index 76945992..9d4c0654 100644 --- a/src/services/database.js +++ b/src/services/database.js @@ -1,5 +1,5 @@ import mongoose from 'mongoose'; -import { MONGO_URI, isProduction } from '../config'; +import { MONGO_URI, isProduction, isTest } from '../config'; const DISCONNECTED = 0; @@ -10,7 +10,7 @@ export const createDbConnection = () => { useNewUrlParser: true, useUnifiedTopology: true, autoIndex: true, - readPreference: 'nearest', + readPreference: isTest ? 'primary' : 'nearest', }); console.log('Attempting MongoDB URI:', MONGO_URI); diff --git a/src/shared/constants/ChakraTheme.js b/src/shared/constants/ChakraTheme.js new file mode 100644 index 00000000..1bf9da39 --- /dev/null +++ b/src/shared/constants/ChakraTheme.js @@ -0,0 +1,8 @@ +import { extendTheme } from '@chakra-ui/react'; + +export default extendTheme({ + fonts: { + heading: 'Silka', + body: 'Silka,Noto Sans,Inter,-apple-system,BlinkMacSystemFont,Noto Sans,Arial', + }, +}); diff --git a/src/styles.css b/src/styles.css index 08d4a1c4..41c5be24 100644 --- a/src/styles.css +++ b/src/styles.css @@ -25,6 +25,7 @@ .link { @apply transition-element; @apply text-green-400; + @apply inline; } .link:hover {