import { Pressable, View } from "react-native"; import type { FeedbackScreenEntryCardProps } from "../../../shared/types"; import { allowAuthenticatedAction } from "../../../shared/helpers.js"; import { useFeedbackBody } from "../../../shared/context/FeedbackBodyProvider.js"; import { useNativeAction } from "../helpers.js"; import { FeedbackEntry } from "./primitives"; export function EntryCard({ entry, hooks, onOpen, titleNumberOfLines, }: FeedbackScreenEntryCardProps) { const { isAuthenticated, onUnauthenticated } = useFeedbackBody(); const setUpvote = hooks.useSetEntryUpvote(); const action = useNativeAction(); const toggleUpvote = (desiredState: boolean) => { if ( !allowAuthenticatedAction(isAuthenticated, onUnauthenticated) || action.pending ) { return; } void action.run( () => setUpvote({ entryId: entry.id, desiredState }), "Could not update vote", ); }; return ( ); }