-
Notifications
You must be signed in to change notification settings - Fork 80
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
chore(points): use points config from redux rather than Statsig #5232
Merged
Merged
Changes from 23 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
830368f
Add initial points activity feed
jophish 618bdac
Remove unrelated change
jophish 268cb57
Remove bottom sheet for now
jophish a4397f9
Merge branch 'main' into jophish/ret-1032
jophish 3072fb2
Undo more stuff
jophish 4ead19e
Schema
jophish fe8a966
Schema
jophish 72cda37
Schema
jophish ee99ca0
knip
jophish d8e914a
Update saga
jophish 3bb8395
Merge branch 'main' into jophish/ret-1032
jophish 352f3b8
Fix imports
jophish e51b8b0
Schema
jophish 353ccee
Fix test
jophish 0a8841e
Merge branch 'main' into jophish/ret-1032
kathaypacific 5a78c55
feat(points): fetch points config from getPointsConfig function
kathaypacific e5bf384
chore: redux migrations
kathaypacific c228077
chore: revert unrelated changes
kathaypacific c6223ae
chore: remove success state
kathaypacific 0eb08b6
fix: root schema
kathaypacific 7307c5a
chore: remove unused selector
kathaypacific 9cc30bf
chore: rename selector
kathaypacific f087f03
chore(points): use points config from redux rather than Statsig
kathaypacific 6f9e498
Merge branch 'main' into kathy/points-config-redux
kathaypacific 0e26248
fix: bad merge
kathaypacific fbbe8e2
Merge branch 'kathy/points-config-redux' into kathy/points-config-switch
kathaypacific 02f434a
fix: first dispatch
kathaypacific 80a177b
Merge branch 'kathy/points-config-redux' into kathy/points-config-switch
kathaypacific 5ac7dc6
fix: redundant action
kathaypacific a58d881
Merge branch 'kathy/points-config-redux' into kathy/points-config-switch
kathaypacific 4f026a4
chore: revert unnecessary changes
kathaypacific 04f4438
chore: rename points to pointsAmount in redux
kathaypacific 95b1cf0
chore: remove null type
kathaypacific d5139ed
chore: remove error scenario
kathaypacific b89ed4c
chore: add back success state
kathaypacific ae8bdda
fix: test
kathaypacific 52b7652
chore: clean up
kathaypacific 028a34c
Merge branch 'main' into kathy/points-config-redux
kathaypacific 269b177
Merge branch 'kathy/points-config-redux' into kathy/points-config-switch
kathaypacific a70b914
chore: improve naming
kathaypacific 90812f1
fix: test
kathaypacific 215833f
fix: lint
kathaypacific 6254384
Merge branch 'main' into kathy/points-config-switch
kathaypacific File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,31 +1,38 @@ | ||
import { NativeStackScreenProps } from '@react-navigation/native-stack' | ||
import { StackParamList } from 'src/navigator/types' | ||
import BackButton from 'src/components/BackButton' | ||
import React, { useEffect, useState, useRef } from 'react' | ||
import React, { useEffect, useRef, useState } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { ScrollView, StyleSheet, Text, View } from 'react-native' | ||
import { Screens } from 'src/navigator/Screens' | ||
import { typeScale } from 'src/styles/fonts' | ||
import { Spacing } from 'src/styles/styles' | ||
import { Colors } from 'src/styles/colors' | ||
import { SafeAreaView } from 'react-native-safe-area-context' | ||
import ActivityCardSection from 'src/points/ActivityCardSection' | ||
import { PointsEvents } from 'src/analytics/Events' | ||
import ValoraAnalytics from 'src/analytics/ValoraAnalytics' | ||
import BackButton from 'src/components/BackButton' | ||
import BottomSheet, { BottomSheetRefType } from 'src/components/BottomSheet' | ||
import Button, { BtnSizes, BtnTypes } from 'src/components/Button' | ||
import { BottomSheetParams, PointsActivity } from 'src/points/types' | ||
import ValoraAnalytics from 'src/analytics/ValoraAnalytics' | ||
import { PointsEvents } from 'src/analytics/Events' | ||
import CustomHeader from 'src/components/header/CustomHeader' | ||
import { Screens } from 'src/navigator/Screens' | ||
import { StackParamList } from 'src/navigator/types' | ||
import ActivityCardSection from 'src/points/ActivityCardSection' | ||
import { pointsSectionsSelector } from 'src/points/selectors' | ||
import { getHistoryStarted } from 'src/points/slice' | ||
import { BottomSheetParams, PointsActivity } from 'src/points/types' | ||
import { useDispatch, useSelector } from 'src/redux/hooks' | ||
import { Colors } from 'src/styles/colors' | ||
import { typeScale } from 'src/styles/fonts' | ||
import { Spacing } from 'src/styles/styles' | ||
|
||
type Props = NativeStackScreenProps<StackParamList, Screens.PointsHome> | ||
|
||
export default function PointsHome({ route, navigation }: Props) { | ||
const { t } = useTranslation() | ||
|
||
const dispatch = useDispatch() | ||
|
||
const pointsSections = useSelector(pointsSectionsSelector) | ||
|
||
// TODO: Use real points balance | ||
const pointsBalance = 50 | ||
|
||
const bottomSheetRef = useRef<BottomSheetRefType>(null) | ||
const activityCardBottomSheetRef = useRef<BottomSheetRefType>(null) | ||
|
||
const [bottomSheetParams, setBottomSheetParams] = useState<BottomSheetParams | undefined>( | ||
undefined | ||
|
@@ -36,7 +43,7 @@ export default function PointsHome({ route, navigation }: Props) { | |
|
||
useEffect(() => { | ||
if (bottomSheetParams) { | ||
bottomSheetRef.current?.snapToIndex(0) | ||
activityCardBottomSheetRef.current?.snapToIndex(0) | ||
} | ||
}, [bottomSheetParams]) | ||
|
||
|
@@ -48,28 +55,41 @@ export default function PointsHome({ route, navigation }: Props) { | |
onPress() | ||
} | ||
} | ||
const onPressActivity = () => { | ||
ValoraAnalytics.track(PointsEvents.points_screen_activity_press) | ||
dispatch(getHistoryStarted({ fromPage: false })) | ||
// TODO: Open history bottom sheet | ||
} | ||
|
||
return ( | ||
<SafeAreaView style={styles.outerContainer} edges={['top']}> | ||
<CustomHeader | ||
style={styles.header} | ||
left={<BackButton eventName={PointsEvents.points_screen_back} />} | ||
/> | ||
<ScrollView contentContainerStyle={styles.contentContainer}> | ||
<Text style={styles.title}>{t('points.title')}</Text> | ||
<View style={styles.titleRow}> | ||
<Text style={styles.title}>{t('points.title')}</Text> | ||
<Button | ||
testID={'PointsActivityButton'} | ||
onPress={onPressActivity} | ||
text={t('points.activity')} | ||
type={BtnTypes.GRAY_WITH_BORDER} | ||
fontStyle={typeScale.labelXSmall} | ||
size={BtnSizes.FULL} | ||
touchableStyle={styles.buttonStyle} | ||
/> | ||
</View> | ||
<View style={styles.balanceRow}> | ||
<Text style={styles.balance}>{pointsBalance}</Text> | ||
</View> | ||
<View style={styles.infoCard}> | ||
<Text style={styles.infoCardTitle}>{t('points.infoCard.title')}</Text> | ||
<Text style={styles.infoCardBody}>{t('points.infoCard.body')}</Text> | ||
</View> | ||
<ActivityCardSection onCardPress={onCardPress} /> | ||
<ActivityCardSection onCardPress={onCardPress} pointsSections={pointsSections} /> | ||
</ScrollView> | ||
<BottomSheet | ||
snapPoints={['50%']} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a personal preference but the vertical spaces triggered me, particularly between the bottom of the button and the bottom of the screen. i think it's better to let the bottom sheet size itself (if we need to increase the height, we should add space above the button) |
||
forwardedRef={bottomSheetRef} | ||
testId={`PointsActivityBottomSheet`} | ||
> | ||
<BottomSheet forwardedRef={activityCardBottomSheetRef} testId={`PointsActivityBottomSheet`}> | ||
{bottomSheetParams && ( | ||
<> | ||
<View style={styles.bottomSheetPointAmountContainer}> | ||
|
@@ -152,4 +172,14 @@ const styles = StyleSheet.create({ | |
...typeScale.titleMedium, | ||
paddingVertical: Spacing.Smallest8, | ||
}, | ||
titleRow: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}, | ||
buttonStyle: { | ||
height: undefined, | ||
paddingHorizontal: Spacing.Small12, | ||
paddingVertical: Spacing.Smallest8, | ||
}, | ||
}) |
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.
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: is that an index? wdyt about naming it
sectionIndex
?