@magmamath/students-features 1.3.26-rc.13 → 1.3.26-rc.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/commonjs/features/chatbot/helpers.js +3 -0
  2. package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
  3. package/dist/commonjs/features/fluency-teacher/components/matrix/DrawerMatrix.js +11 -1
  4. package/dist/commonjs/features/fluency-teacher/components/matrix/DrawerMatrix.js.map +1 -1
  5. package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +3 -1
  6. package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
  7. package/dist/commonjs/features/keyboard/components/GeometryLayout/GeometryLayout.js +3 -1
  8. package/dist/commonjs/features/keyboard/components/GeometryLayout/GeometryLayout.js.map +1 -1
  9. package/dist/commonjs/features/keyboard/components/SwitchableLayout/SwitchableLayout.js +10 -4
  10. package/dist/commonjs/features/keyboard/components/SwitchableLayout/SwitchableLayout.js.map +1 -1
  11. package/dist/commonjs/features/keyboard/components/SwitchableLayout/helpers.js +5 -2
  12. package/dist/commonjs/features/keyboard/components/SwitchableLayout/helpers.js.map +1 -1
  13. package/dist/commonjs/features/keyboard/constants/groups/currency.constants.js +3 -0
  14. package/dist/commonjs/features/keyboard/constants/groups/currency.constants.js.map +1 -1
  15. package/dist/commonjs/features/keyboard/constants/keyboard.helpers.js +2 -1
  16. package/dist/commonjs/features/keyboard/constants/keyboard.helpers.js.map +1 -1
  17. package/dist/commonjs/features/keyboard/constants/keys/units.constants.js +16 -0
  18. package/dist/commonjs/features/keyboard/constants/keys/units.constants.js.map +1 -1
  19. package/dist/commonjs/shared/icons/keyboard/FrancIcon.js +34 -0
  20. package/dist/commonjs/shared/icons/keyboard/FrancIcon.js.map +1 -0
  21. package/dist/commonjs/shared/icons/keyboard/RappenIcon.js +34 -0
  22. package/dist/commonjs/shared/icons/keyboard/RappenIcon.js.map +1 -0
  23. package/dist/module/features/chatbot/helpers.js +3 -0
  24. package/dist/module/features/chatbot/helpers.js.map +1 -1
  25. package/dist/module/features/fluency-teacher/components/matrix/DrawerMatrix.js +12 -2
  26. package/dist/module/features/fluency-teacher/components/matrix/DrawerMatrix.js.map +1 -1
  27. package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +3 -1
  28. package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
  29. package/dist/module/features/keyboard/components/GeometryLayout/GeometryLayout.js +3 -1
  30. package/dist/module/features/keyboard/components/GeometryLayout/GeometryLayout.js.map +1 -1
  31. package/dist/module/features/keyboard/components/SwitchableLayout/SwitchableLayout.js +10 -4
  32. package/dist/module/features/keyboard/components/SwitchableLayout/SwitchableLayout.js.map +1 -1
  33. package/dist/module/features/keyboard/components/SwitchableLayout/helpers.js +5 -2
  34. package/dist/module/features/keyboard/components/SwitchableLayout/helpers.js.map +1 -1
  35. package/dist/module/features/keyboard/constants/groups/currency.constants.js +3 -0
  36. package/dist/module/features/keyboard/constants/groups/currency.constants.js.map +1 -1
  37. package/dist/module/features/keyboard/constants/keyboard.helpers.js +2 -1
  38. package/dist/module/features/keyboard/constants/keyboard.helpers.js.map +1 -1
  39. package/dist/module/features/keyboard/constants/keys/units.constants.js +16 -0
  40. package/dist/module/features/keyboard/constants/keys/units.constants.js.map +1 -1
  41. package/dist/module/shared/icons/keyboard/FrancIcon.js +26 -0
  42. package/dist/module/shared/icons/keyboard/FrancIcon.js.map +1 -0
  43. package/dist/module/shared/icons/keyboard/RappenIcon.js +26 -0
  44. package/dist/module/shared/icons/keyboard/RappenIcon.js.map +1 -0
  45. package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -1
  46. package/dist/typescript/commonjs/features/fluency-teacher/components/matrix/DrawerMatrix.d.ts.map +1 -1
  47. package/dist/typescript/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
  48. package/dist/typescript/commonjs/features/keyboard/components/GeometryLayout/GeometryLayout.d.ts.map +1 -1
  49. package/dist/typescript/commonjs/features/keyboard/components/SwitchableLayout/SwitchableLayout.d.ts +1 -1
  50. package/dist/typescript/commonjs/features/keyboard/components/SwitchableLayout/SwitchableLayout.d.ts.map +1 -1
  51. package/dist/typescript/commonjs/features/keyboard/components/SwitchableLayout/helpers.d.ts.map +1 -1
  52. package/dist/typescript/commonjs/features/keyboard/components/SwitchableLayout/types.d.ts +2 -0
  53. package/dist/typescript/commonjs/features/keyboard/components/SwitchableLayout/types.d.ts.map +1 -1
  54. package/dist/typescript/commonjs/features/keyboard/constants/groups/currency.constants.d.ts.map +1 -1
  55. package/dist/typescript/commonjs/features/keyboard/constants/keyboard.helpers.d.ts.map +1 -1
  56. package/dist/typescript/commonjs/features/keyboard/constants/keys/units.constants.d.ts.map +1 -1
  57. package/dist/typescript/commonjs/shared/icons/keyboard/FrancIcon.d.ts +4 -0
  58. package/dist/typescript/commonjs/shared/icons/keyboard/FrancIcon.d.ts.map +1 -0
  59. package/dist/typescript/commonjs/shared/icons/keyboard/RappenIcon.d.ts +4 -0
  60. package/dist/typescript/commonjs/shared/icons/keyboard/RappenIcon.d.ts.map +1 -0
  61. package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -1
  62. package/dist/typescript/module/features/fluency-teacher/components/matrix/DrawerMatrix.d.ts.map +1 -1
  63. package/dist/typescript/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
  64. package/dist/typescript/module/features/keyboard/components/GeometryLayout/GeometryLayout.d.ts.map +1 -1
  65. package/dist/typescript/module/features/keyboard/components/SwitchableLayout/SwitchableLayout.d.ts +1 -1
  66. package/dist/typescript/module/features/keyboard/components/SwitchableLayout/SwitchableLayout.d.ts.map +1 -1
  67. package/dist/typescript/module/features/keyboard/components/SwitchableLayout/helpers.d.ts.map +1 -1
  68. package/dist/typescript/module/features/keyboard/components/SwitchableLayout/types.d.ts +2 -0
  69. package/dist/typescript/module/features/keyboard/components/SwitchableLayout/types.d.ts.map +1 -1
  70. package/dist/typescript/module/features/keyboard/constants/groups/currency.constants.d.ts.map +1 -1
  71. package/dist/typescript/module/features/keyboard/constants/keyboard.helpers.d.ts.map +1 -1
  72. package/dist/typescript/module/features/keyboard/constants/keys/units.constants.d.ts.map +1 -1
  73. package/dist/typescript/module/shared/icons/keyboard/FrancIcon.d.ts +4 -0
  74. package/dist/typescript/module/shared/icons/keyboard/FrancIcon.d.ts.map +1 -0
  75. package/dist/typescript/module/shared/icons/keyboard/RappenIcon.d.ts +4 -0
  76. package/dist/typescript/module/shared/icons/keyboard/RappenIcon.d.ts.map +1 -0
  77. package/package.json +4 -4
  78. package/src/features/chatbot/helpers.ts +1 -0
  79. package/src/features/fluency-teacher/components/matrix/DrawerMatrix.tsx +27 -16
  80. package/src/features/keyboard/components/AlgebraLayout/AlgebraLayout.tsx +8 -1
  81. package/src/features/keyboard/components/GeometryLayout/GeometryLayout.tsx +8 -1
  82. package/src/features/keyboard/components/SwitchableLayout/SwitchableLayout.tsx +12 -2
  83. package/src/features/keyboard/components/SwitchableLayout/helpers.tsx +3 -0
  84. package/src/features/keyboard/components/SwitchableLayout/types.ts +2 -0
  85. package/src/features/keyboard/constants/groups/currency.constants.ts +3 -0
  86. package/src/features/keyboard/constants/keyboard.helpers.ts +1 -0
  87. package/src/features/keyboard/constants/keys/units.constants.tsx +12 -0
  88. package/src/shared/icons/keyboard/FrancIcon.tsx +20 -0
  89. package/src/shared/icons/keyboard/RappenIcon.tsx +20 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "1.3.26-rc.13",
