-
Notifications
You must be signed in to change notification settings - Fork 180
SELF-253 feat: add user email feedback #889
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
Merged
Merged
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
966802c
feat: add sentry feedback
seshanthS 5f358f5
add sentry feedback to web
seshanthS c2cf52c
feat: add custom feedback modal & fix freeze on IOS
seshanthS cd044a7
Merge branch 'dev' into feat/sentry-feedback
transphorm d5b7027
yarn nice
transphorm a57e3f7
update lock
transphorm f07a661
feat: show feedback widget on NFC scan issues (#948)
transphorm e53785b
Merge branch 'feat/sentry-feedback' of github.com:selfxyz/self into f…
transphorm 6d75d3c
clean up
transphorm 4c5815a
fix report issue screen
transphorm f06eadf
abstract send user feedback email logic
transphorm 4131431
fixes
transphorm a6bb189
change text to Report Issue
transphorm e756faa
sanitize email and track event messge
transphorm 3749091
remove unnecessary sanitization
transphorm 80f4baa
add sanitize error message tests
transphorm ffd1773
Merge branch 'dev' into feat/sentry-feedback
transphorm 76a4ffb
fix tests
transphorm 548d271
save wip. almost done
transphorm fa68a55
fix screen test
transphorm 1f0a087
fix screen test
transphorm c4b883b
remove non working test
transphorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,225 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1; Copyright (c) 2025 Social Connect Labs, Inc.; Licensed under BUSL-1.1 (see LICENSE); Apache-2.0 from 2029-06-11 | ||
|
|
||
| import React, { useState } from 'react'; | ||
| import { Alert, Modal, StyleSheet, Text, TextInput, View } from 'react-native'; | ||
| import { Button, XStack, YStack } from 'tamagui'; | ||
|
|
||
| import { Caption } from '@/components/typography/Caption'; | ||
| import { black, slate400, white, zinc800, zinc900 } from '@/utils/colors'; | ||
| import { advercase, dinot } from '@/utils/fonts'; | ||
|
|
||
| interface FeedbackModalProps { | ||
| visible: boolean; | ||
| onClose: () => void; | ||
| onSubmit: ( | ||
| feedback: string, | ||
| category: string, | ||
| name?: string, | ||
| email?: string, | ||
| ) => void; | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const FeedbackModal: React.FC<FeedbackModalProps> = ({ | ||
| visible, | ||
| onClose, | ||
| onSubmit, | ||
| }) => { | ||
| const [feedback, setFeedback] = useState(''); | ||
| const [category, setCategory] = useState('general'); | ||
| const [name, setName] = useState(''); | ||
| const [email, setEmail] = useState(''); | ||
| const [isSubmitting, setIsSubmitting] = useState(false); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const categories = [ | ||
| { value: 'general', label: 'General Feedback' }, | ||
| { value: 'bug', label: 'Bug Report' }, | ||
| { value: 'feature', label: 'Feature Request' }, | ||
| { value: 'ui', label: 'UI/UX Issue' }, | ||
| ]; | ||
|
|
||
| const handleSubmit = async () => { | ||
| if (!feedback.trim()) { | ||
| Alert.alert('Error', 'Please enter your feedback'); | ||
| return; | ||
| } | ||
|
|
||
| setIsSubmitting(true); | ||
| try { | ||
| await onSubmit( | ||
| feedback.trim(), | ||
| category, | ||
| name.trim() || undefined, | ||
| email.trim() || undefined, | ||
| ); | ||
| setFeedback(''); | ||
| setCategory('general'); | ||
| setName(''); | ||
| setEmail(''); | ||
| onClose(); | ||
| Alert.alert('Success', 'Thank you for your feedback!'); | ||
| } catch (error) { | ||
| console.error('Error submitting feedback:', error); | ||
| Alert.alert('Error', 'Failed to submit feedback. Please try again.'); | ||
| } finally { | ||
| setIsSubmitting(false); | ||
| } | ||
| }; | ||
|
|
||
| const handleClose = () => { | ||
| if (feedback.trim() || name.trim() || email.trim()) { | ||
| Alert.alert( | ||
| 'Discard Feedback?', | ||
| 'You have unsaved feedback. Are you sure you want to close?', | ||
| [ | ||
| { text: 'Cancel', style: 'cancel' }, | ||
| { text: 'Discard', style: 'destructive', onPress: onClose }, | ||
| ], | ||
| ); | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } else { | ||
| onClose(); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal | ||
| visible={visible} | ||
| animationType="slide" | ||
| transparent={true} | ||
| onRequestClose={handleClose} | ||
| > | ||
| <View style={styles.overlay}> | ||
| <View style={styles.modalContainer}> | ||
| <YStack gap="$4" padding="$4"> | ||
| <XStack justifyContent="space-between" alignItems="center"> | ||
| <Text style={styles.title}>Send Feedback</Text> | ||
| <Button | ||
| size="$2" | ||
| variant="outlined" | ||
| onPress={handleClose} | ||
| disabled={isSubmitting} | ||
| > | ||
| ✕ | ||
| </Button> | ||
| </XStack> | ||
|
|
||
| <YStack gap="$2"> | ||
| <Caption style={styles.label}>Category</Caption> | ||
| <XStack gap="$2" flexWrap="wrap"> | ||
| {categories.map(cat => ( | ||
| <Button | ||
| key={cat.value} | ||
| size="$2" | ||
| backgroundColor={ | ||
| category === cat.value ? white : 'transparent' | ||
| } | ||
| color={category === cat.value ? black : white} | ||
| borderColor={white} | ||
| onPress={() => setCategory(cat.value)} | ||
| disabled={isSubmitting} | ||
| > | ||
| {cat.label} | ||
| </Button> | ||
| ))} | ||
| </XStack> | ||
| </YStack> | ||
|
|
||
| <YStack gap="$2"> | ||
| <Caption style={styles.label}> | ||
| Contact Information (Optional) | ||
| </Caption> | ||
| <XStack gap="$2"> | ||
| <TextInput | ||
| style={[styles.textInput, { flex: 1, minHeight: 48 }]} | ||
| placeholder="Name" | ||
| placeholderTextColor={slate400} | ||
| value={name} | ||
| onChangeText={setName} | ||
| editable={!isSubmitting} | ||
| /> | ||
| <TextInput | ||
| style={[styles.textInput, { flex: 1, minHeight: 48 }]} | ||
| placeholder="Email" | ||
| placeholderTextColor={slate400} | ||
| value={email} | ||
| onChangeText={setEmail} | ||
| keyboardType="email-address" | ||
| autoCapitalize="none" | ||
| editable={!isSubmitting} | ||
| /> | ||
| </XStack> | ||
| </YStack> | ||
|
|
||
| <YStack gap="$2"> | ||
| <Caption style={styles.label}>Your Feedback</Caption> | ||
| <TextInput | ||
| style={styles.textInput} | ||
| placeholder="Tell us what you think, report a bug, or suggest a feature..." | ||
| placeholderTextColor={slate400} | ||
| value={feedback} | ||
| onChangeText={setFeedback} | ||
| multiline | ||
| numberOfLines={6} | ||
| textAlignVertical="top" | ||
| editable={!isSubmitting} | ||
| /> | ||
| </YStack> | ||
|
|
||
| <Button | ||
| size="$4" | ||
| backgroundColor={white} | ||
| color={black} | ||
| onPress={handleSubmit} | ||
| disabled={isSubmitting || !feedback.trim()} | ||
| > | ||
| {isSubmitting ? 'Submitting...' : 'Submit Feedback'} | ||
| </Button> | ||
| </YStack> | ||
| </View> | ||
| </View> | ||
| </Modal> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| overlay: { | ||
| flex: 1, | ||
| backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| padding: 20, | ||
| }, | ||
| modalContainer: { | ||
| backgroundColor: zinc900, | ||
| borderRadius: 16, | ||
| width: '100%', | ||
| maxWidth: 400, | ||
| maxHeight: '80%', | ||
| borderWidth: 1, | ||
| borderColor: zinc800, | ||
| }, | ||
| title: { | ||
| fontFamily: advercase, | ||
| fontSize: 24, | ||
| fontWeight: '600', | ||
| color: white, | ||
| }, | ||
| label: { | ||
| fontFamily: dinot, | ||
| color: white, | ||
| fontSize: 14, | ||
| fontWeight: '500', | ||
| }, | ||
| textInput: { | ||
| backgroundColor: black, | ||
| borderWidth: 1, | ||
| borderColor: zinc800, | ||
| borderRadius: 8, | ||
| padding: 12, | ||
| color: white, | ||
| fontSize: 16, | ||
| fontFamily: dinot, | ||
| minHeight: 120, | ||
| }, | ||
| }); | ||
|
|
||
| export default FeedbackModal; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.