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

Adding Campaign Page Chips to Sections #1524

Closed
Closed
Show file tree
Hide file tree
Changes from 2 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
10 changes: 9 additions & 1 deletion public/locales/bg/campaigns.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,15 @@
"end-date": "Крайна дата:",
"indefinite": "Безсрочна",
"tag": "Таг:",
"date": "Дата:"
"date": "Дата:",
"chipsLabels": {
"news": "Новини",
"docs": "Документи",
"experts": "Експертен съвет",
"guarantor": "Гарант",
"signals": "Сигнали",
"others": "Други"
}
},
"info-graphics": {
"donation-title": "100% от дарението отива при нуждаещите се",
Expand Down
10 changes: 9 additions & 1 deletion public/locales/en/campaigns.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@
"start-date": "Start date:",
"end-date": "End date:",
"tag": "Tag:",
"date": "Date:"
"date": "Date:",
"chipsLabels": {
"news": "News",
"docs": "Documents",
"experts": "Experts",
"guarantor": "Guarantor",
"signals": "Signals",
"others": "Others"
}
},
"info-graphics": {
"donation-title": "100% of the donation goes to those in need",
Expand Down
22 changes: 22 additions & 0 deletions src/components/client/campaigns/CampaignDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { routes } from 'common/routes'
import { useCanEditCampaign } from 'common/hooks/campaigns'
import { moneyPublic } from 'common/util/money'
import ReceiptLongIcon from '@mui/icons-material/ReceiptLong'
import CampaignDetailsChip from './CampaignDetailsChip'

const ReactQuill = dynamic(() => import('react-quill'), { ssr: false })
const CampaignNewsSection = dynamic(() => import('./CampaignNewsSection'), { ssr: false })
Expand Down Expand Up @@ -102,6 +103,22 @@ export default function CampaignDetails({ campaign }: Props) {
const { data: expensesList } = useCampaignApprovedExpensesList(campaign.slug)
const totalExpenses = expensesList?.reduce((acc, expense) => acc + expense.amount, 0)

const chipsLabel = {
news: t('campaigns:campaign.chipsLabels.news'),
docs: t('campaigns:campaign.chipsLabels.docs'),
experts: t('campaigns:campaign.chipsLabels.experts'),
guarantor: t('campaigns:campaign.chipsLabels.guarantor'),
signals: t('campaigns:campaign.chipsLabels.signals'),
others: t('campaigns:campaign.chipsLabels.others'),
}

const scrollToSection = (sectionId: string) => {
const target = document.getElementById(sectionId)
if (target) {
target.scrollIntoView({ behavior: 'smooth' })
}
}

return (
<StyledGrid item xs={12} md={8}>
<Typography variant="h1" component="h1" mb={8} className={classes.campaignTitle}>
Expand All @@ -121,6 +138,11 @@ export default function CampaignDetails({ campaign }: Props) {
<Grid item xs={12}>
<Divider />
</Grid>
<Grid container item xs={12}>
{Object.entries(chipsLabel).map(([id, label]) => (
<CampaignDetailsChip key={id} chip={label} onClick={() => scrollToSection(id)} />
))}
</Grid>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just let's move them directly below the title and also let's use color=primary ot make the main blue color of the site

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I contact the ui/ux college to clarify translations and design(colors etc..)

Copy link
Contributor Author

@dzhaniivanov dzhaniivanov Aug 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-08-05 182515
Screenshot 2023-08-05 182453
i think is a good starting point(with some bugs for fixing)
@swolf86

<Grid item xs={12}>
<CampaignInfoOperator campaign={campaign} />
</Grid>
Expand Down
11 changes: 11 additions & 0 deletions src/components/client/campaigns/CampaignDetailsChip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Chip } from '@mui/material'

interface CampaingDetailsChipProps {
chip: string
onClick: () => void
}

const CampaignDetailsChip: React.FC<CampaingDetailsChipProps> = ({ chip, onClick }) => {
return <Chip label={chip} sx={{ marginX: '2px' }} onClick={onClick} />
}
export default CampaignDetailsChip
2 changes: 1 addition & 1 deletion src/components/client/campaigns/CampaignNewsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function CampaignNewsSection({ campaign, canCreateArticle }: Prop
const [isExpanded, expandContent] = useShowMoreContent()

return (
<Grid container item xs={12} spacing={1}>
<Grid container item xs={12} spacing={1} id="news">
<Grid container item flexDirection={'column'}>
<Typography component={'h3'} fontSize={25} color="#000000">
{t('news')}
Expand Down