Skip to content

Commit b79e65d

Browse files
committed
refactor: changes to theme values and files
1 parent fac74e5 commit b79e65d

29 files changed

+652
-502
lines changed

dapps/Web3InboxLab/babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ module.exports = {
99
crypto: 'react-native-quick-crypto',
1010
stream: 'stream-browserify',
1111
buffer: '@craftzdog/react-native-buffer',
12+
'@/components': './src/components',
13+
'@/constants': './src/constants',
14+
'@/context': './src/context',
15+
'@/data': './src/data',
16+
'@/hooks': './src/hooks',
17+
'@/navigators': './src/navigators',
18+
'@/icons': './src/icons',
19+
'@/screens': './src/screens',
20+
'@/modals': './src/modals',
21+
'@/utils': './src/utils',
22+
'@/provider': './src/provider',
23+
'@/store': './src/store',
1224
},
1325
},
1426
],

dapps/Web3InboxLab/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,4 +1490,4 @@ SPEC CHECKSUMS:
14901490

14911491
PODFILE CHECKSUM: e8f78ebf5f1060186f4f0fa5d30ef145aeab106b
14921492

1493-
COCOAPODS: 1.14.3
1493+
COCOAPODS: 1.15.2

dapps/Web3InboxLab/ios/Web3InboxLab.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,10 @@
623623
"-DFOLLY_USE_LIBCPP=1",
624624
"-DFOLLY_CFG_NO_COROUTINES=1",
625625
);
626-
OTHER_LDFLAGS = "$(inherited) ";
626+
OTHER_LDFLAGS = (
627+
"$(inherited)",
628+
" ",
629+
);
627630
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
628631
SDKROOT = iphoneos;
629632
USE_HERMES = true;
@@ -702,7 +705,10 @@
702705
"-DFOLLY_USE_LIBCPP=1",
703706
"-DFOLLY_CFG_NO_COROUTINES=1",
704707
);
705-
OTHER_LDFLAGS = "$(inherited) ";
708+
OTHER_LDFLAGS = (
709+
"$(inherited)",
710+
" ",
711+
);
706712
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
707713
SDKROOT = iphoneos;
708714
USE_HERMES = true;

dapps/Web3InboxLab/src/components/AccountButton.tsx

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,16 @@ import React from 'react';
33
import {useWeb3Modal} from '@web3modal/wagmi-react-native';
44
import {useAccount, useEnsAvatar, useEnsName} from 'wagmi';
55
import {Image, Pressable, View} from 'react-native';
6-
import useColors from '../utils/theme';
76

8-
import {
9-
Canvas,
10-
Rect,
11-
RadialGradient,
12-
Skia,
13-
Shader,
14-
vec,
15-
} from '@shopify/react-native-skia';
7+
import {Canvas, Rect, RadialGradient, vec} from '@shopify/react-native-skia';
8+
import {generateAvatarColor} from '@/utils/ColorGenerator';
9+
import useColors from '@/hooks/useColors';
1610

1711
interface AvatarProps {
1812
width: number;
1913
height: number;
2014
}
2115

