import { useMutation, useFlash } from '@redwoodjs/web' import { Link, routes } from '@redwoodjs/router' const DELETE_PART_REACTION_MUTATION = gql` mutation DeletePartReactionMutation($id: String!) { deletePartReaction(id: $id) { id } } ` const MAX_STRING_LENGTH = 150 const truncate = (text) => { let output = text if (text && text.length > MAX_STRING_LENGTH) { output = output.substring(0, MAX_STRING_LENGTH) + '...' } return output } const jsonTruncate = (obj) => { return truncate(JSON.stringify(obj, null, 2)) } const timeTag = (datetime) => { return ( ) } const checkboxInputTag = (checked) => { return } const PartReactionsList = ({ partReactions }) => { const { addMessage } = useFlash() const [deletePartReaction] = useMutation(DELETE_PART_REACTION_MUTATION, { onCompleted: () => { addMessage('PartReaction deleted.', { classes: 'rw-flash-success' }) }, }) const onDeleteClick = (id) => { if (confirm('Are you sure you want to delete partReaction ' + id + '?')) { deletePartReaction({ variables: { id }, refetchQueries: ['PART_REACTIONS'], }) } } return (
| Id | Emote | User id | Part id | Created at | Updated at | |
|---|---|---|---|---|---|---|
| {truncate(partReaction.id)} | {truncate(partReaction.emote)} | {truncate(partReaction.userId)} | {truncate(partReaction.partId)} | {timeTag(partReaction.createdAt)} | {timeTag(partReaction.updatedAt)} |