Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to table view in accommodation #39

Merged
merged 2 commits into from
Feb 8, 2023
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
91 changes: 46 additions & 45 deletions fe/src/components/data/CityAccommodation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { Box, Paper } from '@mui/material';
import {
Box,
Paper,
Table,
TableContainer,
TableHead,
TableRow,
TableCell,
TableBody,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import { CityAccommodationNode } from '../../interfaces/TreeNode';

Expand All @@ -19,50 +28,42 @@ export default function CityAccommodation({
<b>{t('data.city_accommodation.subtitle')}</b>
</p>
{/* // TO-DO: https://react.i18next.com/latest/trans-component */}
{value.items.map((item, i) => (
<Paper sx={{ p: 2, m: 2 }} key={`item-${i}`}>
<b>{item.name}</b> {t('data.city_accommodation.explanation')}
{item.url && (
<>
{t('data.city_accommodation.link_explanation_p1')}{' '}
<a href={item.url} target='_blank' rel='noreferrer'>
{t('data.city_accommodation.link_explanation_p2')}.
</a>{' '}

<br />
</>
)}
<br />
{item.address && (
<p>
<a href={item.address} target='_blank' rel='noreferrer'>
{t('map')}
</a>
<br />
</p>
)}
{item.phone_number && (
<p>
{t('data.phone_number.link_explanation_p1')}{' '}
<b>
<a
href={`tel:+90${item.phone_number
.replace(/^0/, '')
.replace(/ /g, '')}`}
>
{item.phone_number}
</a>
</b>
{t('data.phone_number.link_explanation_p2')}{' '}
</p>
)}
{!item.is_validated && (
<p>
<b>{t('data.city_accommodation.not_validated')}</b>
</p>
)}
</Paper>
))}
<TableContainer component={Paper} >
<Table >
<TableHead>
<TableRow>
<TableCell>{t('location')}</TableCell>
<TableCell>{t('map')}</TableCell>
<TableCell>{t('details')}</TableCell>
</TableRow>
</TableHead>
<TableBody>
{value.items.map((item, i) => (
<TableRow
key={i}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
>
<TableCell component='th' scope='row'>
{item.name}
</TableCell>
<TableCell>
<a href={item.address}>{t('location')}</a>
</TableCell>
<TableCell>
<>
{t('data.city_accommodation.link_explanation_p1')}{' '}
<a href={item.url} target='_blank' rel='noreferrer'>
{t('data.city_accommodation.link_explanation_p2')}.
</a>{' '}

<br />
</>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</Box>
);
}
3 changes: 2 additions & 1 deletion fe/src/utils/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
"city": "City",
"district": "District",
"region": "Region",
"location": "Location"
"location": "Location",
"details": "Details"
}
3 changes: 2 additions & 1 deletion fe/src/utils/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
"city": "City",
"district": "District",
"region": "Region",
"location": "Location"
"location": "Location",
"details": "Details"
}
3 changes: 2 additions & 1 deletion fe/src/utils/locales/ku/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
"city": "City",
"district": "District",
"region": "Region",
"location": "Location"
"location": "Location",
"details": "Details"
}
3 changes: 2 additions & 1 deletion fe/src/utils/locales/tr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
"city": "Şehir",
"district": "İlçe",
"region": "Bölge",
"location": "Konum"
"location": "Konum",
"details": "Detaylar"
}