Skip to content

Commit

Permalink
✨ Add user feedback dialog
Browse files Browse the repository at this point in the history
Add a dialog using Sentry's user feedback widget.
  • Loading branch information
homostellaris committed Feb 13, 2024
1 parent 75c9000 commit d325e81
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/lib/Footer.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<script>
import {Button} from 'spaper'
</script>

<footer>
<div>
<Button id="feedback" type="primary">Leave feedback</Button>
</div>
<!-- TODO: Use something like `class:active={$page.path === '/about'}` to indicate which page we're currently on. -->
<span><a sveltekit:prefetch href="/">Schedule another social</a></span>
<span><a sveltekit:prefetch href="/help">Help</a></span>
Expand All @@ -10,6 +17,7 @@
footer {
display: flex;
justify-content: center;
align-items: center;
}
footer a {
Expand All @@ -23,7 +31,9 @@
}
}
div,
span {
margin: 0.5rem;
width: min-content;
}
</style>
34 changes: 30 additions & 4 deletions src/routes/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,37 @@

<script>
let plausible
setContext('analytics', {
getAnalytics: () => plausible,
getFeedback: () => feedback,
})
let background
$: background = $theme.background
onMount(() => {
const feedback = Sentry.feedbackIntegration({
autoInject: false,
colorScheme: 'dark',
buttonLabel: 'Leave feedback',
showName: false,
emailPlaceholder: 'May be used to follow up on your feedback',
submitButtonLabel: 'Submit feedback',
formTitle: 'Leave feedback',
messageLabel: 'Feedback',
messagePlaceholder:
"Bug reports, feature requests, or anything else you want to tell us; don't hold back.",
showBranding: false,
successMessageText: 'We appreciate it you taking the time to do that 🙏',
})
Sentry.init({
dsn: 'https://5b7a4ba6b3ff446ea520d3b5d7b854f2@o1232542.ingest.sentry.io/6380542',
integrations: [Sentry.browserTracingIntegration()],
integrations: [Sentry.browserTracingIntegration(), feedback],
tracesSampleRate: 1.0,
enabled: !dev,
})
feedback.attachTo(document.getElementById('feedback')) // This is in Footer
// TODO: Raise a PR to define exports properly so this works with Vite.
plausible = Plausible()
Expand Down Expand Up @@ -65,6 +82,14 @@
/* --main-background: var(--beer); */
}
:global(#sentry-feedback) {
--font-family: 'Port Lligat Slab', serif;
--top: auto;
--right: calc(50% - 160px);
--bottom: auto;
--left: calc(50% - 160px);
}
:global(h1, h2, h3, h4, h5, h6) {
font-family: 'Amatic SC', cursive;
}
Expand All @@ -73,8 +98,6 @@
html,
body,
button,
input,
div,
span,
applet,
object,
Expand Down Expand Up @@ -117,7 +140,6 @@
li,
fieldset,
form,
label,
legend,
table,
caption,
Expand Down Expand Up @@ -151,6 +173,10 @@
font-family: 'Amatic SC', cursive;
}
:global(label, input) {
font-family: 'Port Lligat Slab', serif;
}
:global(code) {
font-family: monospace;
}
Expand Down

0 comments on commit d325e81

Please sign in to comment.