mirror of
https://github.com/mudabbir-ahmad/MAD-Treasure-Hunt.git
synced 2026-10-08 03:00:20 +00:00
added entities
added Cache, Event and Find entities for pressable and scrollable components
This commit is contained in:
1 parent
4d5eac38b7
commit
6e25fe6807
6 files changed
+328
No files matched your search
@@ -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;
|
||||
Reference in new issue
Block a user