@magmamath/students-features 0.9.113 → 0.9.114-rc.0
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.
- package/dist/commonjs/features/pmProgress/PracticeProgress.js +264 -0
- package/dist/commonjs/features/pmProgress/PracticeProgress.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/chart.helpers.js +24 -0
- package/dist/commonjs/features/pmProgress/chart/chart.helpers.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/chart.types.js +2 -0
- package/dist/commonjs/features/pmProgress/chart/chart.types.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/PracticeProgressPieChart.js +44 -0
- package/dist/commonjs/features/pmProgress/chart/components/PracticeProgressPieChart.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/SlicesClipPaths.js +38 -0
- package/dist/commonjs/features/pmProgress/chart/components/SlicesClipPaths.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/SlicesPaths.js +64 -0
- package/dist/commonjs/features/pmProgress/chart/components/SlicesPaths.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceArcPattern.js +38 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceArcPattern.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceBackgroundColor.js +21 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceBackgroundColor.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceFillColor.js +49 -0
- package/dist/commonjs/features/pmProgress/chart/components/layers/SliceFillColor.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/model/ArcPatternGenerator.js +49 -0
- package/dist/commonjs/features/pmProgress/chart/model/ArcPatternGenerator.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/model/PieChartManager.js +25 -0
- package/dist/commonjs/features/pmProgress/chart/model/PieChartManager.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/model/SliceHighlight.js +20 -0
- package/dist/commonjs/features/pmProgress/chart/model/SliceHighlight.js.map +1 -0
- package/dist/commonjs/features/pmProgress/chart/model/SliceShapeGenerator.js +67 -0
- package/dist/commonjs/features/pmProgress/chart/model/SliceShapeGenerator.js.map +1 -0
- package/dist/commonjs/features/pmProgress/header/PracticeProgressHeader.js +180 -0
- package/dist/commonjs/features/pmProgress/header/PracticeProgressHeader.js.map +1 -0
- package/dist/commonjs/features/pmProgress/index.js +13 -0
- package/dist/commonjs/features/pmProgress/index.js.map +1 -0
- package/dist/commonjs/features/pmProgress/list/ListCard.js +128 -0
- package/dist/commonjs/features/pmProgress/list/ListCard.js.map +1 -0
- package/dist/commonjs/features/pmProgress/list/ListItem.js +128 -0
- package/dist/commonjs/features/pmProgress/list/ListItem.js.map +1 -0
- package/dist/commonjs/features/pmProgress/recs/TeacherRecs.js +17 -0
- package/dist/commonjs/features/pmProgress/recs/TeacherRecs.js.map +1 -0
- package/dist/commonjs/features/pmProgress/stats/PracticeProgressStats.js +63 -0
- package/dist/commonjs/features/pmProgress/stats/PracticeProgressStats.js.map +1 -0
- package/dist/commonjs/features/pmProgress/stats/StatsCard.js +66 -0
- package/dist/commonjs/features/pmProgress/stats/StatsCard.js.map +1 -0
- package/dist/commonjs/features/pmProgress/temp.js +74 -0
- package/dist/commonjs/features/pmProgress/temp.js.map +1 -0
- package/dist/commonjs/index.js +14 -2
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/shared/icons/PentagonIcon.js +32 -0
- package/dist/commonjs/shared/icons/PentagonIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/SketchArrowRight.js +33 -0
- package/dist/commonjs/shared/icons/SketchArrowRight.js.map +1 -0
- package/dist/commonjs/shared/icons/SliceDiamondIcon.js +32 -0
- package/dist/commonjs/shared/icons/SliceDiamondIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/StarIcon.js +32 -0
- package/dist/commonjs/shared/icons/StarIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/TimerIcon.js +35 -0
- package/dist/commonjs/shared/icons/TimerIcon.js.map +1 -0
- package/dist/module/features/pmProgress/PracticeProgress.js +258 -0
- package/dist/module/features/pmProgress/PracticeProgress.js.map +1 -0
- package/dist/module/features/pmProgress/chart/chart.helpers.js +16 -0
- package/dist/module/features/pmProgress/chart/chart.helpers.js.map +1 -0
- package/dist/module/features/pmProgress/chart/chart.types.js +2 -0
- package/dist/module/features/pmProgress/chart/chart.types.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/PracticeProgressPieChart.js +38 -0
- package/dist/module/features/pmProgress/chart/components/PracticeProgressPieChart.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/SlicesClipPaths.js +32 -0
- package/dist/module/features/pmProgress/chart/components/SlicesClipPaths.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/SlicesPaths.js +58 -0
- package/dist/module/features/pmProgress/chart/components/SlicesPaths.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceArcPattern.js +32 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceArcPattern.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceBackgroundColor.js +15 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceBackgroundColor.js.map +1 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceFillColor.js +43 -0
- package/dist/module/features/pmProgress/chart/components/layers/SliceFillColor.js.map +1 -0
- package/dist/module/features/pmProgress/chart/model/ArcPatternGenerator.js +44 -0
- package/dist/module/features/pmProgress/chart/model/ArcPatternGenerator.js.map +1 -0
- package/dist/module/features/pmProgress/chart/model/PieChartManager.js +20 -0
- package/dist/module/features/pmProgress/chart/model/PieChartManager.js.map +1 -0
- package/dist/module/features/pmProgress/chart/model/SliceHighlight.js +15 -0
- package/dist/module/features/pmProgress/chart/model/SliceHighlight.js.map +1 -0
- package/dist/module/features/pmProgress/chart/model/SliceShapeGenerator.js +62 -0
- package/dist/module/features/pmProgress/chart/model/SliceShapeGenerator.js.map +1 -0
- package/dist/module/features/pmProgress/header/PracticeProgressHeader.js +174 -0
- package/dist/module/features/pmProgress/header/PracticeProgressHeader.js.map +1 -0
- package/dist/module/features/pmProgress/index.js +4 -0
- package/dist/module/features/pmProgress/index.js.map +1 -0
- package/dist/module/features/pmProgress/list/ListCard.js +121 -0
- package/dist/module/features/pmProgress/list/ListCard.js.map +1 -0
- package/dist/module/features/pmProgress/list/ListItem.js +122 -0
- package/dist/module/features/pmProgress/list/ListItem.js.map +1 -0
- package/dist/module/features/pmProgress/recs/TeacherRecs.js +11 -0
- package/dist/module/features/pmProgress/recs/TeacherRecs.js.map +1 -0
- package/dist/module/features/pmProgress/stats/PracticeProgressStats.js +56 -0
- package/dist/module/features/pmProgress/stats/PracticeProgressStats.js.map +1 -0
- package/dist/module/features/pmProgress/stats/StatsCard.js +60 -0
- package/dist/module/features/pmProgress/stats/StatsCard.js.map +1 -0
- package/dist/module/features/pmProgress/temp.js +70 -0
- package/dist/module/features/pmProgress/temp.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/shared/icons/PentagonIcon.js +24 -0
- package/dist/module/shared/icons/PentagonIcon.js.map +1 -0
- package/dist/module/shared/icons/SketchArrowRight.js +25 -0
- package/dist/module/shared/icons/SketchArrowRight.js.map +1 -0
- package/dist/module/shared/icons/SliceDiamondIcon.js +24 -0
- package/dist/module/shared/icons/SliceDiamondIcon.js.map +1 -0
- package/dist/module/shared/icons/StarIcon.js +24 -0
- package/dist/module/shared/icons/StarIcon.js.map +1 -0
- package/dist/module/shared/icons/TimerIcon.js +27 -0
- package/dist/module/shared/icons/TimerIcon.js.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/PracticeProgress.d.ts +3 -0
- package/dist/typescript/commonjs/features/pmProgress/PracticeProgress.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/chart.helpers.d.ts +5 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/chart.helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/chart.types.d.ts +35 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/chart.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/PracticeProgressPieChart.d.ts +9 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/PracticeProgressPieChart.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/SlicesClipPaths.d.ts +10 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/SlicesClipPaths.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/SlicesPaths.d.ts +11 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/SlicesPaths.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceArcPattern.d.ts +12 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceArcPattern.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceBackgroundColor.d.ts +8 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceBackgroundColor.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceFillColor.d.ts +13 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/components/layers/SliceFillColor.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/ArcPatternGenerator.d.ts +12 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/ArcPatternGenerator.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/PieChartManager.d.ts +16 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/PieChartManager.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/SliceHighlight.d.ts +10 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/SliceHighlight.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/SliceShapeGenerator.d.ts +15 -0
- package/dist/typescript/commonjs/features/pmProgress/chart/model/SliceShapeGenerator.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/header/PracticeProgressHeader.d.ts +12 -0
- package/dist/typescript/commonjs/features/pmProgress/header/PracticeProgressHeader.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/index.d.ts +2 -0
- package/dist/typescript/commonjs/features/pmProgress/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/list/ListCard.d.ts +15 -0
- package/dist/typescript/commonjs/features/pmProgress/list/ListCard.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/list/ListItem.d.ts +11 -0
- package/dist/typescript/commonjs/features/pmProgress/list/ListItem.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/recs/TeacherRecs.d.ts +3 -0
- package/dist/typescript/commonjs/features/pmProgress/recs/TeacherRecs.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/stats/PracticeProgressStats.d.ts +3 -0
- package/dist/typescript/commonjs/features/pmProgress/stats/PracticeProgressStats.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/stats/StatsCard.d.ts +10 -0
- package/dist/typescript/commonjs/features/pmProgress/stats/StatsCard.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/temp.d.ts +4 -0
- package/dist/typescript/commonjs/features/pmProgress/temp.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/PentagonIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/PentagonIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/SketchArrowRight.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/SketchArrowRight.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/SliceDiamondIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/SliceDiamondIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/StarIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/StarIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/TimerIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/TimerIcon.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/PracticeProgress.d.ts +3 -0
- package/dist/typescript/module/features/pmProgress/PracticeProgress.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/chart.helpers.d.ts +5 -0
- package/dist/typescript/module/features/pmProgress/chart/chart.helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/chart.types.d.ts +35 -0
- package/dist/typescript/module/features/pmProgress/chart/chart.types.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/PracticeProgressPieChart.d.ts +9 -0
- package/dist/typescript/module/features/pmProgress/chart/components/PracticeProgressPieChart.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/SlicesClipPaths.d.ts +10 -0
- package/dist/typescript/module/features/pmProgress/chart/components/SlicesClipPaths.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/SlicesPaths.d.ts +11 -0
- package/dist/typescript/module/features/pmProgress/chart/components/SlicesPaths.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceArcPattern.d.ts +12 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceArcPattern.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceBackgroundColor.d.ts +8 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceBackgroundColor.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceFillColor.d.ts +13 -0
- package/dist/typescript/module/features/pmProgress/chart/components/layers/SliceFillColor.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/model/ArcPatternGenerator.d.ts +12 -0
- package/dist/typescript/module/features/pmProgress/chart/model/ArcPatternGenerator.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/model/PieChartManager.d.ts +16 -0
- package/dist/typescript/module/features/pmProgress/chart/model/PieChartManager.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/model/SliceHighlight.d.ts +10 -0
- package/dist/typescript/module/features/pmProgress/chart/model/SliceHighlight.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/chart/model/SliceShapeGenerator.d.ts +15 -0
- package/dist/typescript/module/features/pmProgress/chart/model/SliceShapeGenerator.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/header/PracticeProgressHeader.d.ts +12 -0
- package/dist/typescript/module/features/pmProgress/header/PracticeProgressHeader.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/index.d.ts +2 -0
- package/dist/typescript/module/features/pmProgress/index.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/list/ListCard.d.ts +15 -0
- package/dist/typescript/module/features/pmProgress/list/ListCard.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/list/ListItem.d.ts +11 -0
- package/dist/typescript/module/features/pmProgress/list/ListItem.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/recs/TeacherRecs.d.ts +3 -0
- package/dist/typescript/module/features/pmProgress/recs/TeacherRecs.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/stats/PracticeProgressStats.d.ts +3 -0
- package/dist/typescript/module/features/pmProgress/stats/PracticeProgressStats.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/stats/StatsCard.d.ts +10 -0
- package/dist/typescript/module/features/pmProgress/stats/StatsCard.d.ts.map +1 -0
- package/dist/typescript/module/features/pmProgress/temp.d.ts +4 -0
- package/dist/typescript/module/features/pmProgress/temp.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/PentagonIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/PentagonIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/SketchArrowRight.d.ts +4 -0
- package/dist/typescript/module/shared/icons/SketchArrowRight.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/SliceDiamondIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/SliceDiamondIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/StarIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/StarIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/TimerIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/TimerIcon.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/features/pmProgress/PracticeProgress.tsx +249 -0
- package/src/features/pmProgress/chart/chart.helpers.ts +15 -0
- package/src/features/pmProgress/chart/chart.types.ts +36 -0
- package/src/features/pmProgress/chart/components/PracticeProgressPieChart.tsx +32 -0
- package/src/features/pmProgress/chart/components/SlicesClipPaths.tsx +36 -0
- package/src/features/pmProgress/chart/components/SlicesPaths.tsx +67 -0
- package/src/features/pmProgress/chart/components/layers/SliceArcPattern.tsx +44 -0
- package/src/features/pmProgress/chart/components/layers/SliceBackgroundColor.tsx +11 -0
- package/src/features/pmProgress/chart/components/layers/SliceFillColor.tsx +55 -0
- package/src/features/pmProgress/chart/model/ArcPatternGenerator.ts +48 -0
- package/src/features/pmProgress/chart/model/PieChartManager.ts +20 -0
- package/src/features/pmProgress/chart/model/SliceHighlight.ts +17 -0
- package/src/features/pmProgress/chart/model/SliceShapeGenerator.ts +71 -0
- package/src/features/pmProgress/header/PracticeProgressHeader.tsx +178 -0
- package/src/features/pmProgress/index.ts +1 -0
- package/src/features/pmProgress/list/ListCard.tsx +133 -0
- package/src/features/pmProgress/list/ListItem.tsx +113 -0
- package/src/features/pmProgress/recs/TeacherRecs.tsx +10 -0
- package/src/features/pmProgress/stats/PracticeProgressStats.tsx +60 -0
- package/src/features/pmProgress/stats/StatsCard.tsx +58 -0
- package/src/features/pmProgress/temp.ts +67 -0
- package/src/index.ts +1 -0
- package/src/shared/icons/PentagonIcon.tsx +17 -0
- package/src/shared/icons/SketchArrowRight.tsx +18 -0
- package/src/shared/icons/SliceDiamondIcon.tsx +16 -0
- package/src/shared/icons/StarIcon.tsx +17 -0
- package/src/shared/icons/TimerIcon.tsx +21 -0
- package/dist/commonjs/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/dist/module/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/src/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { arc, pie } from 'd3-shape'
|
|
2
|
+
import type { PieChartManagerConfig, SliceInputData, SliceShape } from '../chart.types'
|
|
3
|
+
|
|
4
|
+
export class SliceShapeGenerator {
|
|
5
|
+
private innerRadius = 0
|
|
6
|
+
private readonly d3Pie = pie<SliceInputData>()
|
|
7
|
+
.value(({ value }) => value)
|
|
8
|
+
.sort(null)
|
|
9
|
+
|
|
10
|
+
constructor(private readonly config: PieChartManagerConfig) {}
|
|
11
|
+
|
|
12
|
+
public generateSlices(data: SliceInputData[]): SliceShape[] {
|
|
13
|
+
this.innerRadius = this.getInnerRadius(data.length)
|
|
14
|
+
|
|
15
|
+
return this.d3Pie(data).map((datum, index) => ({
|
|
16
|
+
index,
|
|
17
|
+
startAngle: datum.startAngle,
|
|
18
|
+
endAngle: datum.endAngle,
|
|
19
|
+
fillPercent: datum.data.fillPercent ?? 0,
|
|
20
|
+
backgroundColor: datum.data.backgroundColor ?? this.config.colors.background,
|
|
21
|
+
fillColor: datum.data.fillColor,
|
|
22
|
+
borderColor: datum.data.borderColor,
|
|
23
|
+
data: datum.data,
|
|
24
|
+
}))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public generateSlicePath(slice: SliceShape): string {
|
|
28
|
+
const cornerRadius = this.getCornerRadius(100)
|
|
29
|
+
return this.buildArc(slice, this.config.outerRadius, cornerRadius)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public generateFillPath(slice: SliceShape): string {
|
|
33
|
+
const innerRadius = this.innerRadius
|
|
34
|
+
const outerRadius = this.config.outerRadius
|
|
35
|
+
const fillRadius = innerRadius + (outerRadius - innerRadius) * (slice.fillPercent / 100)
|
|
36
|
+
const radialThickness = fillRadius - innerRadius
|
|
37
|
+
const cornerRadius = Math.min(this.getCornerRadius(slice.fillPercent), radialThickness / 2)
|
|
38
|
+
|
|
39
|
+
return this.buildArc(slice, fillRadius, cornerRadius)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private getInnerRadius(sliceCount: number): number {
|
|
43
|
+
const { innerRadius } = this.config
|
|
44
|
+
return typeof innerRadius === 'function' ? innerRadius(sliceCount) : innerRadius
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private getCornerRadius(fillPercent: number): number {
|
|
48
|
+
const { cornerRadius } = this.config
|
|
49
|
+
return typeof cornerRadius === 'function' ? cornerRadius(fillPercent) : cornerRadius
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private get padAngle(): number {
|
|
53
|
+
return this.config.gapBetweenSlices / this.config.outerRadius
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private buildArc(slice: SliceShape, outerRadius: number, cornerRadius: number): string {
|
|
57
|
+
const innerRadius = this.innerRadius
|
|
58
|
+
|
|
59
|
+
return arc()
|
|
60
|
+
.outerRadius(outerRadius)
|
|
61
|
+
.innerRadius(innerRadius)
|
|
62
|
+
.cornerRadius(cornerRadius)
|
|
63
|
+
.padAngle(this.padAngle)
|
|
64
|
+
.padRadius(this.config.outerRadius)({
|
|
65
|
+
startAngle: slice.startAngle,
|
|
66
|
+
endAngle: slice.endAngle,
|
|
67
|
+
innerRadius,
|
|
68
|
+
outerRadius,
|
|
69
|
+
}) as string
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { View, StyleSheet } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
Dropdown,
|
|
5
|
+
HeadingVariants,
|
|
6
|
+
Menu,
|
|
7
|
+
Typography,
|
|
8
|
+
CaretDownIcon,
|
|
9
|
+
CaretUpIcon,
|
|
10
|
+
Button,
|
|
11
|
+
ButtonVariant,
|
|
12
|
+
SPACING,
|
|
13
|
+
ButtonSize,
|
|
14
|
+
PlayIcon,
|
|
15
|
+
COLORS,
|
|
16
|
+
ButtonColor,
|
|
17
|
+
} from '@magmamath/react-native-ui'
|
|
18
|
+
import { SketchArrowRight } from '../../../shared/icons/SketchArrowRight'
|
|
19
|
+
import { SliceDiamondIcon } from '../../../shared/icons/SliceDiamondIcon'
|
|
20
|
+
|
|
21
|
+
// TODO: temp, remove and pass from props
|
|
22
|
+
const items = [
|
|
23
|
+
{
|
|
24
|
+
key: 'item-1',
|
|
25
|
+
title: 'Grade1',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: 'item-1',
|
|
29
|
+
title: 'Grade2',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'item-1',
|
|
33
|
+
title: 'Grade3',
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
type PracticeProgressHeaderProps = {
|
|
38
|
+
title: string
|
|
39
|
+
grade: string
|
|
40
|
+
nextUp: string
|
|
41
|
+
topic: string
|
|
42
|
+
buttonLabel: string
|
|
43
|
+
topicColor: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const PracticeProgressHeader = ({
|
|
47
|
+
title,
|
|
48
|
+
grade,
|
|
49
|
+
nextUp,
|
|
50
|
+
topic,
|
|
51
|
+
buttonLabel,
|
|
52
|
+
topicColor,
|
|
53
|
+
}: PracticeProgressHeaderProps) => {
|
|
54
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false)
|
|
55
|
+
const CaretIcon = isDropdownOpen ? CaretUpIcon : CaretDownIcon
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View style={styles.container}>
|
|
59
|
+
<View style={styles.title}>
|
|
60
|
+
<Typography variant={HeadingVariants.H2} style={styles.dark}>
|
|
61
|
+
{title}
|
|
62
|
+
</Typography>
|
|
63
|
+
<Dropdown
|
|
64
|
+
isOpen={isDropdownOpen}
|
|
65
|
+
anchor={
|
|
66
|
+
<Button
|
|
67
|
+
variant={ButtonVariant.TERTIARY}
|
|
68
|
+
onPress={() => setIsDropdownOpen((prev) => !prev)}
|
|
69
|
+
>
|
|
70
|
+
<Typography variant={HeadingVariants.H8} style={styles.dark}>
|
|
71
|
+
{grade}
|
|
72
|
+
</Typography>
|
|
73
|
+
<View style={styles.caret}>
|
|
74
|
+
<CaretIcon color={COLORS.NEUTRAL_9} />
|
|
75
|
+
</View>
|
|
76
|
+
</Button>
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
<Menu style={styles.menu} items={items} />
|
|
80
|
+
</Dropdown>
|
|
81
|
+
</View>
|
|
82
|
+
|
|
83
|
+
<View style={styles.nextUp}>
|
|
84
|
+
<View style={styles.content}>
|
|
85
|
+
<View style={styles.subtitle}>
|
|
86
|
+
<Typography variant={HeadingVariants.H2} style={styles.dark}>
|
|
87
|
+
{nextUp}
|
|
88
|
+
</Typography>
|
|
89
|
+
</View>
|
|
90
|
+
<View style={[styles.row, styles.tilted]}>
|
|
91
|
+
<Typography variant={HeadingVariants.H7} style={styles.muted}>
|
|
92
|
+
{topic}
|
|
93
|
+
</Typography>
|
|
94
|
+
<View style={styles.diamond}>
|
|
95
|
+
<SliceDiamondIcon color={topicColor} />
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
</View>
|
|
99
|
+
<View style={styles.arrow}>
|
|
100
|
+
<SketchArrowRight />
|
|
101
|
+
</View>
|
|
102
|
+
<Button
|
|
103
|
+
icon={<PlayIcon size={16} color={COLORS.NEUTRAL_1} />}
|
|
104
|
+
variant={ButtonVariant.PRIMARY}
|
|
105
|
+
size={ButtonSize.LARGE}
|
|
106
|
+
colorScheme={ButtonColor.YELLOW}
|
|
107
|
+
raiseLevel={6}
|
|
108
|
+
style={{ container: styles.startButton }}
|
|
109
|
+
>
|
|
110
|
+
<Typography variant={HeadingVariants.H6} style={styles.startButtonText}>
|
|
111
|
+
{buttonLabel}
|
|
112
|
+
</Typography>
|
|
113
|
+
</Button>
|
|
114
|
+
</View>
|
|
115
|
+
</View>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
container: {
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
justifyContent: 'space-between',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
marginBottom: SPACING[400],
|
|
125
|
+
},
|
|
126
|
+
title: {
|
|
127
|
+
flexDirection: 'row',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
gap: SPACING[200],
|
|
130
|
+
},
|
|
131
|
+
dark: {
|
|
132
|
+
color: COLORS.NEUTRAL_9,
|
|
133
|
+
},
|
|
134
|
+
caret: {
|
|
135
|
+
marginLeft: SPACING[100],
|
|
136
|
+
},
|
|
137
|
+
menu: {
|
|
138
|
+
top: SPACING[100],
|
|
139
|
+
minWidth: 110,
|
|
140
|
+
},
|
|
141
|
+
nextUp: {
|
|
142
|
+
flexDirection: 'row',
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
gap: SPACING[400],
|
|
145
|
+
},
|
|
146
|
+
content: {
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
gap: SPACING[100],
|
|
149
|
+
},
|
|
150
|
+
subtitle: {
|
|
151
|
+
transform: [{ rotate: '355deg' }],
|
|
152
|
+
marginRight: SPACING[300],
|
|
153
|
+
},
|
|
154
|
+
tilted: {
|
|
155
|
+
transform: [{ rotate: '355deg' }],
|
|
156
|
+
},
|
|
157
|
+
row: {
|
|
158
|
+
flexDirection: 'row',
|
|
159
|
+
gap: SPACING[100],
|
|
160
|
+
},
|
|
161
|
+
muted: {
|
|
162
|
+
color: COLORS.NEUTRAL_8,
|
|
163
|
+
},
|
|
164
|
+
diamond: {
|
|
165
|
+
bottom: 10,
|
|
166
|
+
},
|
|
167
|
+
arrow: {
|
|
168
|
+
transform: [{ rotate: '358deg' }],
|
|
169
|
+
},
|
|
170
|
+
startButton: {
|
|
171
|
+
minWidth: 145,
|
|
172
|
+
},
|
|
173
|
+
startButtonText: {
|
|
174
|
+
fontWeight: '700',
|
|
175
|
+
textTransform: 'uppercase',
|
|
176
|
+
color: COLORS.NEUTRAL_1,
|
|
177
|
+
},
|
|
178
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PracticeProgress } from './PracticeProgress'
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Pressable, View, StyleSheet } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
BORDER_RADIUS,
|
|
5
|
+
CaretDownIcon,
|
|
6
|
+
CaretUpIcon,
|
|
7
|
+
COLORS,
|
|
8
|
+
HeadingVariants,
|
|
9
|
+
SPACING,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@magmamath/react-native-ui'
|
|
12
|
+
import { ListItem, type ListItemData } from './ListItem'
|
|
13
|
+
|
|
14
|
+
const HEADER_HEIGHT = 60
|
|
15
|
+
const RADIUS = BORDER_RADIUS[200]
|
|
16
|
+
const PROGRESS_BAR_WIDTH = 50
|
|
17
|
+
const PROGRESS_BAR_HEIGHT = 10
|
|
18
|
+
|
|
19
|
+
type ListCardProps = {
|
|
20
|
+
title: string
|
|
21
|
+
icon: JSX.Element
|
|
22
|
+
color: string
|
|
23
|
+
items: ListItemData[]
|
|
24
|
+
progress?: number
|
|
25
|
+
rightContent?: React.ReactNode
|
|
26
|
+
isFirst?: boolean
|
|
27
|
+
isLast?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const ListCard = ({
|
|
31
|
+
title,
|
|
32
|
+
icon,
|
|
33
|
+
color,
|
|
34
|
+
items,
|
|
35
|
+
progress = 0,
|
|
36
|
+
rightContent,
|
|
37
|
+
isFirst,
|
|
38
|
+
isLast,
|
|
39
|
+
}: ListCardProps) => {
|
|
40
|
+
const [expanded, setExpanded] = useState(false)
|
|
41
|
+
const Caret = expanded ? CaretUpIcon : CaretDownIcon
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View style={[styles.container, isFirst && styles.first, isLast && styles.last]}>
|
|
45
|
+
<Pressable style={styles.header} onPress={() => setExpanded((prev) => !prev)}>
|
|
46
|
+
{icon}
|
|
47
|
+
<View style={styles.caret}>
|
|
48
|
+
<Caret color={COLORS.NEUTRAL_9} />
|
|
49
|
+
</View>
|
|
50
|
+
<Typography variant={HeadingVariants.H6} style={styles.title}>
|
|
51
|
+
{title}
|
|
52
|
+
</Typography>
|
|
53
|
+
{rightContent ?? (
|
|
54
|
+
<View style={styles.progress}>
|
|
55
|
+
<Typography variant={HeadingVariants.H7} style={[styles.percentage, { color }]}>
|
|
56
|
+
{Math.round(progress)}%
|
|
57
|
+
</Typography>
|
|
58
|
+
<View style={styles.track}>
|
|
59
|
+
<View
|
|
60
|
+
style={[styles.fill, { width: `${progress}%`, backgroundColor: color }]}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
</View>
|
|
64
|
+
)}
|
|
65
|
+
</Pressable>
|
|
66
|
+
{expanded && (
|
|
67
|
+
<View style={styles.items}>
|
|
68
|
+
{items.map((item, index) => (
|
|
69
|
+
<ListItem key={index} {...item} />
|
|
70
|
+
))}
|
|
71
|
+
</View>
|
|
72
|
+
)}
|
|
73
|
+
</View>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const styles = StyleSheet.create({
|
|
78
|
+
container: {
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
backgroundColor: COLORS.NEUTRAL_2,
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: COLORS.NEUTRAL_4,
|
|
83
|
+
borderTopWidth: 0,
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
},
|
|
86
|
+
first: {
|
|
87
|
+
borderTopWidth: 1,
|
|
88
|
+
borderTopLeftRadius: RADIUS,
|
|
89
|
+
borderTopRightRadius: RADIUS,
|
|
90
|
+
},
|
|
91
|
+
last: {
|
|
92
|
+
borderBottomLeftRadius: RADIUS,
|
|
93
|
+
borderBottomRightRadius: RADIUS,
|
|
94
|
+
},
|
|
95
|
+
header: {
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
height: HEADER_HEIGHT,
|
|
99
|
+
padding: SPACING[400],
|
|
100
|
+
backgroundColor: COLORS.NEUTRAL_2,
|
|
101
|
+
},
|
|
102
|
+
caret: {
|
|
103
|
+
marginLeft: SPACING[400],
|
|
104
|
+
},
|
|
105
|
+
title: {
|
|
106
|
+
marginLeft: SPACING[200],
|
|
107
|
+
flex: 1,
|
|
108
|
+
},
|
|
109
|
+
progress: {
|
|
110
|
+
flexDirection: 'row',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
gap: SPACING[200],
|
|
113
|
+
},
|
|
114
|
+
percentage: {
|
|
115
|
+
textAlign: 'right',
|
|
116
|
+
},
|
|
117
|
+
track: {
|
|
118
|
+
width: PROGRESS_BAR_WIDTH,
|
|
119
|
+
height: PROGRESS_BAR_HEIGHT,
|
|
120
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
121
|
+
borderRadius: BORDER_RADIUS[200],
|
|
122
|
+
overflow: 'hidden',
|
|
123
|
+
},
|
|
124
|
+
fill: {
|
|
125
|
+
height: '100%',
|
|
126
|
+
borderRadius: BORDER_RADIUS[200],
|
|
127
|
+
},
|
|
128
|
+
items: {
|
|
129
|
+
gap: SPACING[200],
|
|
130
|
+
padding: SPACING[200],
|
|
131
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
132
|
+
},
|
|
133
|
+
})
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native'
|
|
3
|
+
import { ArrowRightIcon, CheckIcon } from '@magmamath/react-native-ui'
|
|
4
|
+
|
|
5
|
+
const TEXT_COLOR = '#4D4D63'
|
|
6
|
+
const SUBTITLE_COLOR = '#80808F'
|
|
7
|
+
const FINISHED_BG = '#EFFBF5'
|
|
8
|
+
const FINISHED_TITLE = '#00804A'
|
|
9
|
+
const FINISHED_SUBTITLE = '#29A96F'
|
|
10
|
+
const FINISHED_ICON = '#5CD497'
|
|
11
|
+
const SHADOW_COLOR = '#333333'
|
|
12
|
+
const ICON_SIZE = 25
|
|
13
|
+
const FONT_FAMILY = 'Buenos Aires'
|
|
14
|
+
|
|
15
|
+
export type ListItemData = {
|
|
16
|
+
title: string
|
|
17
|
+
subtitle: string
|
|
18
|
+
skillsLeft: number
|
|
19
|
+
isFinished?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type ListItemProps = ListItemData
|
|
23
|
+
|
|
24
|
+
export const ListItem = ({ title, subtitle, skillsLeft, isFinished = false }: ListItemProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<View style={[styles.card, isFinished && styles.finished]}>
|
|
27
|
+
<View style={styles.content}>
|
|
28
|
+
<Text style={[styles.title, isFinished && styles.titleFinished]} numberOfLines={1}>
|
|
29
|
+
{title}
|
|
30
|
+
</Text>
|
|
31
|
+
<Text style={[styles.subtitle, isFinished && styles.subtitleFinished]} numberOfLines={1}>
|
|
32
|
+
{subtitle}
|
|
33
|
+
</Text>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={styles.trailing}>
|
|
36
|
+
{!isFinished && <Text style={styles.skills}>{skillsLeft} skills left</Text>}
|
|
37
|
+
<View style={styles.icon}>
|
|
38
|
+
{isFinished ? (
|
|
39
|
+
<CheckIcon color={FINISHED_ICON} />
|
|
40
|
+
) : (
|
|
41
|
+
<ArrowRightIcon color={TEXT_COLOR} />
|
|
42
|
+
)}
|
|
43
|
+
</View>
|
|
44
|
+
</View>
|
|
45
|
+
</View>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
card: {
|
|
51
|
+
flexDirection: 'row',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
paddingVertical: 8,
|
|
54
|
+
paddingLeft: 32,
|
|
55
|
+
paddingRight: 16,
|
|
56
|
+
backgroundColor: 'white',
|
|
57
|
+
borderRadius: 12,
|
|
58
|
+
gap: 8,
|
|
59
|
+
shadowColor: SHADOW_COLOR,
|
|
60
|
+
shadowOffset: { width: 0, height: 1 },
|
|
61
|
+
shadowOpacity: 0.25,
|
|
62
|
+
shadowRadius: 3,
|
|
63
|
+
elevation: 3,
|
|
64
|
+
},
|
|
65
|
+
finished: {
|
|
66
|
+
backgroundColor: FINISHED_BG,
|
|
67
|
+
shadowOffset: { width: 0, height: 0 },
|
|
68
|
+
shadowOpacity: 0.4,
|
|
69
|
+
shadowRadius: 0.5,
|
|
70
|
+
elevation: 1,
|
|
71
|
+
},
|
|
72
|
+
content: {
|
|
73
|
+
flex: 1,
|
|
74
|
+
},
|
|
75
|
+
title: {
|
|
76
|
+
color: TEXT_COLOR,
|
|
77
|
+
fontSize: 13,
|
|
78
|
+
fontFamily: FONT_FAMILY,
|
|
79
|
+
fontWeight: '400',
|
|
80
|
+
lineHeight: 18.2,
|
|
81
|
+
},
|
|
82
|
+
titleFinished: {
|
|
83
|
+
color: FINISHED_TITLE,
|
|
84
|
+
},
|
|
85
|
+
subtitle: {
|
|
86
|
+
color: SUBTITLE_COLOR,
|
|
87
|
+
fontSize: 10,
|
|
88
|
+
fontFamily: FONT_FAMILY,
|
|
89
|
+
fontWeight: '400',
|
|
90
|
+
lineHeight: 14,
|
|
91
|
+
},
|
|
92
|
+
subtitleFinished: {
|
|
93
|
+
color: FINISHED_SUBTITLE,
|
|
94
|
+
},
|
|
95
|
+
trailing: {
|
|
96
|
+
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
gap: 8,
|
|
99
|
+
},
|
|
100
|
+
skills: {
|
|
101
|
+
color: TEXT_COLOR,
|
|
102
|
+
fontSize: 13,
|
|
103
|
+
fontFamily: FONT_FAMILY,
|
|
104
|
+
fontWeight: '400',
|
|
105
|
+
lineHeight: 18.2,
|
|
106
|
+
},
|
|
107
|
+
icon: {
|
|
108
|
+
width: ICON_SIZE,
|
|
109
|
+
height: ICON_SIZE,
|
|
110
|
+
justifyContent: 'center',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
},
|
|
113
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { COLORS, SelectGroup, SelectOptionColor, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
+
import { StatsCard } from './StatsCard'
|
|
5
|
+
import { StarIcon } from '../../../shared/icons/StarIcon'
|
|
6
|
+
import { TimerIcon } from '../../../shared/icons/TimerIcon'
|
|
7
|
+
|
|
8
|
+
type Option = {
|
|
9
|
+
key: string
|
|
10
|
+
title: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const OPTIONS: Option[] = [
|
|
14
|
+
{ key: '1', title: 'This week' },
|
|
15
|
+
{ key: '2', title: 'Last week' },
|
|
16
|
+
{ key: '3', title: 'All time' },
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
const DEFAULT_SELECTED = [OPTIONS[0]]
|
|
20
|
+
|
|
21
|
+
export const PracticeProgressStats = () => {
|
|
22
|
+
const [selected, setSelected] = useState<Option[]>(DEFAULT_SELECTED)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View style={styles.container}>
|
|
26
|
+
<View style={styles.cards}>
|
|
27
|
+
<StatsCard
|
|
28
|
+
value="46"
|
|
29
|
+
label="Practice stars"
|
|
30
|
+
color={COLORS.PRIMARY_YELLOW}
|
|
31
|
+
icon={<StarIcon />}
|
|
32
|
+
/>
|
|
33
|
+
<StatsCard
|
|
34
|
+
value="24m"
|
|
35
|
+
label="Practice time"
|
|
36
|
+
color={COLORS.PRIMARY_PURPLE}
|
|
37
|
+
icon={<TimerIcon />}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
|
|
41
|
+
<SelectGroup
|
|
42
|
+
color={SelectOptionColor.GREY}
|
|
43
|
+
options={OPTIONS}
|
|
44
|
+
selectedOptions={selected}
|
|
45
|
+
onOptionChange={(option) => setSelected([option as Option])}
|
|
46
|
+
/>
|
|
47
|
+
</View>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
container: {
|
|
53
|
+
gap: SPACING[100],
|
|
54
|
+
},
|
|
55
|
+
cards: {
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
justifyContent: 'space-between',
|
|
58
|
+
gap: SPACING[300],
|
|
59
|
+
},
|
|
60
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, StyleSheet, Text, Platform } from 'react-native'
|
|
3
|
+
import {
|
|
4
|
+
COLORS,
|
|
5
|
+
HeadingVariants,
|
|
6
|
+
ParagraphVariants,
|
|
7
|
+
SPACING,
|
|
8
|
+
Typography,
|
|
9
|
+
} from '@magmamath/react-native-ui'
|
|
10
|
+
|
|
11
|
+
type StatsCardProps = {
|
|
12
|
+
value: string
|
|
13
|
+
label: string
|
|
14
|
+
color: string
|
|
15
|
+
icon: JSX.Element
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StatsCard = ({ value, label, color, icon }: StatsCardProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<View style={[styles.card, { borderColor: color }]}>
|
|
21
|
+
<View
|
|
22
|
+
style={{
|
|
23
|
+
width: 42,
|
|
24
|
+
height: 42,
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
borderRadius: '100%',
|
|
28
|
+
backgroundColor: color,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{icon}
|
|
32
|
+
</View>
|
|
33
|
+
<View>
|
|
34
|
+
<Text style={{ color, fontSize: 32, fontWeight: 700, fontFamily: 'Buenos Aires' }}>
|
|
35
|
+
{value}
|
|
36
|
+
</Text>
|
|
37
|
+
<Text
|
|
38
|
+
style={{ color: COLORS.NEUTRAL_8, fontSize: 10, fontFamily: 'Buenos Aires', top: -6 }}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</Text>
|
|
42
|
+
</View>
|
|
43
|
+
</View>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
card: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
height: 65,
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
borderRadius: 12,
|
|
54
|
+
borderWidth: 4,
|
|
55
|
+
padding: 8,
|
|
56
|
+
gap: 8,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { COLORS } from '@magmamath/react-native-ui'
|
|
2
|
+
import { dynamicInnerRadius, dynamicCornerRadius } from './chart/chart.helpers'
|
|
3
|
+
import type { PieChartManagerConfig, SliceInputData } from './chart/chart.types'
|
|
4
|
+
|
|
5
|
+
export const SAMPLE_DATA: SliceInputData[] = [
|
|
6
|
+
{
|
|
7
|
+
value: 1, // Large slice
|
|
8
|
+
fillPercent: 100,
|
|
9
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
10
|
+
fillColor: COLORS.PRIMARY_BLUE,
|
|
11
|
+
borderColor: COLORS.BLUE_6,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: 1,
|
|
15
|
+
fillPercent: 75,
|
|
16
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
17
|
+
fillColor: COLORS.PRIMARY_TURQUOISE,
|
|
18
|
+
borderColor: COLORS.TURQUOISE_6,
|
|
19
|
+
}, // Small
|
|
20
|
+
{
|
|
21
|
+
value: 1,
|
|
22
|
+
fillPercent: 75,
|
|
23
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
24
|
+
fillColor: COLORS.PRIMARY_TURQUOISE,
|
|
25
|
+
borderColor: COLORS.TURQUOISE_6,
|
|
26
|
+
}, // Small
|
|
27
|
+
{
|
|
28
|
+
value: 1,
|
|
29
|
+
fillPercent: 50,
|
|
30
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
31
|
+
fillColor: COLORS.PRIMARY_GREEN,
|
|
32
|
+
borderColor: COLORS.GREEN_6,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 1, // Small slice
|
|
36
|
+
fillPercent: 20,
|
|
37
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
38
|
+
fillColor: COLORS.PRIMARY_ORANGE,
|
|
39
|
+
borderColor: COLORS.ORANGE_6,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: 1, // Large slice
|
|
43
|
+
fillPercent: 90,
|
|
44
|
+
backgroundColor: COLORS.NEUTRAL_4,
|
|
45
|
+
fillColor: COLORS.PRIMARY_PURPLE,
|
|
46
|
+
borderColor: COLORS.PURPLE_6,
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
export const DEFAULT_CONFIG: PieChartManagerConfig = {
|
|
51
|
+
size: 430,
|
|
52
|
+
outerRadius: 210,
|
|
53
|
+
innerRadius: dynamicInnerRadius,
|
|
54
|
+
gapBetweenSlices: 8,
|
|
55
|
+
cornerRadius: dynamicCornerRadius,
|
|
56
|
+
// minSlicePercent: 5, // Minimum visual size for any slice (prevents tiny slices)
|
|
57
|
+
pressOffset: 4, // How far slice moves on Y axis when pressed
|
|
58
|
+
borderWidth: 4, // Stroke width when pressed
|
|
59
|
+
colors: {
|
|
60
|
+
background: 'white', // page background color don't update
|
|
61
|
+
},
|
|
62
|
+
outerArc: {
|
|
63
|
+
color: '#FFFFFF40',
|
|
64
|
+
strokeWidth: 11.75, // Height of each pattern row
|
|
65
|
+
dashWidth: 22, // Width of dashes (fixed for all slices)
|
|
66
|
+
},
|
|
67
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,5 +9,6 @@ export * from './features/problemSelector'
|
|
|
9
9
|
export * from './features/gifCelebrations'
|
|
10
10
|
export * from './features/exampleSolution'
|
|
11
11
|
export * from './features/keyboard'
|
|
12
|
+
export * from './features/pmProgress'
|
|
12
13
|
export * from './features/openEnded'
|
|
13
14
|
export * from './shared/icons'
|