Use Svelte snapshots for Contact page & improvements #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR slightly improves the UX on the Contact page, here's how:
Svelte snapshots
The page now uses the really simple Snapshot API in order to save the form's content whenever the user leaves the page after having filled the form. This way, if they mistakenly leave the page but come back to it right after, the form is still filled with their info.
Warning
This saving occurs when the user comes back to the contact page by using the
Previous
arrow of their browser, not when navigating to the contact page normally!Other improvements
Use the
load
function instead of a hardcoded objectThe contact info of Reuben is now loaded from the page's
+page.ts
instead of simply being an object lying in+page.svelte
. This is mainly for aesthetic purposes as this info will likely never change, but it also allows for decluttering the<script>
tag, which is always a good thing in my opinion.Improve mail-sending workflow
A few tweaks have been made to the mail-sending workflow when submitting the form:
node
➜form
)Send
button not resetting to its default state after an error occurred