Skip to content

Commit

Permalink
climbing: Fix saving crag & tags maxlength (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik authored Sep 22, 2024
1 parent 2ddaab8 commit f9dafcc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/FeaturePanel/Climbing/useGetHandleSave.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export const useGetHandleSave = (

const changes = getChanges(routes);
const comment = `${changes.length} routes`;
//const result = await editCrag(crag, comment, changes);
const result = await editCrag(crag, comment, changes);

console.log('All routes saved', changes); // eslint-disable-line no-console
console.log('All routes saved', changes, result); // eslint-disable-line no-console
showToast('Data saved successfully!', 'success');
setIsEditMode(false);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const NewTagRow = ({ setTag, setTmpNewTag }) => {
variant="outlined"
size="small"
placeholder={t('editdialog.other_tags.new_key')}
inputProps={{ autocapitalize: 'none' }}
inputProps={{ autocapitalize: 'none', maxLength: 255 }}
/>
</th>
<td>
Expand All @@ -105,7 +105,7 @@ const NewTagRow = ({ setTag, setTmpNewTag }) => {
fullWidth
variant="outlined"
size="small"
inputProps={{ autocapitalize: 'none' }}
inputProps={{ autocapitalize: 'none', maxLength: 255 }}
/>
</td>
</tr>
Expand Down Expand Up @@ -137,7 +137,7 @@ const KeyValueRow = ({ k, v, setTag, focusTag }) => (
fullWidth
variant="outlined"
size="small"
inputProps={{ autocapitalize: 'none' }}
inputProps={{ autocapitalize: 'none', maxLength: 255 }}
autoFocus={focusTag === k}
placeholder={t('editdialog.other_tags.will_be_deleted')}
/>
Expand Down
20 changes: 16 additions & 4 deletions src/components/FeaturePanel/MemberFeatures/ClimbingItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useFeatureContext } from '../../utils/FeatureContext';
import { getOsmappLink, getShortId } from '../../../services/helpers';
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
import { intl, t } from '../../../services/intl';
import { IconButton, Menu, MenuItem } from '@mui/material';
import { IconButton, Menu, MenuItem, Stack } from '@mui/material';
import Router from 'next/router';
import { useMobileMode } from '../../helpers';
import { useSnackbar } from '../../utils/SnackbarContext';
Expand All @@ -29,6 +29,11 @@ const RouteName = styled.div<{ opacity: number }>`
flex: 1;
opacity: ${({ opacity }) => opacity};
`;
const RouteDescription = styled.div<{ opacity: number }>`
font-size: 10px;
opacity: ${({ opacity }) => opacity};
color: ${({ theme }) => theme.palette.text.secondary};
`;

const RouteGrade = styled.div``;

Expand Down Expand Up @@ -143,9 +148,16 @@ export const ClimbingItem = ({
{routeNumber}
</RouteNumber>
</RoutePhoto>
<RouteName opacity={photoPathsCount === 0 ? 0.5 : 1}>
{feature.tags?.name}
</RouteName>
<Stack justifyContent="stretch" flex={1}>
<RouteName opacity={photoPathsCount === 0 ? 0.5 : 1}>
{feature.tags?.name}
</RouteName>
{feature.tags?.description && (
<RouteDescription opacity={photoPathsCount === 0 ? 0.5 : 1}>
{feature.tags?.description}
</RouteDescription>
)}
</Stack>
<RouteGrade>
<ConvertedRouteDifficultyBadge routeDifficulties={routeDifficulties} />
</RouteGrade>
Expand Down

0 comments on commit f9dafcc

Please sign in to comment.