Skip to content

Commit

Permalink
Merge pull request #282 from chain4travel/business-fixes
Browse files Browse the repository at this point in the history
fix: enhance partner details display and add pagination to business base URL
  • Loading branch information
Ysrbolles authored Dec 13, 2024
2 parents 26ab2de + a63922b commit a6e5eb8
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 79 deletions.
6 changes: 3 additions & 3 deletions src/redux/services/partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ const getBaseUrl = () => {
const getBusinessBaseUrl = () => {
const currentPath = typeof window !== 'undefined' ? window.location.hostname : ''
if (currentPath === 'localhost' || currentPath.includes('dev')) {
return BUSINESS_BASE_URLS.dev
return BUSINESS_BASE_URLS.dev + '?pagination[pageSize]=1000'
} else if (currentPath) {
return BUSINESS_BASE_URLS.prod
return BUSINESS_BASE_URLS.prod + '?pagination[pageSize]=1000'
} else {
return BUSINESS_BASE_URLS.prod
return BUSINESS_BASE_URLS.prod + '?pagination[pageSize]=1000'
}
}

Expand Down
171 changes: 95 additions & 76 deletions src/views/partners/Partner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,14 @@ const Partner = () => {
isPartnerView={true}
/>
</Box>
<Box sx={{ paddingBottom: '1.5rem' }}>
<Typography variant="subtitle1">Description</Typography>
<Typography variant="body2">
{partner.attributes.companyLongDescription}
</Typography>
</Box>
{partner.attributes.companyLongDescription && (
<Box sx={{ paddingBottom: '1.5rem' }}>
<Typography variant="subtitle1">Description</Typography>
<Typography variant="body2" sx={{ marginTop: '.5rem' }}>
{partner.attributes.companyLongDescription}
</Typography>
</Box>
)}
</Box>
<Box
sx={{
Expand Down Expand Up @@ -712,37 +714,22 @@ const Partner = () => {
/>
</Box>
<Divider />
<ContentField label="company country">
{partner.attributes.country_flag &&
partner.attributes.country_flag.data?.attributes && (
<PartnerFlag
country={partner.attributes.country_flag.data.attributes}
/>
)}
</ContentField>
<Divider />
<ContentField label="Direct Contact">
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
>
{partner.attributes.contactFirstname +
' ' +
partner.attributes.contactLastname}
</Typography>
</ContentField>
{partner.attributes.country_flag.data.attributes && (
<ContentField label="company country">
{partner.attributes.country_flag &&
partner.attributes.country_flag.data?.attributes && (
<PartnerFlag
country={
partner.attributes.country_flag.data.attributes
}
/>
)}
</ContentField>
)}
<Divider />
<ContentField label="Contact Email">
<Link
rel="noopener noreferrer"
style={{ textDecoration: 'none' }}
to={'mailto:' + partner.attributes.contactEmail}
>
{(partner?.attributes?.contactFirstname ||
partner?.attributes?.contactLastname) && (
<ContentField label="Direct Contact">
<Typography
sx={{
color: theme => theme.palette.card.text,
Expand All @@ -752,51 +739,83 @@ const Partner = () => {
lineHeight: '150%',
}}
>
{partner.attributes.contactEmail}
{[
partner?.attributes?.contactFirstname,
partner?.attributes?.contactLastname,
]
.filter(Boolean)
.join(' ')}
</Typography>
</Link>
</ContentField>
</ContentField>
)}

<Divider />
<ContentField label="Contact Phone">
<Link
rel="noopener noreferrer"
style={{ textDecoration: 'none' }}
to={'tel:' + partner.attributes.contactPhone}
>
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
{partner.attributes.contactEmail && (
<ContentField label="Contact Email">
<Link
rel="noopener noreferrer"
style={{ textDecoration: 'none' }}
to={'mailto:' + partner.attributes.contactEmail}
>
{partner.attributes.contactPhone}
</Typography>
</Link>
</ContentField>
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
>
{partner.attributes.contactEmail}
</Typography>
</Link>
</ContentField>
)}
<Divider />
<ContentField label="Website">
<Link
rel="noopener noreferrer"
target="_blank"
style={{ textDecoration: 'none' }}
to={partner.attributes.companyWebsite}
>
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
{partner.attributes.contactPhone && (
<ContentField label="Contact Phone">
<Link
rel="noopener noreferrer"
style={{ textDecoration: 'none' }}
to={'tel:' + partner.attributes.contactPhone}
>
{partner.attributes.companyWebsite}
</Typography>
</Link>
</ContentField>
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
>
{partner.attributes.contactPhone}
</Typography>
</Link>
</ContentField>
)}
<Divider />
{partner.attributes.companyWebsite && (
<ContentField label="Website">
<Link
rel="noopener noreferrer"
target="_blank"
style={{ textDecoration: 'none' }}
to={partner.attributes.companyWebsite}
>
<Typography
sx={{
color: theme => theme.palette.card.text,
fontSize: '16px',
fontStyle: 'normal',
fontWeight: 400,
lineHeight: '150%',
}}
>
{partner.attributes.companyWebsite}
</Typography>
</Link>
</ContentField>
)}
</Box>
</Box>
</Box>
Expand Down

0 comments on commit a6e5eb8

Please sign in to comment.