feat: add mobile shell and unified search
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 50s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 20s
ci / .NET API 서버 테스트 (push) Successful in 12s
deploy-site / deploy (push) Successful in 39s
ci / 모바일 린트·타입·Jest (push) Failing after 3h10m31s
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 50s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 20s
ci / .NET API 서버 테스트 (push) Successful in 12s
deploy-site / deploy (push) Successful in 39s
ci / 모바일 린트·타입·Jest (push) Failing after 3h10m31s
This commit is contained in:
parent
f505a03d34
commit
5ca3709b32
98 changed files with 5168 additions and 2093 deletions
|
|
@ -7,11 +7,13 @@ import {
|
|||
import { useMobileAds } from '../lib/mobile-ads-context'
|
||||
import { useMobilePreferences } from '../lib/preferences-context'
|
||||
import { ThemeText } from '../theme/themed-components'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
|
||||
const INITIAL_RETRY_DELAY_MS = 30_000
|
||||
const MAX_RETRY_DELAY_MS = 5 * 60_000
|
||||
|
||||
export default function FreeTierBanner(): React.ReactElement | null {
|
||||
const { t } = useI18n()
|
||||
const ads = useMobileAds()
|
||||
const { palette } = useMobilePreferences()
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
|
|
@ -53,7 +55,7 @@ export default function FreeTierBanner(): React.ReactElement | null {
|
|||
},
|
||||
]}
|
||||
testID="free-tier-ad-slot"
|
||||
accessibilityLabel="Sponsored"
|
||||
accessibilityLabel={t('mobile.ads.sponsored')}
|
||||
>
|
||||
{ads.bannerUnitId && !failed ? (
|
||||
<BannerAd
|
||||
|
|
@ -73,12 +75,16 @@ export default function FreeTierBanner(): React.ReactElement | null {
|
|||
/>
|
||||
) : (
|
||||
<ThemeText variant="label" color="muted" style={styles.statusText}>
|
||||
{failed ? 'AD UNAVAILABLE' : ads.status === 'ready' ? 'AD LOADING' : 'AD CONSENT'}
|
||||
{failed
|
||||
? t('mobile.ads.unavailable')
|
||||
: ads.status === 'ready'
|
||||
? t('mobile.ads.loading')
|
||||
: t('mobile.ads.consent')}
|
||||
</ThemeText>
|
||||
)}
|
||||
{ads.bannerUnitId && !loaded && !failed && (
|
||||
<ThemeText variant="label" color="muted" style={styles.loadingOverlay}>
|
||||
AD LOADING
|
||||
{t('mobile.ads.loading')}
|
||||
</ThemeText>
|
||||
)}
|
||||
</View>
|
||||
|
|
@ -93,6 +99,6 @@ const styles = StyleSheet.create({
|
|||
borderTopWidth: 1,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
statusText: { fontSize: 9, letterSpacing: 1.2 },
|
||||
loadingOverlay: { position: 'absolute', fontSize: 9, letterSpacing: 1.2 },
|
||||
statusText: { fontSize: 11, letterSpacing: 0.6 },
|
||||
loadingOverlay: { position: 'absolute', fontSize: 11, letterSpacing: 0.6 },
|
||||
})
|
||||
|
|
|
|||
348
apps/mobile-rn/src/components/RecordFab.tsx
Normal file
348
apps/mobile-rn/src/components/RecordFab.tsx
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
// src/components/RecordFab.tsx — 떠 있는 녹음 버튼 + 위로 펼쳐지는 시작 메뉴 (M3 FAB menu).
|
||||
// 탭 바는 이동용, 녹음 시작은 이 버튼 하나가 맡는다(design.md 2026-09-28 모바일 하단).
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import {
|
||||
AccessibilityInfo,
|
||||
Animated,
|
||||
BackHandler,
|
||||
Keyboard,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
View,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import { useI18n, type TranslationKey } from '@d3ro/i18n'
|
||||
import { useMobilePreferences } from '../lib/preferences-context'
|
||||
import { ThemeText } from '../theme/themed-components'
|
||||
|
||||
export const RECORD_FAB_SIZE = 56
|
||||
export const RECORD_FAB_GAP = 16
|
||||
/** 탭 화면 스크롤 끝이 FAB 에 가리지 않도록 더하는 여백(버튼 + 위아래 간격). */
|
||||
export const RECORD_FAB_CLEARANCE = RECORD_FAB_SIZE + RECORD_FAB_GAP * 2
|
||||
const MENU_ANIMATION_MS = 160
|
||||
|
||||
export type RecordFabAction = 'dictation' | 'meeting' | 'import'
|
||||
|
||||
const MENU_ITEMS: ReadonlyArray<{
|
||||
action: RecordFabAction
|
||||
labelKey: TranslationKey
|
||||
hintKey: TranslationKey
|
||||
}> = [
|
||||
{ action: 'dictation', labelKey: 'mobile.fab.dictation', hintKey: 'mobile.fab.dictationHint' },
|
||||
{ action: 'meeting', labelKey: 'mobile.fab.meeting', hintKey: 'mobile.fab.meetingHint' },
|
||||
{ action: 'import', labelKey: 'mobile.fab.import', hintKey: 'mobile.fab.importHint' },
|
||||
]
|
||||
|
||||
type Palette = ReturnType<typeof useMobilePreferences>['palette']
|
||||
|
||||
function useReduceMotion(): boolean {
|
||||
const [reduceMotion, setReduceMotion] = useState(false)
|
||||
useEffect(() => {
|
||||
let active = true
|
||||
void AccessibilityInfo.isReduceMotionEnabled()
|
||||
.then((enabled) => { if (active) setReduceMotion(enabled) })
|
||||
.catch(() => undefined)
|
||||
const subscription = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduceMotion)
|
||||
return () => {
|
||||
active = false
|
||||
subscription.remove()
|
||||
}
|
||||
}, [])
|
||||
return reduceMotion
|
||||
}
|
||||
|
||||
function useKeyboardVisible(): boolean {
|
||||
const [visible, setVisible] = useState(false)
|
||||
useEffect(() => {
|
||||
const show = Keyboard.addListener('keyboardDidShow', () => setVisible(true))
|
||||
const hide = Keyboard.addListener('keyboardDidHide', () => setVisible(false))
|
||||
return () => {
|
||||
show.remove()
|
||||
hide.remove()
|
||||
}
|
||||
}, [])
|
||||
return visible
|
||||
}
|
||||
|
||||
export interface RecordFabProps {
|
||||
/** 홈·기록·회의 탭에서만 true. false 가 되면 열린 메뉴도 닫힌다. */
|
||||
visible: boolean
|
||||
/** 화면 아래 끝에서 FAB 아래 가장자리까지의 거리(탭 바 높이 + 간격). */
|
||||
bottomOffset: number
|
||||
onSelect: (action: RecordFabAction) => void
|
||||
style?: StyleProp<ViewStyle>
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 화면을 덮는 층(pointerEvents box-none) 위에 FAB 를 오른쪽 아래에 띄운다.
|
||||
* 열리면 스크림 + 메뉴 3개. 스크림·Android 백 키·항목 선택으로 닫힌다.
|
||||
*/
|
||||
export default function RecordFab({
|
||||
visible,
|
||||
bottomOffset,
|
||||
onSelect,
|
||||
style,
|
||||
}: RecordFabProps): React.ReactElement | null {
|
||||
const { t } = useI18n()
|
||||
const { palette } = useMobilePreferences()
|
||||
const reduceMotion = useReduceMotion()
|
||||
const keyboardVisible = useKeyboardVisible()
|
||||
const [open, setOpen] = useState(false)
|
||||
const progress = useRef(new Animated.Value(0)).current
|
||||
const shown = visible && !keyboardVisible
|
||||
|
||||
const close = useCallback((): void => setOpen(false), [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!shown) setOpen(false)
|
||||
}, [shown])
|
||||
|
||||
useEffect(() => {
|
||||
if (reduceMotion) {
|
||||
progress.stopAnimation()
|
||||
progress.setValue(open ? 1 : 0)
|
||||
return
|
||||
}
|
||||
Animated.timing(progress, {
|
||||
toValue: open ? 1 : 0,
|
||||
duration: MENU_ANIMATION_MS,
|
||||
useNativeDriver: true,
|
||||
}).start()
|
||||
}, [open, progress, reduceMotion])
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined
|
||||
const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||
setOpen(false)
|
||||
return true
|
||||
})
|
||||
return () => subscription.remove()
|
||||
}, [open])
|
||||
|
||||
if (!shown) return null
|
||||
|
||||
const select = (action: RecordFabAction): void => {
|
||||
setOpen(false)
|
||||
onSelect(action)
|
||||
}
|
||||
|
||||
const menuTranslate = progress.interpolate({ inputRange: [0, 1], outputRange: [8, 0] })
|
||||
|
||||
return (
|
||||
<View
|
||||
style={[StyleSheet.absoluteFill, styles.layer, style]}
|
||||
pointerEvents="box-none"
|
||||
accessibilityViewIsModal={open}
|
||||
testID="record-fab-layer"
|
||||
>
|
||||
{open && (
|
||||
<Animated.View style={[StyleSheet.absoluteFill, { opacity: progress }]}>
|
||||
<Pressable
|
||||
style={[StyleSheet.absoluteFill, { backgroundColor: palette.scrim }]}
|
||||
onPress={close}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t('mobile.fab.close')}
|
||||
testID="record-fab-scrim"
|
||||
/>
|
||||
</Animated.View>
|
||||
)}
|
||||
|
||||
<View
|
||||
style={[styles.anchor, { bottom: bottomOffset }]}
|
||||
pointerEvents="box-none"
|
||||
>
|
||||
{open && (
|
||||
<Animated.View
|
||||
style={[
|
||||
styles.menu,
|
||||
{ opacity: progress, transform: [{ translateY: menuTranslate }] },
|
||||
]}
|
||||
testID="record-fab-menu"
|
||||
>
|
||||
{MENU_ITEMS.map((item) => (
|
||||
<Pressable
|
||||
key={item.action}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t(item.labelKey)}
|
||||
accessibilityHint={t(item.hintKey)}
|
||||
onPress={() => select(item.action)}
|
||||
testID={`record-fab-${item.action}`}
|
||||
style={({ pressed }) => [
|
||||
styles.menuItem,
|
||||
floatingShadow(palette),
|
||||
{
|
||||
backgroundColor: pressed ? palette.bg.cardHover : palette.bg.elevated,
|
||||
borderColor: palette.border.default,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<MenuGlyph action={item.action} color={palette.text.primary} />
|
||||
<ThemeText variant="body" color="primary" style={styles.menuLabel}>
|
||||
{t(item.labelKey)}
|
||||
</ThemeText>
|
||||
</Pressable>
|
||||
))}
|
||||
</Animated.View>
|
||||
)}
|
||||
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={open ? t('mobile.fab.close') : t('mobile.fab.open')}
|
||||
accessibilityState={{ expanded: open }}
|
||||
onPress={() => setOpen((current) => !current)}
|
||||
testID="record-fab"
|
||||
style={({ pressed }) => [
|
||||
styles.fab,
|
||||
floatingShadow(palette),
|
||||
{ backgroundColor: pressed ? palette.accent.solidHover : palette.accent.solid },
|
||||
]}
|
||||
>
|
||||
{open
|
||||
? <CloseGlyph color={palette.accent.ink} />
|
||||
: <MicGlyph color={palette.accent.ink} />}
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
/** 떠 있는 층 1단계 그림자(글로우 아님). */
|
||||
function floatingShadow(palette: Palette): ViewStyle {
|
||||
return {
|
||||
shadowColor: palette.shadow,
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.18,
|
||||
shadowRadius: 6,
|
||||
elevation: 4,
|
||||
}
|
||||
}
|
||||
|
||||
function MicGlyph({ color }: { color: string }): React.ReactElement {
|
||||
return (
|
||||
<View style={glyph.box}>
|
||||
<View style={[glyph.micHead, { borderColor: color }]} />
|
||||
<View style={[glyph.micCup, { borderColor: color }]} />
|
||||
<View style={[glyph.micStem, { backgroundColor: color }]} />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function CloseGlyph({ color }: { color: string }): React.ReactElement {
|
||||
return (
|
||||
<View style={glyph.box}>
|
||||
<View style={[glyph.crossBar, { backgroundColor: color, transform: [{ rotate: '45deg' }] }]} />
|
||||
<View style={[glyph.crossBar, { backgroundColor: color, transform: [{ rotate: '-45deg' }] }]} />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function MenuGlyph({ action, color }: { action: RecordFabAction; color: string }): React.ReactElement {
|
||||
if (action === 'dictation') return <MicGlyph color={color} />
|
||||
if (action === 'meeting') {
|
||||
return (
|
||||
<View style={glyph.box}>
|
||||
<View style={glyph.peopleRow}>
|
||||
<View style={[glyph.head, { borderColor: color }]} />
|
||||
<View style={[glyph.head, { borderColor: color }]} />
|
||||
</View>
|
||||
<View style={glyph.peopleRow}>
|
||||
<View style={[glyph.shoulders, { borderColor: color }]} />
|
||||
<View style={[glyph.shoulders, { borderColor: color }]} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<View style={glyph.box}>
|
||||
<View style={[glyph.file, { borderColor: color }]}>
|
||||
<View style={[glyph.arrowShaft, { backgroundColor: color }]} />
|
||||
<View style={[glyph.arrowHead, { borderColor: color }]} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
// The custom tab bar lives beside the active scene. On compact screens the
|
||||
// scene can otherwise paint over the FAB even though its accessibility node
|
||||
// remains tappable. Keep the whole interaction layer above the scene.
|
||||
layer: {
|
||||
zIndex: 20,
|
||||
elevation: 20,
|
||||
},
|
||||
anchor: {
|
||||
position: 'absolute',
|
||||
right: RECORD_FAB_GAP,
|
||||
alignItems: 'flex-end',
|
||||
},
|
||||
menu: {
|
||||
alignItems: 'flex-end',
|
||||
gap: 8,
|
||||
marginBottom: 12,
|
||||
},
|
||||
menuItem: {
|
||||
minHeight: 48,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: 12,
|
||||
paddingHorizontal: 16,
|
||||
paddingVertical: 10,
|
||||
borderWidth: 1,
|
||||
borderRadius: 8,
|
||||
},
|
||||
menuLabel: { fontWeight: '500' },
|
||||
fab: {
|
||||
width: RECORD_FAB_SIZE,
|
||||
height: RECORD_FAB_SIZE,
|
||||
borderRadius: RECORD_FAB_SIZE / 2,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
})
|
||||
|
||||
const STROKE = 1.5
|
||||
|
||||
const glyph = StyleSheet.create({
|
||||
box: { width: 22, height: 22, alignItems: 'center', justifyContent: 'center' },
|
||||
micHead: { width: 8, height: 12, borderWidth: STROKE, borderRadius: 4 },
|
||||
micCup: {
|
||||
width: 14,
|
||||
height: 7,
|
||||
marginTop: -4,
|
||||
borderWidth: STROKE,
|
||||
borderTopWidth: 0,
|
||||
borderBottomLeftRadius: 7,
|
||||
borderBottomRightRadius: 7,
|
||||
},
|
||||
micStem: { width: STROKE, height: 3 },
|
||||
crossBar: { position: 'absolute', width: 18, height: STROKE, borderRadius: 1 },
|
||||
peopleRow: { flexDirection: 'row', gap: 2 },
|
||||
head: { width: 7, height: 7, borderWidth: STROKE, borderRadius: 4, marginHorizontal: 1 },
|
||||
shoulders: {
|
||||
width: 9,
|
||||
height: 6,
|
||||
marginTop: 1,
|
||||
borderWidth: STROKE,
|
||||
borderBottomWidth: 0,
|
||||
borderTopLeftRadius: 5,
|
||||
borderTopRightRadius: 5,
|
||||
},
|
||||
file: {
|
||||
width: 16,
|
||||
height: 20,
|
||||
borderWidth: STROKE,
|
||||
borderRadius: 3,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
arrowShaft: { width: STROKE, height: 9 },
|
||||
arrowHead: {
|
||||
width: 6,
|
||||
height: 6,
|
||||
marginTop: -6,
|
||||
borderRightWidth: STROKE,
|
||||
borderBottomWidth: STROKE,
|
||||
transform: [{ rotate: '45deg' }],
|
||||
},
|
||||
})
|
||||
137
apps/mobile-rn/src/components/ScreenHeader.tsx
Normal file
137
apps/mobile-rn/src/components/ScreenHeader.tsx
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
import type { ReactNode } from 'react'
|
||||
import {
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
View,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import { useI18n } from '@d3ro/i18n'
|
||||
import { d3roNativeControl, d3roNativeRadius } from '@d3ro/ui-native'
|
||||
import { useMobilePreferences } from '../lib/preferences-context'
|
||||
import { ThemeText } from '../theme/themed-components'
|
||||
|
||||
export interface ScreenHeaderProps {
|
||||
title: string
|
||||
subtitle?: string
|
||||
/** Root-stack screens show a back action. Tab roots explicitly set false. */
|
||||
showBack?: boolean
|
||||
onBack?: () => void
|
||||
rightContent?: ReactNode
|
||||
style?: StyleProp<ViewStyle>
|
||||
testID?: string
|
||||
}
|
||||
|
||||
export function ScreenHeader({
|
||||
title,
|
||||
subtitle,
|
||||
showBack = true,
|
||||
onBack,
|
||||
rightContent,
|
||||
style,
|
||||
testID,
|
||||
}: ScreenHeaderProps): React.ReactElement {
|
||||
const navigation = useNavigation()
|
||||
const insets = useSafeAreaInsets()
|
||||
const { t } = useI18n()
|
||||
const { palette } = useMobilePreferences()
|
||||
|
||||
return (
|
||||
<View
|
||||
testID={testID}
|
||||
style={[
|
||||
styles.container,
|
||||
{
|
||||
paddingTop: insets.top,
|
||||
backgroundColor: palette.bg.sidebar,
|
||||
borderBottomColor: palette.border.default,
|
||||
},
|
||||
style,
|
||||
]}
|
||||
>
|
||||
<View style={styles.row}>
|
||||
{showBack && (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={t('common.back')}
|
||||
hitSlop={2}
|
||||
onPress={onBack ?? (() => navigation.goBack())}
|
||||
style={({ pressed }) => [
|
||||
styles.backButton,
|
||||
pressed && { backgroundColor: palette.overlay.soft },
|
||||
]}
|
||||
>
|
||||
<ThemeText
|
||||
color="primary"
|
||||
style={styles.backGlyph}
|
||||
accessibilityElementsHidden
|
||||
importantForAccessibility="no-hide-descendants"
|
||||
>
|
||||
‹
|
||||
</ThemeText>
|
||||
</Pressable>
|
||||
)}
|
||||
|
||||
<View style={styles.copy}>
|
||||
<ThemeText
|
||||
accessibilityRole="header"
|
||||
variant="title"
|
||||
color="primary"
|
||||
numberOfLines={1}
|
||||
>
|
||||
{title}
|
||||
</ThemeText>
|
||||
{subtitle !== undefined && (
|
||||
<ThemeText variant="small" color="tertiary" numberOfLines={2}>
|
||||
{subtitle}
|
||||
</ThemeText>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{rightContent !== undefined && (
|
||||
<View style={styles.right}>{rightContent}</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
borderBottomWidth: 1,
|
||||
},
|
||||
row: {
|
||||
minHeight: 64,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
paddingHorizontal: 16,
|
||||
paddingVertical: 8,
|
||||
},
|
||||
backButton: {
|
||||
width: d3roNativeControl.h,
|
||||
height: d3roNativeControl.h,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
borderRadius: d3roNativeRadius.button,
|
||||
},
|
||||
backGlyph: {
|
||||
fontSize: 32,
|
||||
lineHeight: 34,
|
||||
fontWeight: '400',
|
||||
},
|
||||
copy: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
gap: 2,
|
||||
},
|
||||
right: {
|
||||
minHeight: d3roNativeControl.h,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
gap: 8,
|
||||
},
|
||||
})
|
||||
92
apps/mobile-rn/src/components/UnifiedSearchResultRow.tsx
Normal file
92
apps/mobile-rn/src/components/UnifiedSearchResultRow.tsx
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
import { Pressable, StyleSheet, View } from 'react-native'
|
||||
import type { UnifiedSearchResult } from '@d3ro/core/types'
|
||||
import {
|
||||
MetalCard,
|
||||
PhosphorText,
|
||||
d3roNativeControl,
|
||||
useNativePalette,
|
||||
} from '@d3ro/ui-native'
|
||||
|
||||
interface UnifiedSearchResultRowProps {
|
||||
result: UnifiedSearchResult
|
||||
title: string
|
||||
sourceLabel: string
|
||||
matchLabel: string
|
||||
dateLabel: string
|
||||
previewFallback: string
|
||||
accessibilityLabel: string
|
||||
onPress: (result: UnifiedSearchResult) => void
|
||||
}
|
||||
|
||||
export function UnifiedSearchResultRow({
|
||||
result,
|
||||
title,
|
||||
sourceLabel,
|
||||
matchLabel,
|
||||
dateLabel,
|
||||
previewFallback,
|
||||
accessibilityLabel,
|
||||
onPress,
|
||||
}: UnifiedSearchResultRowProps): React.ReactElement {
|
||||
const palette = useNativePalette()
|
||||
|
||||
return (
|
||||
<MetalCard style={styles.card} testID={`unified-search-result-${result.source}-${result.id}`}>
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
onPress={() => onPress(result)}
|
||||
style={({ pressed }) => [
|
||||
styles.pressable,
|
||||
pressed && { backgroundColor: palette.overlay.soft },
|
||||
]}
|
||||
testID={`unified-search-open-${result.source}-${result.id}`}
|
||||
>
|
||||
<View style={styles.headingRow}>
|
||||
<PhosphorText variant="heading" color="primary" numberOfLines={2} style={styles.title}>
|
||||
{title}
|
||||
</PhosphorText>
|
||||
<PhosphorText variant="meta" color="tertiary" style={styles.date}>
|
||||
{dateLabel}
|
||||
</PhosphorText>
|
||||
</View>
|
||||
<View style={styles.metaRow}>
|
||||
<PhosphorText variant="label" color="accent">{sourceLabel}</PhosphorText>
|
||||
<PhosphorText variant="label" color="tertiary">{matchLabel}</PhosphorText>
|
||||
</View>
|
||||
<PhosphorText variant="body" color="secondary" numberOfLines={3}>
|
||||
{result.excerpt || previewFallback}
|
||||
</PhosphorText>
|
||||
</Pressable>
|
||||
</MetalCard>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
card: {
|
||||
padding: 0,
|
||||
marginBottom: 12,
|
||||
},
|
||||
pressable: {
|
||||
minHeight: d3roNativeControl.h,
|
||||
padding: 16,
|
||||
gap: 8,
|
||||
},
|
||||
headingRow: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'flex-start',
|
||||
gap: 12,
|
||||
},
|
||||
title: {
|
||||
flex: 1,
|
||||
},
|
||||
date: {
|
||||
flexShrink: 0,
|
||||
fontVariant: ['tabular-nums'],
|
||||
},
|
||||
metaRow: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
gap: 8,
|
||||
},
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue