Build
This commit is contained in:
@@ -1,50 +1,41 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import Image from 'next/image';
|
||||
import Header from "@/components/Header";
|
||||
import Footer from "@/components/Footer";
|
||||
import { dataStore, type Camera } from '@/lib/dataStore';
|
||||
|
||||
export default function LiveStream() {
|
||||
const [selectedCamera, setSelectedCamera] = useState(1);
|
||||
const [cameras, setCameras] = useState<Camera[]>([]);
|
||||
|
||||
const cameras = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Dikimevi İstasyonu - Ana Giriş',
|
||||
location: 'Dikimevi',
|
||||
videoUrl: 'https://www.youtube.com/embed/b9q88QDEcKg?autoplay=1',
|
||||
status: 'online',
|
||||
viewers: 1243
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Tuzluçayır İstasyonu - İnşaat Sahası',
|
||||
location: 'Tuzluçayır',
|
||||
videoUrl: 'https://www.youtube.com/embed/b9q88QDEcKg?autoplay=1',
|
||||
status: 'online',
|
||||
viewers: 856
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: 'A2 Metro Hattı - Tünel Kazı Çalışması',
|
||||
location: 'Mamak',
|
||||
videoUrl: 'https://www.youtube.com/embed/b9q88QDEcKg?autoplay=1',
|
||||
status: 'online',
|
||||
viewers: 2134
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: 'İstasyon Binası İç Mekan',
|
||||
location: 'Dikimevi',
|
||||
videoUrl: 'https://www.youtube.com/embed/b9q88QDEcKg?autoplay=1',
|
||||
status: 'online',
|
||||
viewers: 534
|
||||
useEffect(() => {
|
||||
const loadedCameras = dataStore.getCameras()
|
||||
.filter(cam => cam.status === 'online')
|
||||
.sort((a, b) => a.order - b.order);
|
||||
setCameras(loadedCameras);
|
||||
if (loadedCameras.length > 0) {
|
||||
setSelectedCamera(loadedCameras[0].id);
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
|
||||
const selectedCam = cameras.find(cam => cam.id === selectedCamera) || cameras[0];
|
||||
|
||||
if (!selectedCam) {
|
||||
return (
|
||||
<div className="min-h-screen bg-[#003366]">
|
||||
<Header />
|
||||
<main className="pt-32 pb-16">
|
||||
<div className="max-w-7xl mx-auto px-4 text-center">
|
||||
<p className="text-white text-xl">Şu anda aktif kamera bulunmamaktadır.</p>
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-[#003366]">
|
||||
<Header />
|
||||
@@ -92,13 +83,15 @@ export default function LiveStream() {
|
||||
{selectedCam.name}
|
||||
</h2>
|
||||
<div className="flex items-center space-x-4 text-sm text-gray-600">
|
||||
<div className="flex items-center space-x-1">
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 12a2 2 0 100-4 2 2 0 000 4z" />
|
||||
<path fillRule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clipRule="evenodd" />
|
||||
</svg>
|
||||
<span>{selectedCam.viewers.toLocaleString('tr-TR')} izleyici</span>
|
||||
</div>
|
||||
{selectedCam.viewers && (
|
||||
<div className="flex items-center space-x-1">
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 12a2 2 0 100-4 2 2 0 000 4z" />
|
||||
<path fillRule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clipRule="evenodd" />
|
||||
</svg>
|
||||
<span>{selectedCam.viewers.toLocaleString('tr-TR')} izleyici</span>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center space-x-1">
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clipRule="evenodd" />
|
||||
|
||||
Reference in New Issue
Block a user