Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: graasp/graasp-app-calculator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fbcebbf9a49e14a9e8151955bd1962edf45d3a65
Choose a base ref
..
head repository: graasp/graasp-app-calculator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 50c8cbe1793a40cd35785369b019bed87c8deeb5
Choose a head ref
Showing with 3,502 additions and 2,539 deletions.
  1. +0 −2 .husky/commit-msg
  2. +0 −2 .husky/post-checkout
  3. +0 −2 .husky/post-commit
  4. +0 −2 .husky/post-merge
  5. +0 −2 .husky/pre-commit
  6. +0 −2 .husky/pre-push
  7. +4 −1 .prettierrc
  8. +5 −3 cypress/e2e/AnalyticsView.cy.ts
  9. +15 −15 cypress/e2e/Calculator.cy.ts
  10. +1 −1 cypress/e2e/Keyboard.cy.ts
  11. +4 −2 cypress/fixtures/mockActions.ts
  12. +1 −0 cypress/fixtures/mockItem.ts
  13. +2 −2 cypress/fixtures/scientificComputations.ts
  14. +1 −2 cypress/support/commands.ts
  15. +0 −1 cypress/support/e2e.ts
  16. +1 −1 cypress/support/index.ts
  17. +48 −48 package.json
  18. +5 −3 src/components/App.tsx
  19. +4 −2 src/components/FocusIndicator.tsx
  20. +6 −2 src/components/Root.tsx
  21. +3 −1 src/components/ScientificSwitch.tsx
  22. +11 −6 src/components/common/AnalyticsTable.tsx
  23. +5 −2 src/components/common/AngleUnitSwitch.tsx
  24. +16 −12 src/components/common/Calculator.tsx
  25. +4 −2 src/components/common/CalculatorButton.tsx
  26. +1 −0 src/components/common/HtmlParser.tsx
  27. +1 −0 src/components/common/Keypad.tsx
  28. +4 −2 src/components/common/Result.tsx
  29. +9 −8 src/components/common/utils.ts
  30. +4 −2 src/components/layout/Header.tsx
  31. +1 −0 src/components/modes/student/StudentView.tsx
  32. +6 −4 src/components/modes/teacher/Settings.tsx
  33. +2 −1 src/components/modes/teacher/TeacherMode.tsx
  34. +1 −0 src/components/modes/teacher/TeacherView.tsx
  35. +12 −7 src/components/views/AnalyticsView.tsx
  36. +1 −0 src/components/views/PlayerView.tsx
  37. +1 −0 src/components/window.d.ts
  38. +3 −1 src/config/i18n.ts
  39. +5 −3 src/index.tsx
  40. +10 −15 src/mocks/db.ts
  41. +3 −1 src/utils/action.ts
  42. +3 −1 src/utils/toasts.ts
  43. +3,299 −2,376 yarn.lock
2 changes: 0 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit ${1}
2 changes: 0 additions & 2 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn install
2 changes: 0 additions & 2 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

git status
2 changes: 0 additions & 2 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn install
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn pre-commit
2 changes: 0 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn pre-push
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -12,5 +12,8 @@
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
"importOrderSortSpecifiers": true,
"plugins": [
"@trivago/prettier-plugin-sort-imports"
]
}
8 changes: 5 additions & 3 deletions cypress/e2e/AnalyticsView.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Context, formatDate } from '@graasp/sdk';

import {
ANALYTICS_ROW_EQUATION_ID,
ANALYTICS_ROW_RESULT_ID,
ANALYTICS_ROW_CREATED_AT_ID,
ANALYTICS_ROW_EQUATION_ID,
ANALYTICS_ROW_MEMBER_ID,
ANALYTICS_ROW_RESULT_ID,
buildAnalyticsRowId,
} from '@/config/selectors';
import { appQueryParameters } from '../fixtures/queryParameters';

import { MOCK_APP_ACTIONS } from '../fixtures/mockActions';
import { appQueryParameters } from '../fixtures/queryParameters';

