@wger-project/react-components 25.12.5 → 26.1.18
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/build/assets/ajax-loader.gif +0 -0
- package/build/assets/index.css +1 -1
- package/build/assets/slick.svg +14 -0
- package/build/locales/de/translation.json +13 -3
- package/build/locales/en/translation.json +3 -0
- package/build/locales/es/translation.json +22 -3
- package/build/locales/fr/translation.json +10 -1
- package/build/locales/hi/translation.json +4 -1
- package/build/locales/nl/translation.json +118 -11
- package/build/locales/pt_BR/translation.json +12 -3
- package/build/locales/ru/translation.json +39 -3
- package/build/locales/uk/translation.json +10 -1
- package/build/main.js +169 -169
- package/build/main.js.map +1 -1
- package/package.json +4 -1
- package/src/components/BodyWeight/TableDashboard/TableDashboard.tsx +4 -6
- package/src/components/Calendar/Components/CalendarComponent.test.tsx +18 -22
- package/src/components/Calendar/Components/CalendarComponent.tsx +11 -8
- package/src/components/Calendar/Components/CalendarHeader.tsx +3 -3
- package/src/components/Calendar/Components/Entries.tsx +8 -3
- package/src/components/Dashboard/CalendarCard.tsx +16 -0
- package/src/components/Dashboard/ConfigurableDashboard.test.ts +128 -0
- package/src/components/Dashboard/ConfigurableDashboard.tsx +306 -55
- package/src/components/Dashboard/DashboardCard.tsx +3 -2
- package/src/components/Dashboard/MeasurementCard.test.tsx +75 -0
- package/src/components/Dashboard/MeasurementCard.tsx +101 -0
- package/src/components/Dashboard/TrophiesCard.test.tsx +63 -0
- package/src/components/Dashboard/TrophiesCard.tsx +84 -0
- package/src/components/Dashboard/WeightCard.test.tsx +0 -10
- package/src/components/Measurements/Screens/MeasurementCategoryOverview.tsx +1 -1
- package/src/components/Measurements/models/Category.ts +13 -2
- package/src/components/Measurements/models/Entry.ts +13 -2
- package/src/components/Trophies/components/TrophiesDetail.test.tsx +34 -0
- package/src/components/Trophies/components/TrophiesDetail.tsx +88 -0
- package/src/components/Trophies/models/trophy.test.ts +33 -0
- package/src/components/Trophies/models/trophy.ts +75 -0
- package/src/components/Trophies/models/userTrophy.test.ts +38 -0
- package/src/components/Trophies/models/userTrophy.ts +67 -0
- package/src/components/Trophies/models/userTrophyProgression.test.ts +43 -0
- package/src/components/Trophies/models/userTrophyProgression.ts +68 -0
- package/src/components/Trophies/queries/trophies.ts +31 -0
- package/src/components/Trophies/services/trophies.ts +22 -0
- package/src/components/Trophies/services/userTrophies.ts +33 -0
- package/src/components/Trophies/services/userTrophyProgression.ts +16 -0
- package/src/components/index.ts +0 -2
- package/src/pages/Calendar/index.tsx +2 -2
- package/src/pages/WeightOverview/index.tsx +1 -1
- package/src/routes.tsx +6 -1
- package/src/services/measurements.ts +10 -17
- package/src/tests/trophies/trophiesTestData.ts +80 -0
- package/src/utils/consts.ts +18 -3
- package/src/utils/url.test.ts +32 -1
- package/src/utils/url.ts +24 -3
- package/src/components/Carousel/carousel.module.css +0 -43
- package/src/components/Carousel/carousel.module.css.map +0 -1
- package/src/components/Carousel/carousel.module.scss +0 -46
- package/src/components/Carousel/index.tsx +0 -66
- package/src/components/Dashboard/GoalCard.tsx +0 -71
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.carousel {
|
|
2
|
-
overflow: hidden;
|
|
3
|
-
margin: 2rem 0;
|
|
4
|
-
|
|
5
|
-
@media screen and (min-width: 700px) {
|
|
6
|
-
display: none;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.inner {
|
|
10
|
-
white-space: nowrap;
|
|
11
|
-
transition: transform 0.3s;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.carousel_item {
|
|
16
|
-
display: inline-flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
height: 200px;
|
|
20
|
-
background-color: rgb(119, 149, 189);
|
|
21
|
-
color: #fff;
|
|
22
|
-
border-radius: 10px;
|
|
23
|
-
|
|
24
|
-
img {
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.indicators {
|
|
30
|
-
display: flex;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.indicators > button {
|
|
35
|
-
margin: 5px;
|
|
36
|
-
border: none;
|
|
37
|
-
background-color: #2a4c7d;
|
|
38
|
-
color: #fff;
|
|
39
|
-
border-radius: 50%;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.indicators > button.active {
|
|
44
|
-
background-color: green;
|
|
45
|
-
color: #fff;
|
|
46
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import styles from './carousel.module.css';
|
|
3
|
-
|
|
4
|
-
export interface CarouselItemProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const CarouselItem = ({ children }: CarouselItemProps) => {
|
|
9
|
-
return (
|
|
10
|
-
<div className={styles.carousel_item}>
|
|
11
|
-
{children}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export interface CarouselProps {
|
|
17
|
-
children: React.ReactNode | React.ReactNode[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const Carousel: React.FC<CarouselProps> = ({ children }: CarouselProps) => {
|
|
21
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
22
|
-
|
|
23
|
-
const updateIndex = (newIndex: number) => {
|
|
24
|
-
if (newIndex < 0) {
|
|
25
|
-
newIndex = React.Children.count(children) - 1;
|
|
26
|
-
|
|
27
|
-
} else if (newIndex >= React.Children.count(children)) {
|
|
28
|
-
newIndex = 0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setActiveIndex(newIndex);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<div className={styles.carousel}>
|
|
40
|
-
<div
|
|
41
|
-
className={styles.inner}
|
|
42
|
-
style={{ transform: `translateX(-${activeIndex * 100}%)` }}
|
|
43
|
-
>
|
|
44
|
-
{React.Children.map(children, (child) => {
|
|
45
|
-
if (React.isValidElement(child)) {
|
|
46
|
-
return React.cloneElement(child);
|
|
47
|
-
}
|
|
48
|
-
})}
|
|
49
|
-
</div>
|
|
50
|
-
<div className={styles.indicators}>
|
|
51
|
-
{React.Children.map(children, (child, index) => {
|
|
52
|
-
return (
|
|
53
|
-
<button
|
|
54
|
-
className={`${index === activeIndex ? "active" : ""}`}
|
|
55
|
-
onClick={() => {
|
|
56
|
-
updateIndex(index);
|
|
57
|
-
}}
|
|
58
|
-
>
|
|
59
|
-
{index + 1}
|
|
60
|
-
</button>
|
|
61
|
-
);
|
|
62
|
-
})}
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import TrendingUpIcon from "@mui/icons-material/TrendingUp";
|
|
2
|
-
import { Button, IconButton, List, ListItem, ListItemText, Typography } from "@mui/material";
|
|
3
|
-
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
-
import { DashboardCard } from "components/Dashboard/DashboardCard";
|
|
5
|
-
import React from "react";
|
|
6
|
-
// import { useTranslation } from "react-i18next";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Example of a new widget using DashboardCard
|
|
10
|
-
*
|
|
11
|
-
* This demonstrates how simple it is to create a new dashboard widget.
|
|
12
|
-
* All the responsive layout logic is handled by DashboardCard!
|
|
13
|
-
*/
|
|
14
|
-
export const GoalsCard = () => {
|
|
15
|
-
// const { t } = useTranslation();
|
|
16
|
-
|
|
17
|
-
// Your data fetching logic here
|
|
18
|
-
const goals = [
|
|
19
|
-
{ id: 1, title: "Lose 5kg", progress: 60 },
|
|
20
|
-
{ id: 2, title: "Run 5km", progress: 80 },
|
|
21
|
-
{ id: 3, title: "Bench 100kg", progress: 45 },
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<DashboardCard
|
|
26
|
-
title="My Goals"
|
|
27
|
-
subheader="Track your fitness goals"
|
|
28
|
-
// Optional header action (top-right icon)
|
|
29
|
-
headerAction={
|
|
30
|
-
<Tooltip title="View trends">
|
|
31
|
-
<IconButton>
|
|
32
|
-
<TrendingUpIcon />
|
|
33
|
-
</IconButton>
|
|
34
|
-
</Tooltip>
|
|
35
|
-
}
|
|
36
|
-
// Actions at the bottom of the card
|
|
37
|
-
actions={
|
|
38
|
-
<>
|
|
39
|
-
<Button size="small">See All Goals</Button>
|
|
40
|
-
<Button size="small" variant="contained">
|
|
41
|
-
Add Goal
|
|
42
|
-
</Button>
|
|
43
|
-
</>
|
|
44
|
-
}
|
|
45
|
-
>
|
|
46
|
-
{/* Your card content goes here */}
|
|
47
|
-
<List>
|
|
48
|
-
{goals.map((goal) => (
|
|
49
|
-
<ListItem key={goal.id}>
|
|
50
|
-
<ListItemText
|
|
51
|
-
primary={goal.title}
|
|
52
|
-
secondary={
|
|
53
|
-
<Typography variant="body2" color="text.secondary">
|
|
54
|
-
Progress: {goal.progress}%
|
|
55
|
-
</Typography>
|
|
56
|
-
}
|
|
57
|
-
/>
|
|
58
|
-
</ListItem>
|
|
59
|
-
))}
|
|
60
|
-
</List>
|
|
61
|
-
</DashboardCard>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// To add this widget to the dashboard, just add it to AVAILABLE_WIDGETS in ConfigurableDashboard.tsx:
|
|
66
|
-
// {
|
|
67
|
-
// id: 'goals',
|
|
68
|
-
// type: 'goals',
|
|
69
|
-
// component: GoalsCard,
|
|
70
|
-
// defaultLayout: { w: 4, h: 6, x: 0, y: 6, minW: 3, minH: 4 },
|
|
71
|
-
// }
|