import { TestResponse } from "@/api/types";
import formatISODate from "@/utils/format-iso-date";
import { FontAwesome5 } from "@expo/vector-icons";
import { Pressable, StyleSheet, View } from "react-native";
import { Badge, BadgeText } from "./ui/badge";
import { Divider } from "./ui/divider";
import Panel from "./ui/panel";
import { Skeleton } from "./ui/skeleton";
import { ThemedText } from "./ui/themed-text";
interface TestProps {
test?: TestResponse;
onPress?: (test: TestResponse) => void;
}
const Test = ({ test, onPress }: TestProps) => {
if (!test) return ;
const availableText = test.is_available ? `Available: ${formatISODate(test.closed_at)}` : "Closed";
return (
onPress?.(test)}>
{test.category.name}
{" "}
{availableText}
{test.title}
{test.description}
{test.author.username}
{test.questions_count} Questions
);
};
const styles = StyleSheet.create({
testTitle: {
fontSize: 18,
fontWeight: "600",
marginBottom: 10,
},
});
export default Test;