-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(IT Wallet): [SIW-1415] Add debug info to IT Wallet screens in d…
…ebug mode (#6055)
- Loading branch information
Showing
22 changed files
with
574 additions
and
192 deletions.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
HStack, | ||
IOColors, | ||
Icon, | ||
hexToRgba, | ||
makeFontStyleObject | ||
} from "@pagopa/io-app-design-system"; | ||
import _ from "lodash"; | ||
import * as React from "react"; | ||
import { Pressable, StyleSheet, Text } from "react-native"; | ||
import { useIOSelector } from "../../store/hooks"; | ||
import { debugDataSelector } from "../../store/reducers/debug"; | ||
|
||
type DebugDataIndicatorProps = { | ||
onPress: () => void; | ||
}; | ||
|
||
export const DebugDataIndicator = (props: DebugDataIndicatorProps) => { | ||
const data = useIOSelector(debugDataSelector); | ||
const dataSize = _.size(data); | ||
|
||
if (dataSize === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Pressable | ||
style={styles.wrapper} | ||
accessibilityRole="button" | ||
accessibilityHint={"Opend the debug data"} | ||
onPress={props.onPress} | ||
> | ||
<HStack space={4} alignItems="center"> | ||
<Icon name="ladybug" size={16} color="warning-850" /> | ||
<Text style={styles.text}>{dataSize}</Text> | ||
</HStack> | ||
</Pressable> | ||
); | ||
}; | ||
|
||
const debugItemBgColor = hexToRgba(IOColors["warning-500"], 0.4); | ||
const debugItemBorderColor = hexToRgba(IOColors["warning-850"], 0.1); | ||
|
||
const styles = StyleSheet.create({ | ||
wrapper: { | ||
display: "flex", | ||
flexDirection: "row", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
borderColor: debugItemBorderColor, | ||
borderWidth: 1, | ||
paddingHorizontal: 6, | ||
borderRadius: 8, | ||
backgroundColor: debugItemBgColor | ||
}, | ||
text: { | ||
letterSpacing: 0.2, | ||
fontSize: 14, | ||
textTransform: "uppercase", | ||
color: IOColors["warning-850"], | ||
...makeFontStyleObject("Semibold") | ||
} | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from "react"; | ||
import { | ||
ScrollView, | ||
StyleSheet, | ||
TouchableWithoutFeedback, | ||
View | ||
} from "react-native"; | ||
import { SafeAreaView } from "react-native-safe-area-context"; | ||
import { useIOSelector } from "../../store/hooks"; | ||
import { debugDataSelector } from "../../store/reducers/debug"; | ||
import { DebugPrettyPrint } from "./DebugPrettyPrint"; | ||
|
||
type DebugDataOverlayProps = { | ||
onDismissed?: () => void; | ||
}; | ||
|
||
export const DebugDataOverlay = ({ onDismissed }: DebugDataOverlayProps) => { | ||
const debugData = useIOSelector(debugDataSelector); | ||
return ( | ||
<SafeAreaView style={styles.container}> | ||
<TouchableWithoutFeedback onPress={onDismissed} accessibilityRole="none"> | ||
<View style={styles.overlay} /> | ||
</TouchableWithoutFeedback> | ||
<ScrollView | ||
style={styles.scroll} | ||
contentContainerStyle={styles.scrollContainer} | ||
> | ||
{Object.entries(debugData).map(([key, value]) => ( | ||
<DebugPrettyPrint | ||
key={`debug_data_${key}`} | ||
title={key} | ||
data={value} | ||
expandable={true} | ||
isExpanded={false} | ||
/> | ||
))} | ||
</ScrollView> | ||
</SafeAreaView> | ||
); | ||
}; | ||
|
||
const overlayColor = "#000000B0"; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
position: "absolute", | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
zIndex: 999, | ||
paddingTop: 60 | ||
}, | ||
overlay: { | ||
position: "absolute", | ||
top: 0, | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
backgroundColor: overlayColor | ||
}, | ||
scroll: { | ||
flexGrow: 0 | ||
}, | ||
scrollContainer: { | ||
paddingHorizontal: 16 | ||
} | ||
}); |
Oops, something went wrong.