added entities

added Cache, Event and Find entities for pressable and scrollable components
This commit is contained in:
suddenlyoranges committed 2026-04-09 14:52:56 +01:00
1 parent 4d5eac38b7
commit 6e25fe6807
6 files changed
+328

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
import { StyleSheet, Text, View } from "react-native";
const FindItem = ({ find }) => {
// Initialisations ---------------------
// State -------------------------------
// Handlers ----------------------------
const formatDate = (dt) => {
if (!dt) return "—";
return new Date(dt).toLocaleString();
};
const cacheName = find.FindCache?.CacheName ?? `Cache #${find.FindCacheID}`;
const points = find.FindCache?.CachePoints ?? 0;
const username =
find.FindPlayer?.PlayerUser?.UserUsername ?? `Player #${find.FindPlayerID}`;
// View --------------------------------
return (
<View style={styles.item}>
<View style={styles.row}>
<Text style={styles.cacheName} numberOfLines={1}>
{cacheName}
</Text>
<Text style={styles.points}>+{points} pts</Text>
</View>
<Text style={styles.meta}>
{username} · {formatDate(find.FindDatetime)}
</Text>
</View>
);
};
const styles = StyleSheet.create({
item: {
paddingVertical: 12,
borderTopWidth: 1,
borderColor: "lightgray",
gap: 3,
},
row: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
},
cacheName: {
fontSize: 15,
fontWeight: "600",
color: "#111827",
flex: 1,
marginRight: 8,
},
points: {
fontSize: 14,
fontWeight: "700",
color: "#16a34a",
},
meta: {
fontSize: 12,
color: "#9ca3af",
},
});
export default FindItem;
+23
View File
@@ -0,0 +1,23 @@
import { ScrollView, StyleSheet } from "react-native";
import FindItem from "./FindItem";
const FindList = ({ finds }) => {
// Initialisations ---------------------
// State -------------------------------
// Handlers ----------------------------
// View --------------------------------
return (
<ScrollView style={styles.container}>
{finds.map((find) => (
<FindItem key={find.FindID} find={find} />
))}
</ScrollView>
);
};
const styles = StyleSheet.create({
container: {},
});
export default FindList;