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

feat: generate pdf for activity #972

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aqsaaqeel
Copy link
Contributor

@aqsaaqeel aqsaaqeel commented Oct 26, 2023

Summary

New design for pdf that is generated for the activities. Implemented this figma design

Closes #899

Task List

  • Implement the new design for pdf template
  • Generate it on click
  • Add a QR for activity
  • Add the footer on all pages in the generated pdf

Screenshots

Everything looks good, but I am not able to add a footer on all the pages. Currently it only appears at the end of all the content.

Screenshot from 2023-10-26 20-23-20
Screenshot from 2023-10-26 20-23-15

Blockers

I am unable to add the footer to all the pages in the pdf. The library html2pdf that we are using does not support the addition of footer explicitly. So I am trying to find a workaround for it.

@NdibeRaymond
Copy link
Collaborator

@aqsaaqeel have you found a solution? where do you need help with this?

Copy link
Collaborator

@NdibeRaymond NdibeRaymond left a comment

Choose a reason for hiding this comment

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

left comments on the things that we'd need to change. Nice work @aqsaaqeel

</Container>

<Typography style={{ color: 'white' }} className={`${classes.pdfSubtitle} ${classes.customTypographyStyle}`}>
Scan code to view activity
Copy link
Collaborator

Choose a reason for hiding this comment

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

this needs translation

<QRCode value={`https://example.com/activity/${activity.id}`} />
</Container>

<Typography style={{ color: 'white' }} className={`${classes.pdfSubtitle} ${classes.customTypographyStyle}`}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

move to style file

style={{ margin: 'auto', width: '12rem' }}
className={`${classes.pdfSubtitle}`}
>
SHARE THIS ACTIVITY
Copy link
Collaborator

Choose a reason for hiding this comment

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

translation

<Container>
<Container className={classes.flexStyle}>
<Typography
style={{ margin: 'auto', width: '12rem' }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

move to style file

</Container>
<Container className={classes.footerStyle}>
<Container>
<img className={classes.pdfFooterLogoStyle} src={images.unstructured} alt={'Faridah_ux'} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

the alt text is hardcoded. Is that supposed to be (asking a genuine question here because I have no idea)?
Is it is supposed to be hardcoded then we need to translate it on the frontend

<img
key={index}
src={img.image?.file_url}
alt={`Image ${index}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this alt text is not really helpful to anyone who doesn't speak english. we should translate this. Also maybe improve the alt text? image 0 is not exactly a very descriptive alt

</Container>
</Container>
<Box className={classes.verticalSpace}></Box>
<Typography className={`${classes.pdfSubtitle}`}>Introduction</Typography>
Copy link
Collaborator

Choose a reason for hiding this comment

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

again translation

<Container className={classes.justifyPdf}>
<Typography className={classes.pdfTitle}>{activity?.title}</Typography>
<Container className={`${classes.creatorProfilePdfStyle}`}>
<Avatar className={classes.creatorAvatarStyle} src={creator?.avatar} alt={'Faridah_ux'} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

not a very descriptive alt and needs translation

const commonClasses = makeStyles(styles)();
return (
<>
<Container style={{ backgroundColor: 'white', border: 'solid 1.5rem white'}} className={classes.pdfStyle}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

move to style file

import { Container, Typography, Box, makeStyles, Avatar } from '@material-ui/core';
import styles from '../../assets/js/styles/index';
import { activityDefailsStyles } from './ActivityDetails.styles';
// import activity from '../../components/activity/activity';
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove line

@aqsaaqeel
Copy link
Contributor Author

@NdibeRaymond working on the requested changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design a PDF template for activity
2 participants