Finalize styling
This commit is contained in:
7 files changed
+58
-72
No files matched your search
@@ -17,6 +17,16 @@ export default function HomeLayout() {
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Home",
|
||||
headerRight: route.name === "settings" ? undefined : () => <ProfileHeaderButton />,
|
||||
unstable_headerRightItems:
|
||||
route.name === "settings"
|
||||
? undefined
|
||||
: () => [
|
||||
{
|
||||
type: "custom",
|
||||
element: <ProfileHeaderButton />,
|
||||
hidesSharedBackground: true,
|
||||
},
|
||||
],
|
||||
})}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -88,14 +88,13 @@ export default function SettingsScreen() {
|
||||
]}
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
>
|
||||
<AccountHero user={user} />
|
||||
|
||||
<View style={[styles.pillGroup, { backgroundColor: colors.card }]}>
|
||||
{visibleSections.map((item) => {
|
||||
const selected = section === item.id
|
||||
return (
|
||||
<Pressable
|
||||
key={item.id}
|
||||
accessibilityLabel={item.label}
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ selected }}
|
||||
onPress={() => setSection(item.id)}
|
||||
@@ -106,17 +105,9 @@ export default function SettingsScreen() {
|
||||
>
|
||||
<Ionicons
|
||||
name={item.icon}
|
||||
size={17}
|
||||
size={26}
|
||||
color={selected ? colors.primaryForeground : colors.mutedForeground}
|
||||
/>
|
||||
<Text
|
||||
style={[
|
||||
styles.pillText,
|
||||
{ color: selected ? colors.primaryForeground : colors.foreground },
|
||||
]}
|
||||
>
|
||||
{item.label}
|
||||
</Text>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
@@ -129,37 +120,16 @@ export default function SettingsScreen() {
|
||||
<UsersSection users={allUsers} currentUserId={user._id} />
|
||||
) : null}
|
||||
|
||||
<SessionSection
|
||||
onChangeServer={() => void handleChangeServer()}
|
||||
onSignOut={() => void handleSignOut()}
|
||||
/>
|
||||
{section === "profile" ? (
|
||||
<SessionSection
|
||||
onChangeServer={() => void handleChangeServer()}
|
||||
onSignOut={() => void handleSignOut()}
|
||||
/>
|
||||
) : null}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
function AccountHero({ user }: { user: Doc<"users"> }) {
|
||||
const colors = useThemeColors()
|
||||
|
||||
return (
|
||||
<View style={[styles.hero, { backgroundColor: colors.card }]}>
|
||||
<ProfileAvatar user={user} size={68} />
|
||||
<View style={styles.heroCopy}>
|
||||
<Text style={[styles.heroTitle, { color: colors.foreground }]} numberOfLines={1}>
|
||||
{user.name}
|
||||
</Text>
|
||||
<Text style={[styles.heroSubtitle, { color: colors.mutedForeground }]} numberOfLines={1}>
|
||||
{user.email}
|
||||
</Text>
|
||||
{user.isAdmin ? (
|
||||
<View style={[styles.badge, { backgroundColor: colors.muted }]}>
|
||||
<Text style={[styles.badgeText, { color: colors.mutedForeground }]}>Admin</Text>
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function ProfileSection({ user }: { user: Doc<"users"> }) {
|
||||
const colors = useThemeColors()
|
||||
const updateName = useMutation(api.users.updateProfileName)
|
||||
@@ -673,24 +643,6 @@ const styles = StyleSheet.create({
|
||||
paddingHorizontal: spacing.lg,
|
||||
paddingTop: spacing.md,
|
||||
},
|
||||
hero: {
|
||||
borderRadius: radius.xl,
|
||||
padding: spacing.lg,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: spacing.md,
|
||||
},
|
||||
heroCopy: {
|
||||
flex: 1,
|
||||
gap: spacing.xs,
|
||||
},
|
||||
heroTitle: {
|
||||
fontSize: 22,
|
||||
fontWeight: "800",
|
||||
},
|
||||
heroSubtitle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
badge: {
|
||||
alignSelf: "flex-start",
|
||||
borderRadius: radius.full,
|
||||
@@ -705,21 +657,14 @@ const styles = StyleSheet.create({
|
||||
borderRadius: radius.xl,
|
||||
padding: spacing.xs,
|
||||
flexDirection: "row",
|
||||
flexWrap: "wrap",
|
||||
gap: spacing.xs,
|
||||
},
|
||||
pill: {
|
||||
minHeight: 40,
|
||||
flex: 1,
|
||||
minHeight: 48,
|
||||
borderRadius: radius.full,
|
||||
paddingHorizontal: spacing.md,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.xs,
|
||||
},
|
||||
pillText: {
|
||||
fontSize: 14,
|
||||
fontWeight: "700",
|
||||
},
|
||||
card: {
|
||||
borderRadius: radius.xl,
|
||||
|
||||
@@ -17,6 +17,16 @@ export default function LibraryLayout() {
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Library",
|
||||
headerRight: route.name === "settings" ? undefined : () => <ProfileHeaderButton />,
|
||||
unstable_headerRightItems:
|
||||
route.name === "settings"
|
||||
? undefined
|
||||
: () => [
|
||||
{
|
||||
type: "custom",
|
||||
element: <ProfileHeaderButton />,
|
||||
hidesSharedBackground: true,
|
||||
},
|
||||
],
|
||||
})}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -17,6 +17,16 @@ export default function SearchLayout() {
|
||||
...baseOptions,
|
||||
title: tabStackScreenTitles[route.name] ?? "Search",
|
||||
headerRight: route.name === "settings" ? undefined : () => <ProfileHeaderButton />,
|
||||
unstable_headerRightItems:
|
||||
route.name === "settings"
|
||||
? undefined
|
||||
: () => [
|
||||
{
|
||||
type: "custom",
|
||||
element: <ProfileHeaderButton />,
|
||||
hidesSharedBackground: true,
|
||||
},
|
||||
],
|
||||
})}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -67,6 +67,16 @@ export default function AppLayout() {
|
||||
<FavoritesProvider>
|
||||
<Stack screenOptions={stackOptions}>
|
||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||
<Stack.Screen
|
||||
name="settings"
|
||||
options={{
|
||||
headerShown: false,
|
||||
presentation: Platform.OS === "ios" ? "modal" : "fullScreenModal",
|
||||
animation: "slide_from_bottom",
|
||||
gestureEnabled: true,
|
||||
gestureDirection: "vertical",
|
||||
}}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="player"
|
||||
options={{
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./(tabs)/home/settings"
|
||||
@@ -1,23 +1,23 @@
|
||||
import { useQuery } from "convex/react"
|
||||
import { Image } from "expo-image"
|
||||
import { useRouter } from "expo-router"
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native"
|
||||
|
||||
import { useAppNavigation } from "@/lib/app-navigation"
|
||||
import { initialsFromName } from "@/lib/format"
|
||||
import { radius, useThemeColors } from "@/lib/theme"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
|
||||
export function ProfileHeaderButton() {
|
||||
const { push } = useAppNavigation()
|
||||
const router = useRouter()
|
||||
const colors = useThemeColors()
|
||||
const user = useQuery(api.auth.currentUser)
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityLabel="Open settings"
|
||||
accessibilityLabel="Open profile"
|
||||
accessibilityRole="button"
|
||||
hitSlop={8}
|
||||
onPress={() => push("/settings")}
|
||||
onPress={() => router.push("/(app)/settings")}
|
||||
style={({ pressed }) => [styles.button, { opacity: pressed ? 0.75 : 1 }]}
|
||||
>
|
||||
<View
|
||||
@@ -46,8 +46,8 @@ const styles = StyleSheet.create({
|
||||
marginRight: 4,
|
||||
},
|
||||
avatar: {
|
||||
width: 34,
|
||||
height: 34,
|
||||
width: 42,
|
||||
height: 42,
|
||||
borderRadius: radius.full,
|
||||
borderWidth: 1,
|
||||
alignItems: "center",
|
||||
@@ -59,7 +59,7 @@ const styles = StyleSheet.create({
|
||||
height: "100%",
|
||||
},
|
||||
initials: {
|
||||
fontSize: 12,
|
||||
fontSize: 14,
|
||||
fontWeight: "700",
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user