describe('Analytic view', () => {
describe('check analytic table is rendered with the right data', () => {
30 changes: 15 additions & 15 deletions cypress/e2e/Calculator.cy.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import {
ANGLE_UNITS,
BUTTON_NAMES,
KATEX_MINUS_SYMBOL,
PI_SYMBOL,
TIMES_SYMBOL,
} from '../../src/config/constants';
import { RESULT_ERROR_MESSAGE } from '../../src/config/messages';
import { RESULT_TEXT_NAME } from '../../src/config/selectors';
import { appQueryParameters } from '../fixtures/queryParameters';
import {
FIXTURES_COMPUTATIONS,
FIXTURES_BACKSPACE,
FIXTURES_CHAINED_COMPUTATIONS,
FIXTURES_COMPUTATIONS,
FIXTURES_ERROR_COMPUTATIONS,
FIXTURES_TYPO_ERROR_COMPUTATIONS,
FIXTURES_CHAINED_COMPUTATIONS,
} from '../fixtures/computations';
import { appQueryParameters } from '../fixtures/queryParameters';
import {
FIXTURES_SCIENTIFIC_COMPUTATIONS,
FIXTURES_SCIENTIFIC_BACKSPACE,
FIXTURES_CHAINED_SCIENTIFIC_COMPUTATIONS,
FIXTURES_ERROR_SCIENTIFIC_COMPUTATIONS,
FIXTURES_POSITIVE_INFINITY_SCIENTIFIC_COMPUTATIONS,
FIXTURES_NEGATIVE_INFINITY_SCIENTIFIC_COMPUTATIONS,
FIXTURES_POSITIVE_INFINITY_SCIENTIFIC_COMPUTATIONS,
FIXTURES_SCIENTIFIC_BACKSPACE,
FIXTURES_SCIENTIFIC_COMPUTATIONS,
FIXTURES_TYPO_ERROR_SCIENTIFIC_COMPUTATIONS,
FIXTURES_CHAINED_SCIENTIFIC_COMPUTATIONS,
FIXTURES_UNCHAINED_SCIENTIFIC_COMPUTATIONS,
} from '../fixtures/scientificComputations';
import {
ANGLE_UNITS,
BUTTON_NAMES,
KATEX_MINUS_SYMBOL,
PI_SYMBOL,
TIMES_SYMBOL,
} from '../../src/config/constants';
import { RESULT_ERROR_MESSAGE } from '../../src/config/messages';

describe('Calculator', () => {
const resultSelector = `[data-cy="${RESULT_TEXT_NAME}"] .katex-html`;
2 changes: 1 addition & 1 deletion cypress/e2e/Keyboard.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
BUTTON_NAMES,
DIVIDE_SYMBOL,
TIMES_SYMBOL,
KATEX_MINUS_SYMBOL,
TIMES_SYMBOL,
} from '../../src/config/constants';
import { RESULT_TEXT_NAME } from '../../src/config/selectors';
import { appQueryParameters } from '../fixtures/queryParameters';
6 changes: 4 additions & 2 deletions cypress/fixtures/mockActions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { CalculationTriggers } from '@/config/constants';
import { AppAction } from '@graasp/sdk';

import { CalculationTriggers } from '@/config/constants';

import { ActionData } from '../../src/types/table';
import { MEMBERS } from './members';
import { MOCK_APP_ITEM } from './mockItem';
import { ActionData } from '../../src/types/table';

export const MOCK_ADD_CALC_ACTION: AppAction<ActionData> = {
id: '123456789',
1 change: 1 addition & 0 deletions cypress/fixtures/mockItem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AppItemFactory } from '@graasp/sdk';

import { MEMBERS } from './members';

export const MOCK_APP_ITEM = AppItemFactory({
4 changes: 2 additions & 2 deletions cypress/fixtures/scientificComputations.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
BUTTON_NAMES,
TIMES_SYMBOL,
DIVIDE_SYMBOL,
PI_SYMBOL,
KATEX_MINUS_SYMBOL,
PI_SYMBOL,
TIMES_SYMBOL,
} from '../../src/config/constants';

export const FIXTURES_SCIENTIFIC_COMPUTATIONS = [
3 changes: 1 addition & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -3,9 +3,8 @@ import {
ANGLE_UNIT_SWITCH_NAME,
SCIENTIFIC_MODE_SWITCH_NAME,
} from '../../src/config/selectors';
import { LOAD_PAGE_PAUSE, CLICK_BUTTON_PAUSE } from '../constants';
import { CLICK_BUTTON_PAUSE, LOAD_PAGE_PAUSE } from '../constants';
import { CURRENT_MEMBER, MEMBERS } from '../fixtures/members';

import { MOCK_APP_ITEM } from '../fixtures/mockItem';

Cypress.Commands.add('setUpApi', (database = {}, appContext = {}) => {
1 change: 0 additions & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';

2 changes: 1 addition & 1 deletion cypress/support/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// cypress/support/index.ts

import { Database, LocalContext } from '@graasp/apps-query-client';

import { ANGLE_UNITS } from 'config/constants';
import { ValueOf } from 'types/math';

96 changes: 48 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -10,35 +10,35 @@
"type": "module",
"license": "AGPL3.0-only",
"dependencies": {
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@graasp/apps-query-client": "3.4.13",
"@graasp/sdk": "4.0.1",
"@graasp/ui": "4.8.1",
"@mui/icons-material": "5.14.3",
"@emotion/react": "11.13.0",
"@emotion/styled": "11.13.0",
"@graasp/apps-query-client": "3.5.1",
"@graasp/sdk": "4.22.0",
"@graasp/ui": "4.23.0",
"@mui/icons-material": "5.16.4",
"@mui/lab": "5.0.0-alpha.134",
"@mui/material": "5.14.4",
"@mui/material": "5.16.4",
"@tanstack/react-query": "4.36.1",
"@tanstack/react-query-devtools": "4.36.1",
"date-fns": "3.3.1",
"i18next": "22.5.1",
"date-fns": "3.6.0",
"i18next": "23.12.2",
"interweave": "13.1.0",
"katex": "0.16.7",
"katex": "0.16.11",
"lodash.isnan": "3.0.2",
"lodash.isnumber": "3.0.3",
"lodash.isobject": "3.0.2",
"lodash.isstring": "4.0.1",
"lodash.sortby": "4.7.0",
"mathjs": "11.8.2",
"mathjs": "13.0.3",
"prop-types": "15.8.1",
"qs": "6.11.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "12.3.1",
"qs": "6.12.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "15.0.0",
"react-router-dom": "6.26.2",
"react-select": "5.7.3",
"react-toastify": "9.1.3",
"stylis": "4.3.1",
"react-select": "5.8.0",
"react-toastify": "10.0.5",
"stylis": "4.3.2",
"stylis-plugin-rtl": "2.1.1"
},
"scripts": {
@@ -51,55 +51,55 @@
"preview:test": "yarn vite preview --mode test",
"pre-commit": "yarn prettier:check && yarn lint && yarn type-check",
"pre-push": "yarn lint && yarn build",
"hooks:install": "husky install",
"hooks:uninstall": "husky uninstall",
"hooks:install": "husky",
"lint": "eslint .",
"type-check": "tsc --noEmit && tsc --noEmit -p cypress/tsconfig.json",
"check": "yarn prettier:check && yarn lint && yarn type-check",
"prettier:check": "prettier --check {src,cypress}/**/*.{ts,tsx}",
"prettier:write": "prettier --write {src,cypress}/**/*.{ts,tsx}",
"test": "yarn build:test && concurrently -k -s first \"yarn preview:test\" \"yarn cypress:run\"",
"cypress:run": "env-cmd -f ./.env.test cypress run --browser chrome",
"report": "cat ./coverage/lcov.info | codacy-coverage",
"cypress:open": "env-cmd -f ./.env.test cypress open",
"cypress": "npm-run-all --parallel start cypress:open",
"postinstall": "husky install"
"cypress": "npm-run-all --parallel start cypress:open"
},
"devDependencies": {
"@commitlint/cli": "17.6.5",
"@commitlint/config-conventional": "17.6.5",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/katex": "0.16.7",
"@types/lodash.isnan": "3.0.9",
"@types/lodash.isnumber": "3.0.9",
"@types/lodash.isobject": "3.0.9",
"@types/lodash.isstring": "4.0.9",
"@types/lodash.sortby": "^4",
"@types/node": "20.11.30",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
"@types/stylis": "^4",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"@vitejs/plugin-react": "4.2.1",
"cypress": "13.6.6",
"@types/lodash.sortby": "^4.7.9",
"@types/node": "20.14.12",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/stylis": "^4.2.6",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
"@vitejs/plugin-react": "4.3.1",
"cypress": "13.13.1",
"env-cmd": "10.1.0",
"eslint": "8.43.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.1.0",
"eslint-config-prettier": "8.8.0",
"eslint-config-airbnb-typescript": "18.0.0",
"eslint-config-prettier": "8.10.0",
"eslint-config-react-app": "7.0.1",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-cypress": "2.15.1",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "^8.0.3",
"prettier": "3.2.5",
"typescript": "5.1.6",
"vite": "5.1.7",
"vite-plugin-checker": "0.6.4",
"vite-plugin-istanbul": "5.0.0"
"eslint-plugin-cypress": "2.15.2",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"husky": "^9.1.1",
"prettier": "3.3.3",
"typescript": "5.5.4",
"vite": "5.3.4",
"vite-plugin-checker": "0.7.2",
"vite-plugin-istanbul": "6.0.2"
},
"browserslist": [
">0.2%",
8 changes: 5 additions & 3 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import katex from 'katex';
import 'katex/dist/katex.min.css';
import { useLocalContext } from '@graasp/apps-query-client';
import { Context } from '@graasp/sdk';
import PlayerView from './views/PlayerView';

import katex from 'katex';
import 'katex/dist/katex.min.css';

import AnalyticsView from './views/AnalyticsView';
import PlayerView from './views/PlayerView';

// bind katex to the window object
window.katex = katex;
6 changes: 4 additions & 2 deletions src/components/FocusIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Grid, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';

import InfoIcon from '@mui/icons-material/Info';
import { ENABLED_COLOR, DISABLED_COLOR } from '@/config/constants';
import { Grid, Typography } from '@mui/material';

import { DISABLED_COLOR, ENABLED_COLOR } from '@/config/constants';

const FocusIndicator = ({ isFocused }: { isFocused: boolean }): JSX.Element => {
const { t } = useTranslation();
8 changes: 6 additions & 2 deletions src/components/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { I18nextProvider } from 'react-i18next';
import { ThemeProvider } from '@mui/material/styles';
import { ToastContainer } from 'react-toastify';
import { Loader, theme } from '@graasp/ui';
import 'react-toastify/dist/ReactToastify.css';

import { ThemeProvider } from '@mui/material/styles';

import {
GraaspContextDevTool,
WithLocalContext,
WithTokenContext,
useObjectState,
} from '@graasp/apps-query-client';
import { Loader, theme } from '@graasp/ui';

import { QueryClientProvider, hooks, queryClient } from '@/config/queryClient';
import { defaultMockContext, mockMembers } from '@/mocks/db';

import i18nConfig from '../config/i18n';
import App from './App';

4 changes: 3 additions & 1 deletion src/components/ScientificSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Switch, Grid, FormControlLabel } from '@mui/material';
import { useTranslation } from 'react-i18next';

import { FormControlLabel, Grid, Switch } from '@mui/material';

import { SCIENTIFIC_MODE_SWITCH_NAME } from '../config/selectors';

interface Props {
Loading