Change layout of SetItem

Moved the date to the description,
and the reps x weight to the right.

Related to #192.
This commit is contained in:
Brandon Presley 2023-11-14 20:44:54 +13:00
parent ddceb91211
commit 859818e5b6

View File

@ -45,36 +45,37 @@ export default function SetItem({
return LIGHT_RIPPLE; return LIGHT_RIPPLE;
}, [dark, ids, item.id]); }, [dark, ids, item.id]);
const left = useCallback(() => { const image = useCallback(() => {
if (!settings.images || !item.image) return null; if (!settings.images || !item.image) return null;
return ( return (
<Image source={{ uri: item.image }} style={{ height: 75, width: 75 }} /> <Image source={{ uri: item.image }} style={{ height: 75, width: 75 }} />
); );
}, [item.image, settings.images]); }, [item.image, settings.images]);
const right = useCallback(() => {
if (!settings.showDate) return null;
return ( return (
<List.Item
onPress={press}
title={item.name}
description={
settings.showDate ? (
<Text style={{ color: dark ? "#909090ff" : "#717171ff" }}>
{format(new Date(item.created), settings.date || "P")}
</Text>
) : null
}
onLongPress={longPress}
style={{ backgroundColor: customBg || backgroundColor }}
left={image}
right={() => (
<Text <Text
style={{ style={{
alignSelf: "center", alignSelf: "center",
color: dark ? "#909090ff" : "#717171ff", color: dark ? "#909090ff" : "#717171ff",
}} }}
> >
{format(new Date(item.created), settings.date || "P")} {`${item.reps} x ${item.weight}${item.unit || "kg"}`}
</Text> </Text>
); )}
}, [settings.showDate, item.created, settings.date, dark]);
return (
<List.Item
onPress={press}
title={item.name}
description={`${item.reps} x ${item.weight}${item.unit || "kg"}`}
onLongPress={longPress}
style={{ backgroundColor: customBg || backgroundColor }}
left={left}
right={right}
/> />
); );
} }