Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 47 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"missingExercise": "Missing a certain exercise?",
"missingExerciseDescription": "Help out the community by contributing it!",
"searchExerciseName": "Search by exercise name",
"exactMatch": "Exact match",
"newNote": "New note",
"notesHelpText": "Notes are short comments on how to perform the exercise such as \"keep your body straight\"",
"imageStylePhoto": "Photo",
Expand Down
5 changes: 5 additions & 0 deletions src/components/Core/Widgets/SearchLanguageFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Language filter options for search components.
* Used by both ingredient and exercise search.
*/
export type SearchLanguageFilter = "current" | "current_english" | "all";
19 changes: 11 additions & 8 deletions src/components/Exercises/Detail/Head/ExerciseDeleteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ export function ExerciseDeleteDialog(props: {
setReplacementId(event.target.value !== '' ? parseInt(event.target.value) : null);
}}
value={replacementId ?? ""}
InputProps={{
endAdornment:
<InputAdornment position="start">
<IconButton onClick={() => loadCurrentReplacement()}>
<CachedIcon />
</IconButton>
</InputAdornment>
}}
slotProps={{
input: {
endAdornment:
<InputAdornment position="start">
<IconButton onClick={() => loadCurrentReplacement()}>
<CachedIcon />
</IconButton>
</InputAdornment>
}
}
}
fullWidth={true}
variant="standard"
/>
Expand Down
28 changes: 23 additions & 5 deletions src/components/Exercises/ExerciseOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AddIcon from '@mui/icons-material/Add';
import { Box, Button, Container, Pagination, Stack, Typography, useMediaQuery } from "@mui/material";
import FilterListIcon from '@mui/icons-material/FilterList';
import { Box, Button, Container, Pagination, Stack, Typography, useMediaQuery, IconButton } from "@mui/material";
import Grid from '@mui/material/Grid';
import { CategoryFilter, CategoryFilterDropdown } from "components/Exercises/Filter/CategoryFilter";
import { EquipmentFilter, EquipmentFilterDropdown } from "components/Exercises/Filter/EquipmentFilter";
Expand Down Expand Up @@ -80,6 +81,9 @@ export const ExerciseOverviewList = () => {
const isMobile = useMediaQuery('(max-width:600px)');

const [page, setPage] = React.useState(1);
const [showFilters, setShowFilters] = useState<boolean>(() => {
return localStorage.getItem("wger.exerciseSearch.showFilters") !== "false";
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handlePageChange = (event: any, value: number) => {
setPage(value);
Expand Down Expand Up @@ -194,9 +198,23 @@ export const ExerciseOverviewList = () => {
<Grid
size={{
xs: 12,
sm: 3
sm: showFilters ? 3 : 6
}}>
<NameAutocompleter callback={exerciseAdded} />
<Stack direction="row" alignItems="center" spacing={1} sx={{ width: '100%' }}>
<Box sx={{ flexGrow: 1 }}>
<NameAutocompleter callback={exerciseAdded} />
</Box>
<IconButton
onClick={() => {
const newValue = !showFilters;
setShowFilters(newValue);
localStorage.setItem("wger.exerciseSearch.showFilters", String(newValue));
}}
title="Toggle filters"
>
<FilterListIcon />
</IconButton>
</Stack>
</Grid>
<Grid
size={{
Expand All @@ -214,7 +232,7 @@ export const ExerciseOverviewList = () => {
</>
)}

{!isMobile && (
{!isMobile && showFilters && (
<Grid
size={{
xs: 12,
Expand Down Expand Up @@ -247,7 +265,7 @@ export const ExerciseOverviewList = () => {
<Grid
size={{
xs: 12,
sm: 9
sm: showFilters ? 9 : 12
}}>
{exerciseQuery.isLoading
? <ExerciseGridSkeleton />
Expand Down
Loading
Loading