|
1 | 1 | 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'; |
3 | 3 | import Constants from 'expo-constants'; |
| 4 | +import { MaterialIcons } from '@expo/vector-icons'; |
4 | 5 | import { Stack, router } from 'expo-router'; |
5 | 6 | import * as Clipboard from 'expo-clipboard'; |
6 | 7 |
|
@@ -227,15 +228,23 @@ export default function ListScreen() { |
227 | 228 | ) : ( |
228 | 229 | sortUploads(uploads, sortField, sortDirection).map((upload) => ( |
229 | 230 | <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> |
232 | 241 | <ThemedText style={styles.fileInfo}> |
233 | 242 | Size: {formatFileSize(upload.file_size)} |
234 | 243 | </ThemedText> |
235 | 244 | <ThemedText style={styles.fileInfo}> |
236 | 245 | Expires: {formatDate(upload.expires_at_utc)} |
237 | 246 | </ThemedText> |
238 | | - </ThemedView> |
| 247 | + </Pressable> |
239 | 248 | <ThemedView style={styles.buttonRow}> |
240 | 249 | <Pressable |
241 | 250 | style={({ pressed }) => [ |
@@ -278,6 +287,12 @@ export default function ListScreen() { |
278 | 287 | } |
279 | 288 |
|
280 | 289 | const styles = StyleSheet.create({ |
| 290 | + fileNameRow: { |
| 291 | + flexDirection: 'row', |
| 292 | + alignItems: 'center', |
| 293 | + justifyContent: 'space-between', |
| 294 | + marginBottom: 4, |
| 295 | + }, |
281 | 296 | sortControls: { |
282 | 297 | marginBottom: 20, |
283 | 298 | }, |
|
0 commit comments