22-
const hexToRgb = (hex: string): [number, number, number] => {
23-
const bigint = parseInt(hex, 16);
24-
25-
const r = (bigint >> 16) & 255;
26-
const g = (bigint >> 8) & 255;
27-
const b = bigint & 255;
28-
29-
return [r, g, b];
30-
};
31-
32-
const tintColor = (
33-
rgb: [number, number, number],
34-
tint: number,
35-
): [number, number, number] => {
36-
const [r, g, b] = rgb;
37-
const tintedR = Math.round(r + (255 - r) * tint);
38-
const tintedG = Math.round(g + (255 - g) * tint);
39-
const tintedB = Math.round(b + (255 - b) * tint);
40-
41-
return [tintedR, tintedG, tintedB];
42-
};
43-
44-
export const generateAvatarColor = (address: string) => {
45-
const hash = address.toLowerCase().replace(/^0x/iu, '');
46-
const baseColor = hash.substring(0, 6);
47-
const rgbColor = hexToRgb(baseColor);
48-
49-
const colors: string[] = [];
50-
51-
for (let i = 0; i < 5; i += 1) {
52-
const tintedColor = tintColor(rgbColor, 0.15 * i);
53-
colors.push(`rgb(${tintedColor[0]}, ${tintedColor[1]}, ${tintedColor[2]})`);
54-
}
55-
56-
return colors;
57-
};
58-
5916
export default function AccountButton({width, height}: AvatarProps) {
6017
const {address} = useAccount();
6118
const modal = useWeb3Modal();
@@ -65,6 +22,10 @@ export default function AccountButton({width, height}: AvatarProps) {
6522
const {data: ensName} = useEnsName({address: addressOrEnsDomain});
6623
const {data: ensAvatar} = useEnsAvatar({name: ensName});
6724

25+
if (!address) {
26+
return null;
27+
}
28+
6829
return (
6930
<Pressable
7031
style={{

dapps/Web3InboxLab/src/components/DiscoverListItem.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import {
1010
} from 'react-native';
1111
import useNotifyClientContext from '../hooks/useNotifyClientContext';
1212

13-
import projectsData from '../constants/projects-resposne.json';
14-
import useColors from '../utils/theme';
15-
16-
type ProjectItem = (typeof projectsData)[0];
13+
import useColors from '@/hooks/useColors';
14+
import {ProjectItem} from '@/constants/Explorer';
1715

1816
type DiscoverListItemProps = {
1917
item: ProjectItem;

dapps/Web3InboxLab/src/components/NotificationItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Pressable, StyleSheet, Text, View} from 'react-native';
2-
import useColors from '../utils/theme';
2+
import useColors from '@/hooks/useColors';
33
import {DateUtil} from '../utils/date';
44

55
type NotificationItemProps = {

dapps/Web3InboxLab/src/components/NotificationItemWithSubscription.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Image, Pressable, StyleSheet, Text, View} from 'react-native';
2-
import useColors from '../utils/theme';
2+
import useColors from '@/hooks/useColors';
33
import {DateUtil} from '../utils/date';
44
import {NotifyClientTypes} from '@walletconnect/notify-client';
55

dapps/Web3InboxLab/src/components/SubscriptionItem.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import useColors from '@/hooks/useColors';
12
import {Image, Pressable, StyleSheet, Text, View} from 'react-native';
2-
import useColors from '../utils/theme';
33

44
interface ISubscriptionItem {
55
title: string;
@@ -20,14 +20,13 @@ export default function SubscriptionItem({
2020
<Pressable
2121
onPress={onPress}
2222
style={({pressed}) => [
23+
styles.container,
2324
{
2425
backgroundColor: pressed
2526
? colors.backgroundActive
2627
: colors.background,
2728
borderColor: colors.border,
28-
borderRadius: 16,
2929
},
30-
styles.container,
3130
]}>
3231
<View style={styles.imageContainer}>
3332
<View style={styles.imageBorder} />
@@ -51,13 +50,12 @@ const styles = StyleSheet.create({
5150
gap: 8,
5251
width: '100%',
5352
padding: 12,
54-
borderWidth: 0.5,
5553
},
5654
contentContainer: {
5755
flex: 1,
5856
display: 'flex',
5957
flexDirection: 'column',
60-
gap: 8,
58+
gap: 4,
6159
},
6260
title: {
6361
fontSize: 15,

dapps/Web3InboxLab/src/components/SubscriptionItemSkeleton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {View} from 'react-native';
2-
import useColors from '../utils/theme';
2+
import useColors from '@/hooks/useColors';
33

44
export default function SubscriptionItemSkeleton({style}) {
55
const colors = useColors();

0 commit comments

Comments
 (0)