-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7081d66
commit 38e86da
Showing
9 changed files
with
149 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"use client"; | ||
import { Table } from "@/components"; | ||
import { recentActivitiesData, recentActivitiesColumns } from "@/data"; | ||
|
||
export default function RecentActivities() { | ||
return ( | ||
<div> | ||
<Table | ||
columns={recentActivitiesColumns} | ||
data={recentActivitiesData} | ||
pagination={{ total: recentActivitiesData.length }} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Camera } from "@/types"; | ||
|
||
export const cameras: Camera[] = [ | ||
{ | ||
key: "backyard", | ||
name: "Backyard", | ||
isActive: true, | ||
url: "https://www.youtube.com/embed/Sv2h-csnlps?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
{ | ||
key: "main-road", | ||
name: "Main road", | ||
isActive: true, | ||
url: "https://www.youtube.com/embed/yNQmth5kUZ0?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
{ | ||
key: "door", | ||
name: "Door", | ||
isActive: true, | ||
url: "https://www.youtube.com/embed/dV9ngLCKE7k?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
{ | ||
key: "pet-room", | ||
name: "Pet room", | ||
isActive: true, | ||
url: "https://www.youtube.com/embed/ewEW_xAKRMg?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
{ | ||
key: "basement", | ||
name: "Basement", | ||
isActive: false, | ||
url: "https://www.youtube.com/embed/ewEW_xAKRMg?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
{ | ||
key: "baby-room", | ||
name: "Baby room", | ||
isActive: false, | ||
url: "https://www.youtube.com/embed/ewEW_xAKRMg?modestbranding=1&showinfo=0&controls=0&autoplay=1&mute=1", | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"use client"; | ||
import { Activity } from "@/types"; | ||
import { Button } from "@/components"; | ||
import { Space } from "antd"; | ||
import { CameraOutlined, VideoCameraOutlined } from "@ant-design/icons"; | ||
import type { ColumnsType } from "antd/es/table"; | ||
import { cameras } from "./camera-data"; | ||
import { authorizedEntitiesData } from "./authorized-entities-data"; | ||
|
||
export const recentActivitiesColumns: ColumnsType<Activity> = [ | ||
{ | ||
title: "Time", | ||
dataIndex: "timestamp", | ||
key: "timestamp", | ||
}, | ||
{ | ||
title: "Camera", | ||
dataIndex: "camera", | ||
render: (_, record) => <span>{record.camera.name}</span>, | ||
}, | ||
{ | ||
title: "Entity", | ||
dataIndex: "entity", | ||
render: (_, record) => ( | ||
<span className={`${record.entity ? "text-success" : "text-danger"}`}> | ||
{record.entity ? record.entity.name : "Unkown"} | ||
</span> | ||
), | ||
}, | ||
{ | ||
title: "Action", | ||
key: "action", | ||
render: (_, record) => ( | ||
<Space size="middle"> | ||
<Button toolTipText="View screenshot" icon={<CameraOutlined />} /> | ||
<Button | ||
toolTipText={"View video playback"} | ||
icon={<VideoCameraOutlined />} | ||
/> | ||
</Space> | ||
), | ||
}, | ||
]; | ||
|
||
export const recentActivitiesData: Activity[] = [ | ||
{ | ||
id: "fad4sl3jf21oia32232sj", | ||
timestamp: Date().toString().substring(0, 21), | ||
entity: authorizedEntitiesData[0], | ||
camera: cameras[1], | ||
}, | ||
{ | ||
id: "fad4sl3jf21oia322tesj", | ||
timestamp: Date().toString().substring(0, 21), | ||
entity: authorizedEntitiesData[2], | ||
camera: cameras[4], | ||
}, | ||
{ | ||
id: "fad4sl3jflfoia32232sj", | ||
timestamp: Date().toString().substring(0, 21), | ||
entity: authorizedEntitiesData[4], | ||
camera: cameras[3], | ||
}, | ||
{ | ||
id: "fad4sl3jf21oia72232sj", | ||
timestamp: Date().toString().substring(0, 21), | ||
camera: cameras[0], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Camera } from "./camera"; | ||
import { AuthorizedEntity } from "./authorized-entity"; | ||
|
||
/** This is a data type that denotes an activity (event) that took place at a certain time. | ||
* Activity is composed of properties such as id, timestamp, camera,entity etc. | ||
* */ | ||
export type Activity = { | ||
id: string; | ||
timestamp: string; | ||
entity?: AuthorizedEntity; | ||
camera: Camera; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters