Import apps/android/src/screens/message-actions.tsx
This commit is contained in:
parent
50de7fac7b
commit
2dc0f0db29
|
|
@ -1,5 +1,6 @@
|
||||||
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
import { createContext, useContext, useEffect, useRef, useState } from 'react'
|
||||||
import { AccessibilityInfo, Alert, Animated, Modal, Pressable, StyleSheet, Text, View } from 'react-native'
|
import { AccessibilityInfo, Animated, Modal, Pressable, StyleSheet, Text, View } from 'react-native'
|
||||||
|
import { Alert } from '../ui/alert'
|
||||||
import * as Clipboard from 'expo-clipboard'
|
import * as Clipboard from 'expo-clipboard'
|
||||||
import type { ChatItemBase, ChatMessage, RemoteSession } from '../types'
|
import type { ChatItemBase, ChatMessage, RemoteSession } from '../types'
|
||||||
import { useAppStore } from '../state/store'
|
import { useAppStore } from '../state/store'
|
||||||
|
|
@ -72,8 +73,8 @@ export function TurnUsageModal({
|
||||||
onRequestClose={onClose}
|
onRequestClose={onClose}
|
||||||
statusBarTranslucent
|
statusBarTranslucent
|
||||||
>
|
>
|
||||||
<Pressable style={styles.modalOverlay} onPress={onClose}>
|
<Pressable style={[styles.modalOverlay, { backgroundColor: colors.scrim }]} onPress={onClose}>
|
||||||
<View style={[styles.usageCard, { backgroundColor: colors.surface, borderColor: colors.border }]} onStartShouldSetResponder={() => true}>
|
<View style={[styles.usageCard, { backgroundColor: colors.surface, borderColor: colors.border, shadowColor: colors.shadow }]} onStartShouldSetResponder={() => true}>
|
||||||
{/* Header row */}
|
{/* Header row */}
|
||||||
<View style={styles.usageTitleRow}>
|
<View style={styles.usageTitleRow}>
|
||||||
<View style={styles.usageTitleLeft}>
|
<View style={styles.usageTitleLeft}>
|
||||||
|
|
@ -210,7 +211,7 @@ export function MessageActions({ item, hideTime }: { item: ChatMessage; hideTime
|
||||||
if (user) {
|
if (user) {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.row, styles.userRow]}>
|
<View style={[styles.row, styles.userRow]}>
|
||||||
{time !== undefined && !hideTime && <Text style={{ color: colors.muted, fontSize: 12 }}>{messageClock(time)}</Text>}
|
{time !== undefined && !hideTime && <Text style={[styles.userTimeText, { color: colors.subtle }]}>{messageClock(time)}</Text>}
|
||||||
<Animated.View style={{ opacity: copyOpacity }}>
|
<Animated.View style={{ opacity: copyOpacity }}>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
|
|
@ -221,9 +222,9 @@ export function MessageActions({ item, hideTime }: { item: ChatMessage; hideTime
|
||||||
onPress={handleCopy}
|
onPress={handleCopy}
|
||||||
>
|
>
|
||||||
{copied ? (
|
{copied ? (
|
||||||
<IconCheckOutline size={14} color={colors.primary} />
|
<IconCheckOutline size={13} color={colors.primary} />
|
||||||
) : (
|
) : (
|
||||||
<IconCopyOutline size={14} color={colors.muted} />
|
<IconCopyOutline size={13} color={colors.subtle} />
|
||||||
)}
|
)}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|
@ -281,7 +282,7 @@ export function MessageActions({ item, hideTime }: { item: ChatMessage; hideTime
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)}
|
)}
|
||||||
{time !== undefined && (
|
{time !== undefined && (
|
||||||
<Text style={[styles.timeText, { color: colors.muted }]}>
|
<Text style={[styles.timeText, { color: colors.subtle }]}>
|
||||||
{messageClock(time)}
|
{messageClock(time)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
@ -300,24 +301,25 @@ export function MessageActions({ item, hideTime }: { item: ChatMessage; hideTime
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
row: { flexDirection: 'row', alignItems: 'center', minHeight: 32 },
|
row: { flexDirection: 'row', alignItems: 'center', minHeight: 24 },
|
||||||
userRow: { justifyContent: 'flex-end', gap: 8, paddingTop: 4 },
|
userRow: { justifyContent: 'flex-end', gap: 6, paddingTop: 3, paddingRight: 2 },
|
||||||
|
userTimeText: { fontSize: 11, fontVariant: ['tabular-nums'] },
|
||||||
assistantRow: {
|
assistantRow: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 12,
|
gap: 10,
|
||||||
minHeight: 32,
|
minHeight: 28,
|
||||||
paddingTop: 8,
|
paddingTop: 6,
|
||||||
paddingBottom: 2,
|
paddingBottom: 2,
|
||||||
},
|
},
|
||||||
timeText: {
|
timeText: {
|
||||||
fontSize: 12,
|
fontSize: 11,
|
||||||
fontVariant: ['tabular-nums'],
|
fontVariant: ['tabular-nums'],
|
||||||
marginLeft: -4,
|
marginLeft: -2,
|
||||||
},
|
},
|
||||||
actionBtn: {
|
actionBtn: {
|
||||||
width: 28,
|
width: 26,
|
||||||
height: 28,
|
height: 26,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
|
@ -325,16 +327,15 @@ const styles = StyleSheet.create({
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 4,
|
gap: 4,
|
||||||
height: 28,
|
height: 26,
|
||||||
paddingHorizontal: 2,
|
paddingHorizontal: 2,
|
||||||
},
|
},
|
||||||
usageText: {
|
usageText: {
|
||||||
fontSize: 12,
|
fontSize: 11.5,
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
},
|
},
|
||||||
modalOverlay: {
|
modalOverlay: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0.25)',
|
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: 20,
|
padding: 20,
|
||||||
|
|
@ -342,10 +343,9 @@ const styles = StyleSheet.create({
|
||||||
usageCard: {
|
usageCard: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
maxWidth: 340,
|
maxWidth: 340,
|
||||||
borderRadius: 14,
|
borderRadius: 16,
|
||||||
borderWidth: StyleSheet.hairlineWidth,
|
borderWidth: StyleSheet.hairlineWidth,
|
||||||
padding: 16,
|
padding: 16,
|
||||||
shadowColor: '#000',
|
|
||||||
shadowOffset: { width: 0, height: 4 },
|
shadowOffset: { width: 0, height: 4 },
|
||||||
shadowOpacity: 0.12,
|
shadowOpacity: 0.12,
|
||||||
shadowRadius: 16,
|
shadowRadius: 16,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue