Skip to content

Commit fde2fde

Browse files
authored
Merge pull request #209 from SynTech-T5/develop
2.1.0
2 parents 1e15b23 + 289d8f0 commit fde2fde

File tree

143 files changed

+13271
-1156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+13271
-1156
lines changed

.gitignore

Lines changed: 3761 additions & 1 deletion
Large diffs are not rendered by default.

client/my-app/package-lock.json

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/my-app/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,9 @@
4545
"tailwindcss": "^4",
4646
"tw-animate-css": "^1.3.7",
4747
"typescript": "^5"
48-
}
48+
},
49+
"description": "This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).",
50+
"main": "index.js",
51+
"author": "",
52+
"license": "ISC"
4953
}

client/my-app/src/app/(plain)/login/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export default function LoginPage() {
3131
const data = await res.json().catch(() => ({}));
3232
if (!res.ok) throw new Error(data?.message || 'Login failed');
3333

34-
localStorage.setItem("access_token", data.token);
35-
3634
window.location.href = '/cameras';
3735
} catch (e: any) {
3836
setErr(e.message ?? 'Login failed');
@@ -41,8 +39,6 @@ export default function LoginPage() {
4139
}
4240
}
4341

44-
console.log('Token: ', localStorage.getItem("access_token"));
45-
4642
return (
4743
<main
4844
className="

client/my-app/src/app/(with-layout)/alerts/[alr_id]/details/page.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { Alert } from "@/app/models/alerts.model";
2-
import AlertDetails from '@/app/components/Alerts/Details/AlertDetails'
2+
import AlertDetails from '@/components/features/alerts/details/AlertDetails'
3+
import { fetchWithAuth } from "@/lib/fetchWithAuth";
34

45
const base = process.env.NEXT_PUBLIC_APP_URL!;
56

67
export default async function Page({ params }: { params: Promise<{ alr_id: string }> }) {
78
const { alr_id } = await params
89

9-
const res = await fetch(`${base}/api/alerts/${alr_id}`, { cache: "no-store" });
10-
if (!res.ok) {
11-
throw new Error("Failed to load alert");
12-
}
13-
14-
const json = await res.json();
10+
const json = await fetchWithAuth<{ data: Alert }>(`/api/alerts/${alr_id}`);
1511
const alert: Alert = json.data;
1612

1713
return (

client/my-app/src/app/(with-layout)/alerts/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// app/(dashboard)/alerts/page.tsx
22
import { Separator } from "@/components/ui/separator";
3-
import AlertView from "@/app/components/Alerts/AlertsView";
4-
import SearchAlertsInput from "@/app/components/Alerts/SearchAlertsInput";
5-
import AlertFilters from "@/app/components/Alerts/AlertFilters";
6-
import RecentAlerts from "@/app/components/Alerts/RecentAlerts";
3+
import AlertView from "@/components/features/alerts/AlertsView";
4+
import SearchAlertsInput from "@/components/features/alerts/SearchAlertsInput";
5+
import AlertFilters from "@/components/features/alerts/AlertFilters";
6+
import RecentAlerts from "@/components/features/alerts/RecentAlerts";
77

88
export default function AlertsPage() {
99
return (
Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
import AnalyticsView from "@/components/features/analytics/AnalyticsView";
2+
import TimeBasedAlertDistribution from "@/components/features/analytics/chart/TimeBasedAlertDistribution";
3+
import AiAccuracyChart from "@/components/features/analytics/chart/AiAccuracyChart";
4+
15
export default function Analytics() {
2-
return (
3-
<div className="rounded-lg bg-[var(--color-white)] shadow-md p-6">
4-
<div className="grid grid-cols-[repeat(auto-fit,minmax(320px,1fr))] gap-6">
5-
<h1 className="text-2xl font-bold">Analytics</h1>
6-
</div>
6+
return (
7+
<div className="space-y-6">
8+
<div className="grid grid-cols-[repeat(auto-fit,minmax(320px,1fr))] gap-6">
9+
<AnalyticsView />
10+
</div>
11+
12+
13+
<div className="rounded-lg bg-[var(--color-white)] shadow-md p-6">
14+
<div className="rounded-lg bg-[var(--color-white)] shadow-md p-6 mt-6">
15+
<TimeBasedAlertDistribution />
716
</div>
8-
);
9-
}
17+
</div>
18+
19+
20+
<div className="rounded-lg bg-[var(--color-white)] shadow-md p-6">
21+
<AiAccuracyChart />
22+
</div>
23+
</div>
24+
);
25+
}

client/my-app/src/app/(with-layout)/cameras/[cam_id]/details/page.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { Camera } from "@/app/models/cameras.model";
2-
import CameraDetails from '@/app/components/Cameras/Details/CameraDetails'
2+
import CameraDetails from '@/components/features/cameras/details/CameraDetails'
3+
import { fetchWithAuth } from "@/lib/fetchWithAuth";
34

45
const base = process.env.NEXT_PUBLIC_APP_URL!;
56

67
export default async function Page({ params }: { params: Promise<{ cam_id: string }> }) {
78
const { cam_id } = await params
89

9-
const res = await fetch(`${base}/api/cameras/${cam_id}`, { cache: "no-store" });
10-
if (!res.ok) {
11-
throw new Error("Failed to load cameras");
12-
}
13-
14-
const json = await res.json();
10+
const json = await fetchWithAuth<{ data: Camera[] }>(`/api/cameras/${cam_id}`);
1511
const camera: Camera = json.data[0];
1612

1713
return (

client/my-app/src/app/(with-layout)/cameras/[cam_id]/page.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
import FullScreenView from "@/app/components/Cameras/FullScreenView";
1+
import FullScreenView from "@/components/features/cameras/FullScreenView";
22
import { Camera } from "@/app/models/cameras.model";
3-
4-
const base = process.env.NEXT_PUBLIC_APP_URL!;
3+
import { fetchWithAuth } from "@/lib/fetchWithAuth";
54

65
export default async function Page({ params }: { params: Promise<{ cam_id: string }> }) {
76
const { cam_id } = await params
87

9-
const res = await fetch(`${base}/api/cameras/${cam_id}`, {
10-
method: "GET",
11-
headers: {
12-
Authorization: `Bearer ${process.env.NEXT_PUBLIC_TOKEN}`,
13-
"Content-Type": "application/json",
14-
},
15-
cache: "no-store",
16-
});
17-
if (!res.ok) {
18-
throw new Error("Failed to load cameras");
19-
}
20-
21-
const json = await res.json();
8+
const json = await fetchWithAuth<{ data: Camera }>(`/api/cameras/${cam_id}`);
229
const camera: Camera = json.data;
2310

2411
console.log(camera);

client/my-app/src/app/(with-layout)/cameras/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// app/(with-layout)/cameras/page.tsx
2-
import CreateEventForm from "@/app/components/Forms/CreateEventForm";
2+
import CreateEventForm from "@/components/forms/events/CreateEventForm";
33
import { Separator } from "@/components/ui/separator";
4-
import CameraView from "@/app/components/Cameras/CameraView";
5-
import SearchCamerasInput from "@/app/components/Cameras/SearchCamerasInput";
6-
import CameraFilters from "@/app/components/Cameras/CameraFilters";
7-
import EventGrid from "@/app/components/Events/EventCardGrid";
4+
import CameraView from "@/components/features/cameras/CameraView";
5+
import SearchCamerasInput from "@/components/features/cameras/SearchCamerasInput";
6+
import CameraFilters from "@/components/features/cameras/CameraFilters";
7+
import EventGrid from "@/components/features/events/EventCardGrid";
88

99
type ViewMode = "grid" | "list";
1010
type SP = Record<string, string | string[] | undefined>;

0 commit comments

Comments
 (0)