import {useEffect, useState} from "react";
import CatHistoryLine from "./CatHistoryLine";
import LockHistoryLine from "./LockHistoryLine";
import { History } from "../assets/Types";
import style from './CatHistory.module.css'
export default function CatHistory({history} : History) {
return(
{history.catLog && history.catLog.map((log, index) => (
| {(new Date(log.date)).toLocaleDateString()} - {(new Date(log.date)).toLocaleTimeString()} |
{log.event === 'left' ? 'A pina has left the house' : 'A pina entered the house'} |
))}
{history.lockLog && history.lockLog.map((log, index) => (
| {(new Date(log.date)).toLocaleDateString()} - {(new Date(log.date)).toLocaleTimeString()} |
{log.event === 'locked' ? 'Locked cat door' : 'Unlocked cat door'} |
))}
)
}