import { Link, routes } from '@redwoodjs/router'

import Kaufs from 'src/components/Kauf/Kaufs'

export const QUERY = gql`
  query FindKaufs {
    kaufs {
      id
      timestamp
      preis_ges
    }
  }
`

export const Loading = () => <div>Loading...</div>

export const Empty = () => {
  return (
    <div className="rw-text-center">
      {'No kaufs yet. '}
      <Link to={routes.newKauf()} className="rw-link">
        {'Create one?'}
      </Link>
    </div>
  )
}

export const Failure = ({ error }) => (
  <div className="rw-cell-error">{error?.message}</div>
)

export const Success = ({ kaufs }) => {
  return <Kaufs kaufs={kaufs} />
}
