-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature/thanks page picture #121
Conversation
- Background images can now be fetched with url of type api/file/background-images/ - Thanks page images can now be fetched with url of type api/file/thanks-page-images/
|
||
useEffect(() => { | ||
async function getThanksPageImage() { | ||
const res = await fetch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Should this fetch actually only be used for fetching the headers? I believe you can fetch headers only with { method: 'HEAD' }
.
The survey.thanksPage.imagePath
could be used directly in the <img>
tag's src
attribute. Writing a megabytes long blob data into a data URL and rendering it after first downloading the image would probably be quite a slow task, especially on mobile devices
} | ||
|
||
function getActiveImage() { | ||
const activeImage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
variables shouldn't be re-assignable, I wonder why there are no errors here... 🤔 However, you can also return directly the results of images?.find(...) ?? null
in both cases, no need for a variable for this.
Add possibility to include a user defined image to thank you page. Uses SurveyImageList component which is also used for background image.
The backend offers an api endpoint with format api/file/<image_type>/<file_name>. All available images of certain type can be fetched using api/file/<image_type>.
Thank you page images are saved to the database to table data.files. Filepath column in the database is used to define the type of the image (background-images or thanks-page-images).
Closes #105