3
+ "version": "1.3.26-rc.15",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -19,7 +19,7 @@
19
19
  "pull-translations": "node scripts/pullTranslations.mjs"
20
20
  },
21
21
  "peerDependencies": {
22
- "@magmamath/frontend-config": ">=1.3.5",
22
+ "@magmamath/frontend-config": ">=1.4.0",
23
23
  "@magmamath/react-native-draw-board": "*",
24
24
  "@magmamath/react-native-ui": "*",
25
25
  "@magmamath/students-qa": "*",
@@ -45,10 +45,10 @@
45
45
  "react-i18next": ">=15"
46
46
  },
47
47
  "devDependencies": {
48
- "@magmamath/frontend-config": "1.3.5",
48
+ "@magmamath/frontend-config": "1.4.0",
49
49
  "@magmamath/react-native-draw-board": "1.8.2",
50
50
  "@magmamath/react-native-ui": "0.4.83",
51
- "@magmamath/students-qa": "0.1.0",
51
+ "@magmamath/students-qa": "0.1.9",
52
52
  "@matteappen/skills-utils": "^3.7.1",
53
53
  "@react-native-masked-view/masked-view": "^0.3.2",
54
54
  "@react-native/eslint-config": "^0.73.1",
@@ -105,6 +105,7 @@ export function prepareChatRequestPayload(
105
105
  language,
106
106
  ...(imageCdnId && { imageCdnId }),
107
107
  ...(imageAltText && { altText: imageAltText }),
108
+ ...(chatHistory && { chatHistory }),
108
109
  ...(!!problemStandards?.length && { problemStandards }),
109
110
  ...(!!answerOptions?.length && { answerOptions }),
110
111
  ...(assignmentGrade !== undefined && { assignmentGrade }),
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
- import { StyleSheet, View } from 'react-native'
2
+ import { StyleSheet, Text, View } from 'react-native'
3
3
  import type { LayoutChangeEvent } from 'react-native'
4
+ import { COLORS, FONT_FAMILY } from '@magmamath/react-native-ui'
4
5
  import { MatrixHeaderRow } from './MatrixHeaderRow'
5
6
  import { MatrixRow } from './MatrixRow'
6
7
  import type { DrawerGrid } from '../../hooks/useDrawerGrid'
@@ -23,21 +24,25 @@ export const DrawerMatrix = ({
23
24
  onLayout,
24
25
  }: DrawerMatrixProps) => (
25
26
  <View style={styles.container} onLayout={onLayout}>
26
- {grid && cellSize > 0 && (
27
- <View style={styles.grid}>
28
- <MatrixHeaderRow colLabels={grid.colLabels} cellSize={cellSize} fontSize={fontSize} />
29
- {grid.rows.map((row) => (
30
- <MatrixRow
31
- key={row.label}
32
- label={row.label}
33
- cells={row.cells}
34
- cellSize={cellSize}
35
- borderRadius={borderRadius}
36
- colorMap={cellColorMap}
37
- fontSize={fontSize}
38
- />
39
- ))}
40
- </View>
27
+ {!grid ? (
28
+ <Text style={styles.emptyText}>No facts practiced yet</Text>
29
+ ) : (
30
+ cellSize > 0 && (
31
+ <View style={styles.grid}>
32
+ <MatrixHeaderRow colLabels={grid.colLabels} cellSize={cellSize} fontSize={fontSize} />
33
+ {grid.rows.map((row) => (
34
+ <MatrixRow
35
+ key={row.label}
36
+ label={row.label}
37
+ cells={row.cells}
38
+ cellSize={cellSize}
39
+ borderRadius={borderRadius}
40
+ colorMap={cellColorMap}
41
+ fontSize={fontSize}
42
+ />
43
+ ))}
44
+ </View>
45
+ )
41
46
  )}
42
47
  </View>
43
48
  )
@@ -51,4 +56,10 @@ const styles = StyleSheet.create({
51
56
  grid: {
52
57
  gap: 2,
53
58
  },
59
+ emptyText: {
60
+ fontFamily: FONT_FAMILY.buenosAiresSemiBold,
61
+ fontSize: 13,
62
+ color: COLORS.NEUTRAL_6,
63
+ textAlign: 'center',
64
+ },
54
65
  })
@@ -5,6 +5,7 @@ import { AlgebraIcon } from '../../../../shared/icons/AlgebraIcon'
5
5
  import { IntegralABIcon } from '../../../../shared/icons/IntegralABIcon'
6
6
  import { SwitchableLayout } from '../SwitchableLayout/SwitchableLayout'
7
7
  import { SwitchableLayoutConfig } from '../SwitchableLayout/types'
8
+ import { TEST_IDS } from '@magmamath/students-qa'
8
9
 
9
10
  const ALGEBRA_CONFIG: SwitchableLayoutConfig = {
10
11
  secondaryKeyboardType: KeyboardType.AlgebraAdvanced,
@@ -17,5 +18,11 @@ const ALGEBRA_CONFIG: SwitchableLayoutConfig = {
17
18
  }
18
19
 
19
20
  export const AlgebraLayout = (props: KeyboardLayoutProps) => {
20
- return <SwitchableLayout {...props} config={ALGEBRA_CONFIG} />
21
+ return (
22
+ <SwitchableLayout
23
+ {...props}
24
+ config={ALGEBRA_CONFIG}
25
+ testID={TEST_IDS.KEYBOARD_ALGEBRA_LAYOUT}
26
+ />
27
+ )
21
28
  }
@@ -5,6 +5,7 @@ import { AlgebraIcon } from '../../../../shared/icons/AlgebraIcon'
5
5
  import { GeometryIcon } from '../../../../shared/icons/GeometryIcon'
6
6
  import { SwitchableLayout } from '../SwitchableLayout/SwitchableLayout'
7
7
  import { SwitchableLayoutConfig } from '../SwitchableLayout/types'
8
+ import { TEST_IDS } from '@magmamath/students-qa'
8
9
 
9
10
  const GEOMETRY_CONFIG: SwitchableLayoutConfig = {
10
11
  secondaryKeyboardType: KeyboardType.Geometry,
@@ -17,5 +18,11 @@ const GEOMETRY_CONFIG: SwitchableLayoutConfig = {
17
18
  }
18
19
 
19
20
  export const GeometryLayout = (props: KeyboardLayoutProps) => {
20
- return <SwitchableLayout {...props} config={GEOMETRY_CONFIG} />
21
+ return (
22
+ <SwitchableLayout
23
+ {...props}
24
+ config={GEOMETRY_CONFIG}
25
+ testID={TEST_IDS.KEYBOARD_GEOMETRY_LAYOUT}
26
+ />
27
+ )
21
28
  }
@@ -8,6 +8,7 @@ import {
8
8
  SelectOptionSize,
9
9
  SPACING,
10
10
  } from '@magmamath/react-native-ui'
11
+ import { TEST_IDS } from '@magmamath/students-qa'
11
12
  import { KeyboardType } from '../../types/types'
12
13
  import { SelectedLayout, SwitchableLayoutProps } from './types'
13
14
  import { getMainKeyboardGroup } from '../../helpers'
@@ -18,6 +19,7 @@ export const SwitchableLayout = ({
18
19
  onLayoutChange,
19
20
  keys,
20
21
  config,
22
+ testID,
21
23
  ...props
22
24
  }: SwitchableLayoutProps) => {
23
25
  const [selectedLayout, setSelectedLayout] = useState<SelectedLayout>(SelectedLayout.BASIC)
@@ -63,7 +65,7 @@ export const SwitchableLayout = ({
63
65
  const currentKeys = keyboardGroups.get(selectedLayout)?.keys ?? []
64
66
 
65
67
  return (
66
- <View style={styles.container}>
68
+ <View style={styles.container} testID={testID}>
67
69
  {isDesktop && (
68
70
  <SelectGroup
69
71
  numOfRows={2}
@@ -79,7 +81,15 @@ export const SwitchableLayout = ({
79
81
  ]}
80
82
  />
81
83
  )}
82
- <KeysList keys={currentKeys} numOfRows={3} {...props} />
84
+ <View
85
+ testID={
86
+ selectedLayout === SelectedLayout.BASIC
87
+ ? TEST_IDS.KEYBOARD_KEYS_BASIC
88
+ : TEST_IDS.KEYBOARD_KEYS_SECONDARY
89
+ }
90
+ >
91
+ <KeysList keys={currentKeys} numOfRows={3} {...props} />
92
+ </View>
83
93
  </View>
84
94
  )
85
95
  }
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react'
2
+ import { TEST_IDS } from '@magmamath/students-qa'
2
3
  import { SelectedLayout, LayoutOption } from './types'
3
4
 
4
5
  type GetSelectOptionsProps = {
@@ -21,11 +22,13 @@ export function getSelectOptions({
21
22
  key: SelectedLayout.BASIC,
22
23
  title: BasicIcon(selectedLayout === SelectedLayout.BASIC),
23
24
  onPressIn: onBasicPressIn,
25
+ testID: TEST_IDS.KEYBOARD_LAYOUT_SWITCH_BASIC,
24
26
  },
25
27
  {
26
28
  key: SelectedLayout.SECONDARY,
27
29
  title: SecondaryIcon(selectedLayout === SelectedLayout.SECONDARY),
28
30
  onPressIn: onSecondaryPressIn,
31
+ testID: TEST_IDS.KEYBOARD_LAYOUT_SWITCH_SECONDARY,
29
32
  },
30
33
  ]
31
34
  }
@@ -11,6 +11,7 @@ export type LayoutOption = {
11
11
  key: SelectedLayout
12
12
  title: ReactNode
13
13
  onPressIn: () => void
14
+ testID?: string
14
15
  }
15
16
 
16
17
  export type SwitchableLayoutConfig = {
@@ -21,4 +22,5 @@ export type SwitchableLayoutConfig = {
21
22
 
22
23
  export type SwitchableLayoutProps = KeyboardLayoutProps & {
23
24
  config: SwitchableLayoutConfig
25
+ testID?: string
24
26
  }
@@ -17,4 +17,7 @@ export const KEYBOARD_CURRENCY: Record<string, KeyboardGroup> = {
17
17
  ZLOTY_GROSZ: {
18
18
  keys: [MATH_CURRENCY_UNITS.ZLOTY, MATH_CURRENCY_UNITS.GROSZ],
19
19
  },
20
+ FRANC_RAPPEN: {
21
+ keys: [MATH_CURRENCY_UNITS.FRANC, MATH_CURRENCY_UNITS.RAPPEN],
22
+ },
20
23
  }
@@ -100,6 +100,7 @@ const CURRENCY_MAP: Record<KeyboardCurrencyVariant, KeyboardGroup> = {
100
100
  [KeyboardCurrencyVariant.KRONE_EURO_POUND]: KEYBOARD_CURRENCY.KRONE_EURO_POUND,
101
101
  [KeyboardCurrencyVariant.EURO_DOLLAR_POUND]: KEYBOARD_CURRENCY.EURO_DOLLAR_POUND,
102
102
  [KeyboardCurrencyVariant.ZLOTY_GROSZ]: KEYBOARD_CURRENCY.ZLOTY_GROSZ,
103
+ [KeyboardCurrencyVariant.FRANC_RAPPEN]: KEYBOARD_CURRENCY.FRANC_RAPPEN,
103
104
  }
104
105
 
105
106
  const TIME_MAP: Record<KeyboardTimeVariant, KeyboardGroup> = {
@@ -10,6 +10,8 @@ import { PesoIcon } from '../../../../shared/icons/keyboard/PesoIcon'
10
10
  import { CentIcon } from '../../../../shared/icons/keyboard/CentIcon'
11
11
  import { ZlotyIcon } from '../../../../shared/icons/keyboard/ZlotyIcon'
12
12
  import { GroszIcon } from '../../../../shared/icons/keyboard/GroszIcon'
13
+ import { FrancIcon } from '../../../../shared/icons/keyboard/FrancIcon'
14
+ import { RappenIcon } from '../../../../shared/icons/keyboard/RappenIcon'
13
15
 
14
16
  export const MATH_CURRENCY_UNITS: MathOperatorsGroup = {
15
17
  KRONE: {
@@ -58,6 +60,16 @@ export const MATH_CURRENCY_UNITS: MathOperatorsGroup = {
58
60
  mathliveValue: '\\mathrm{gr}',
59
61
  katexValue: 'gr',
60
62
  },
63
+ FRANC: {
64
+ icon: <FrancIcon {...DEFAULT_KEY_ICON_PROPS} />,
65
+ mathliveValue: '\\mathrm{Fr}',
66
+ katexValue: 'Fr',
67
+ },
68
+ RAPPEN: {
69
+ icon: <RappenIcon {...DEFAULT_KEY_ICON_PROPS} />,
70
+ mathliveValue: '\\mathrm{Rp}',
71
+ katexValue: 'Rp',
72
+ },
61
73
  } as const
62
74
 
63
75
  export const MATH_LENGTH_UNITS: MathOperatorsGroup = {
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import { IconProps } from './icon.types'
3
+ import Svg, { Text as SvgText } from 'react-native-svg'
4
+
5
+ export const FrancIcon = ({ size = 20, color }: IconProps) => {
6
+ return (
7
+ <Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
8
+ <SvgText
9
+ x="8"
10
+ y="12"
11
+ fill={color}
12
+ fontSize="10"
13
+ fontWeight="600"
14
+ textAnchor="middle"
15
+ >
16
+ Fr
17
+ </SvgText>
18
+ </Svg>
19
+ )
20
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import { IconProps } from './icon.types'
3
+ import Svg, { Text as SvgText } from 'react-native-svg'
4
+
5
+ export const RappenIcon = ({ size = 20, color }: IconProps) => {
6
+ return (
7
+ <Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
8
+ <SvgText
9
+ x="8"
10
+ y="12"
11
+ fill={color}
12
+ fontSize="8"
13
+ fontWeight="600"
14
+ textAnchor="middle"
15
+ >
16
+ Rp
17
+ </SvgText>
18
+ </Svg>
19
+ )
20
+ }