Skip to content

Commit c264804

Browse files
committed
feat: open file in browser upon clicking the card
1 parent 95b4e3f commit c264804

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/app/(tabs)/index.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useCallback, useEffect, useState } from 'react';
2-
import { StyleSheet, Alert, ScrollView, Pressable, ActivityIndicator, RefreshControl, View } from 'react-native';
2+
import { StyleSheet, Alert, ScrollView, Pressable, ActivityIndicator, RefreshControl, View, Linking } from 'react-native';
33
import Constants from 'expo-constants';
4+
import { MaterialIcons } from '@expo/vector-icons';
45
import { Stack, router } from 'expo-router';
56
import * as Clipboard from 'expo-clipboard';
67

@@ -227,15 +228,23 @@ export default function ListScreen() {
227228
) : (
228229
sortUploads(uploads, sortField, sortDirection).map((upload) => (
229230
<ThemedView key={upload.file_name} style={styles.uploadItem}>
230-
<ThemedView style={styles.uploadDetails}>
231-
<ThemedText style={styles.fileName}>{upload.file_name}</ThemedText>
231+
<Pressable
232+
onPress={() => {
233+
const url = `${settings.serverUrl}/${upload.file_name}`;
234+
Linking.openURL(url);
235+
}}
236+
style={styles.uploadDetails}>
237+
<View style={styles.fileNameRow}>
238+
<ThemedText style={styles.fileName}>{upload.file_name}</ThemedText>
239+
<MaterialIcons name="open-in-new" size={16} color="#666666" />
240+
</View>
232241
<ThemedText style={styles.fileInfo}>
233242
Size: {formatFileSize(upload.file_size)}
234243
</ThemedText>
235244
<ThemedText style={styles.fileInfo}>
236245
Expires: {formatDate(upload.expires_at_utc)}
237246
</ThemedText>
238-
</ThemedView>
247+
</Pressable>
239248
<ThemedView style={styles.buttonRow}>
240249
<Pressable
241250
style={({ pressed }) => [
@@ -278,6 +287,12 @@ export default function ListScreen() {
278287
}
279288

280289
const styles = StyleSheet.create({
290+
fileNameRow: {
291+
flexDirection: 'row',
292+
alignItems: 'center',
293+
justifyContent: 'space-between',
294+
marginBottom: 4,
295+
},
281296
sortControls: {
282297
marginBottom: 20,
283298
},

0 commit comments

Comments
 (0)