Skip to content

Commit 387bfc4

Browse files
committed
Better styling
1 parent 072b65b commit 387bfc4

File tree

1 file changed

+46
-55
lines changed

1 file changed

+46
-55
lines changed

screens/Profile.tsx

Lines changed: 46 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
TouchableOpacity,
3535
View,
3636
useColorScheme,
37+
ViewStyle,
3738
} from "react-native";
3839
import { Text } from "@/design-system/Text";
3940
import { useSafeAreaInsets } from "react-native-safe-area-context";
@@ -56,7 +57,7 @@ import {
5657
useWalletStore,
5758
} from "@/data/store/accountsStore";
5859
import { useAccountsProfiles } from "@/utils/useAccountsProfiles";
59-
import { useAppTheme } from "@/theme/useAppTheme";
60+
import { ThemedStyle, useAppTheme } from "@/theme/useAppTheme";
6061
import { navigate } from "@/utils/navigation";
6162

6263
import ActivityIndicator from "@components/ActivityIndicator/ActivityIndicator";
@@ -101,41 +102,9 @@ import { Gesture, GestureDetector } from "react-native-gesture-handler";
101102
import { VStack } from "@/design-system/VStack";
102103
import { Button } from "@/design-system/Button/Button";
103104

104-
const useStyles = () => {
105-
const colorScheme = useColorScheme();
106-
return StyleSheet.create({
107-
title: {
108-
textAlign: "center",
109-
fontSize: 34,
110-
fontWeight: "bold",
111-
marginVertical: 10,
112-
color: textPrimaryColor(colorScheme),
113-
},
114-
tableView: {},
115-
avatar: {
116-
marginBottom: 10,
117-
marginTop: 23,
118-
alignSelf: "center",
119-
},
120-
emoji: {
121-
backgroundColor: "rgba(118, 118, 128, 0.12)",
122-
borderRadius: 30,
123-
},
124-
errorText: {
125-
color: dangerColor(colorScheme),
126-
textAlign: "center",
127-
},
128-
errorContainer: {
129-
flexDirection: "row",
130-
alignSelf: "center",
131-
},
132-
errorIcon: {
133-
width: PictoSizes.textButton,
134-
height: PictoSizes.textButton,
135-
marginRight: 5,
136-
},
137-
});
138-
};
105+
const $sectionContainer: ThemedStyle<ViewStyle> = ({ spacing }) => ({
106+
marginBottom: spacing.lg,
107+
});
139108

140109
export default function ProfileScreen() {
141110
return (
@@ -194,10 +163,15 @@ const ContactCard = memo(function ContactCard({
194163
backgroundColor: theme.colors.fill.primary,
195164
borderRadius: theme.borderRadius.xs,
196165
padding: theme.spacing.xl,
197-
marginVertical: theme.spacing.md,
166+
marginTop: theme.spacing.xs,
167+
marginBottom: theme.spacing.lg,
198168
shadowColor: theme.colors.fill.primary,
199169
shadowOpacity: 0.25,
200-
shadowRadius: 24,
170+
shadowRadius: 12,
171+
shadowOffset: {
172+
width: 0,
173+
height: 6, // Positive value pushes shadow down
174+
},
201175
elevation: 5,
202176
};
203177

@@ -276,7 +250,7 @@ const ContactCard = memo(function ContactCard({
276250
});
277251

278252
function ProfileScreenImpl() {
279-
const { theme } = useAppTheme();
253+
const { theme, themed } = useAppTheme();
280254
const router = useRouter();
281255
const account = useCurrentAccount();
282256
const accounts = useAccountsList();
@@ -288,7 +262,6 @@ function ProfileScreenImpl() {
288262
const preferredUserName = usePreferredName(peerAddress);
289263
const setPeersStatus = useSettingsStore((s) => s.setPeersStatus);
290264
const colorScheme = useColorScheme();
291-
const styles = useStyles();
292265

293266
useHeader(
294267
{
@@ -512,7 +485,7 @@ function ProfileScreenImpl() {
512485
leftView: imageURI ? (
513486
<TableViewImage imageURI={getIPFSAssetURI(imageURI)} />
514487
) : (
515-
<TableViewEmoji emoji="👋" style={styles.emoji} />
488+
<TableViewEmoji emoji="👋" />
516489
),
517490
rightView: (
518491
<TableViewPicto
@@ -523,7 +496,7 @@ function ProfileScreenImpl() {
523496
};
524497
}) as TableViewItemType[];
525498
},
526-
[colorScheme, styles.emoji]
499+
[colorScheme]
527500
);
528501

529502
const socialItems = [
@@ -869,7 +842,8 @@ function ProfileScreenImpl() {
869842
{!isMyProfile && !isBlockedPeer && (
870843
<ContactCard
871844
name={preferredUserName}
872-
bio="Soccer dad and physical therapist"
845+
// TODO: implement bio from the profile from Convos backend/local db
846+
// bio="Soccer dad and physical therapist"
873847
avatarUri={preferredAvatarUri}
874848
/>
875849
)}
@@ -885,14 +859,31 @@ function ProfileScreenImpl() {
885859
/>
886860

887861
{isMyProfile && shouldShowError && (
888-
<View style={styles.errorContainer}>
862+
<View
863+
style={{
864+
flexDirection: "row",
865+
alignItems: "center",
866+
justifyContent: "center",
867+
marginBottom: theme.spacing.lg,
868+
}}
869+
>
889870
<Icon
890871
icon="exclamationmark.triangle"
891872
color={dangerColor(colorScheme)}
892873
size={PictoSizes.textButton}
893-
style={styles.errorIcon}
874+
style={{
875+
width: theme.iconSize.sm,
876+
height: theme.iconSize.sm,
877+
}}
894878
/>
895-
<Text style={styles.errorText}>{translate("client_error")}</Text>
879+
<Text
880+
style={{
881+
color: dangerColor(colorScheme),
882+
marginLeft: theme.spacing.xxs,
883+
}}
884+
>
885+
{translate("client_error")}
886+
</Text>
896887
</View>
897888
)}
898889

@@ -918,22 +909,22 @@ function ProfileScreenImpl() {
918909
},
919910
]}
920911
title={translate("youre_the_og")}
921-
style={styles.tableView}
912+
style={themed($sectionContainer)}
922913
/>
923914
)}
924915

925916
{usernamesItems.length > 0 && (
926917
<TableView
927918
items={usernamesItems}
928919
title={`USERNAME${usernamesItems.length > 1 ? "S" : ""}`}
929-
style={styles.tableView}
920+
style={themed($sectionContainer)}
930921
/>
931922
)}
932923

933924
<TableView
934925
items={addressItems}
935926
title={translate("address")}
936-
style={styles.tableView}
927+
style={themed($sectionContainer)}
937928
/>
938929

939930
{route.params?.fromGroupTopic && !isMyProfile && (
@@ -953,15 +944,15 @@ function ProfileScreenImpl() {
953944
},
954945
},
955946
]}
956-
style={styles.tableView}
947+
style={themed($sectionContainer)}
957948
/>
958949
)}
959950

960951
{socialItems.length > 0 && (
961952
<TableView
962953
items={socialItems}
963954
title={translate("social")}
964-
style={styles.tableView}
955+
style={themed($sectionContainer)}
965956
/>
966957
)}
967958
{!isMyProfile && (
@@ -975,13 +966,13 @@ function ProfileScreenImpl() {
975966
leftView: <TableViewImage imageURI={t.image} />,
976967
}))}
977968
title={translate("common_activity")}
978-
style={styles.tableView}
969+
style={themed($sectionContainer)}
979970
/>
980971
)}
981972
<TableView
982973
items={actionsTableViewItems}
983974
title={translate("actions")}
984-
style={styles.tableView}
975+
style={themed($sectionContainer)}
985976
/>
986977
</>
987978
)}
@@ -1111,7 +1102,7 @@ function ProfileScreenImpl() {
11111102
!(notificationsPermissionStatus === "granted")
11121103
)}
11131104
title={translate("actions")}
1114-
style={styles.tableView}
1105+
style={themed($sectionContainer)}
11151106
/>
11161107

11171108
<TableView
@@ -1122,7 +1113,7 @@ function ProfileScreenImpl() {
11221113
},
11231114
]}
11241115
title={translate("app_version")}
1125-
style={styles.tableView}
1116+
style={themed($sectionContainer)}
11261117
/>
11271118
</>
11281119
)}

0 commit comments

Comments
 (0)