feat: new UI based on Camview style
CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 1m59s

This commit is contained in:
2026-10-28 18:16:30 +01:00
parent 2819002a7b
commit dc24709d7f
8 changed files with 169 additions and 108 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

+79 -62
View File
@@ -81,71 +81,88 @@ export function App() {
};
return (
<div className="min-h-screen bg-gray-900 text-white flex flex-col">
<header className="bg-gray-800 border-b border-gray-700 px-4 py-3 flex items-center justify-between">
<h1 className="text-xl font-semibold flex items-center gap-3">
<img src="/logo.png" alt="Logo" className="w-8 h-8 object-contain" />
Kai-Sa-Cam
</h1>
</header>
<div className="min-h-screen flex flex-col">
<section className="relative mx-auto w-[90%] h-[75vh] mt-[5vh]">
<header className="absolute z-[2] top-0 left-0 flex items-center">
<img
src="/logo.png"
alt="Logo"
className="h-[10vh] object-contain drop-shadow-[0px_4px_20px_rgba(0,0,0,0.25)]"
/>
</header>
{sessionExpired && (
<div className="bg-amber-600 text-white text-sm px-4 py-2 flex items-center justify-between">
<span>Session expirée.</span>
<button
className="underline font-medium"
onClick={() => reauthenticate().catch(() => {})}
>
Se reconnecter
</button>
</div>
)}
<main className="flex-1 flex flex-col">
<nav className="flex border-b border-gray-700 bg-gray-800">
<button
className={`flex-1 py-3 text-center font-medium ${activeTab === "live" ? "text-blue-400 border-b-2 border-blue-400" : "text-gray-400"}`}
onClick={() => setActiveTab("live")}
>
Live
</button>
<button
className={`flex-1 py-3 text-center font-medium ${activeTab === "media" ? "text-blue-400 border-b-2 border-blue-400" : "text-gray-400"}`}
onClick={() => setActiveTab("media")}
>
Médias
</button>
</nav>
{activeTab === "live" ? (
<div className="flex-1 flex flex-col p-4 gap-4 overflow-hidden">
{/* Même origine => même session Access, plus de stream.esiah.dev.
Le key force le rechargement du flux après une reconnexion. */}
<VideoPlayer
key={streamKey}
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
/>
<Controls
isRecording={isRecording}
recordingTime={recordingTime}
isTalking={isTalking}
gain={gain}
onGainChange={setGain}
onRecord={handleRecord}
onSnapshot={handleSnapshot}
onTalk={handleTalk}
disabled={Boolean(recError || talkError)}
/>
{(recError || talkError) && (
<div className="text-red-400 text-sm text-center px-4">
{recError || talkError}
</div>
)}
{sessionExpired && (
<div className="absolute z-[3] top-[calc(10vh+1rem)] left-0 right-0 glass-card px-6 py-2 flex items-center justify-between rounded-[50px] text-sm">
<span>Session expirée.</span>
<button
className="glass-button px-4 py-1 rounded-[50px] text-sm font-medium"
onClick={() => reauthenticate().catch(() => {})}
>
Se reconnecter
</button>
</div>
) : (
<MediaGallery />
)}
</main>
<main className="absolute inset-0 flex flex-col">
<nav className="mx-auto mt-[12vh] flex gap-2 trans-bloc p-1 rounded-[50px] w-fit">
<button
className={`px-8 py-2 rounded-[50px] text-sm md:text-base transition-all ${
activeTab === "live"
? "glass-button font-medium"
: "bg-transparent hover:opacity-80"
}`}
onClick={() => setActiveTab("live")}
>
Live
</button>
<button
className={`px-8 py-2 rounded-[50px] text-sm md:text-base transition-all ${
activeTab === "media"
? "glass-button font-medium"
: "bg-transparent hover:opacity-80"
}`}
onClick={() => setActiveTab("media")}
>
Médias
</button>
</nav>
{activeTab === "live" ? (
<div className="flex-1 flex flex-col items-center gap-4 mt-4 px-2 overflow-auto no-scrollbar">
<div className="w-full h-[50vh] rounded-[30px] overflow-hidden glass-card">
{/* Même origine => même session Access, plus de stream.esiah.dev.
Le key force le rechargement du flux après une reconnexion. */}
<VideoPlayer
key={streamKey}
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
/>
</div>
<div className="w-full max-w-4xl">
<Controls
isRecording={isRecording}
recordingTime={recordingTime}
isTalking={isTalking}
gain={gain}
onGainChange={setGain}
onRecord={handleRecord}
onSnapshot={handleSnapshot}
onTalk={handleTalk}
disabled={Boolean(recError || talkError)}
/>
</div>
{(recError || talkError) && (
<div className="text-red-400 text-sm text-center px-4 error-message">
{recError || talkError}
</div>
)}
</div>
) : (
<div className="flex-1 flex flex-col mt-4 px-2 overflow-auto no-scrollbar">
<MediaGallery />
</div>
)}
</main>
</section>
</div>
);
}
+10 -10
View File
@@ -28,15 +28,15 @@ export function Controls({
};
return (
<div className="glass-card p-4 rounded-2xl flex flex-col md:flex-row items-center justify-between gap-4">
<div className="glass-card p-4 rounded-[50px] flex flex-col md:flex-row items-center justify-between gap-4">
<div className="flex items-center gap-3">
<button
onClick={onRecord}
disabled={disabled}
className={`px-4 py-2 rounded-xl text-sm font-medium transition-all ${
className={`px-6 py-2 rounded-[50px] text-sm font-medium transition-all ${
isRecording
? "bg-red-500/20 text-red-400 border border-red-500/30"
: "glass-button text-zinc-200"
? "bg-red-500/30 text-red-200 border border-red-400/40"
: "glass-button"
}`}
>
{isRecording
@@ -46,7 +46,7 @@ export function Controls({
<button
onClick={onSnapshot}
disabled={disabled}
className="px-4 py-2 rounded-xl text-sm font-medium glass-button text-zinc-200 hover:text-white"
className="px-6 py-2 rounded-[50px] text-sm font-medium glass-button"
>
Capture
</button>
@@ -54,7 +54,7 @@ export function Controls({
<div className="flex items-center gap-4">
<div className="flex items-center gap-2">
<span className="text-xs text-zinc-400">Gain micro</span>
<span className="text-xs opacity-80">Gain micro</span>
<input
type="range"
min="0.2"
@@ -62,16 +62,16 @@ export function Controls({
step="0.1"
value={gain}
onChange={(e) => onGainChange(Number(e.target.value))}
className="w-28 accent-blue-500"
className="w-28 accent-white"
/>
</div>
<button
onClick={onTalk}
disabled={disabled}
className={`px-4 py-2 rounded-xl text-sm font-medium transition-all ${
className={`px-6 py-2 rounded-[50px] text-sm font-medium transition-all ${
isTalking
? "bg-blue-500/20 text-blue-400 border border-blue-500/30"
: "glass-button text-zinc-200"
? "bg-blue-400/30 text-blue-100 border border-blue-300/40"
: "glass-button"
}`}
>
{isTalking ? "Parler (Actif)" : "Parler"}
+16 -16
View File
@@ -76,31 +76,31 @@ export function MediaGallery() {
return (
<div className="flex-1 flex flex-col p-4 gap-4 overflow-y-auto">
<div className="flex justify-between items-center">
<span className="text-sm text-zinc-400">{media.length} fichiers</span>
<div className="flex justify-between items-center glass-card px-4 py-2 rounded-[50px]">
<span className="text-sm opacity-80">{media.length} fichiers</span>
<div className="flex gap-2">
<button
onClick={fetchMedia}
className="px-3 py-2 text-xs glass-button rounded-xl text-zinc-200 hover:text-white"
className="px-4 py-1 text-xs glass-button rounded-[50px]"
>
Actualiser
</button>
{media.length > 0 && (
<button
onClick={handleExportAll}
className="px-4 py-2 text-xs glass-button rounded-xl text-zinc-200 hover:text-white"
className="px-4 py-1 text-xs glass-button rounded-[50px]"
>
Tout télécharger et vider
</button>
)}
</div>
</div>
{error && <div className="text-red-400 text-sm text-center">{error}</div>}
{error && <div className="text-red-400 text-sm text-center error-message">{error}</div>}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
{media.map((item) => (
<div
key={item.filename}
className="glass-card rounded-xl overflow-hidden flex flex-col"
className="glass-card rounded-[20px] overflow-hidden flex flex-col"
>
<div
className="relative aspect-video bg-black/40 flex items-center justify-center cursor-pointer"
@@ -117,20 +117,20 @@ export function MediaGallery() {
)}
</div>
<div className="p-3 flex items-center justify-between gap-2">
<span className="text-xs truncate text-zinc-300">
<span className="text-xs truncate opacity-90">
{item.filename}
</span>
<div className="flex gap-1">
<a
href={item.url}
download={item.filename}
className="px-2 py-1 text-xs glass-button rounded-lg text-zinc-300 hover:text-white"
className="px-2 py-1 text-xs glass-button rounded-[50px]"
>
DL
</a>
<button
onClick={() => setItemToDelete(item.filename)}
className="px-2 py-1 text-xs bg-red-500/20 text-red-400 rounded-lg hover:bg-red-500/30 transition-colors"
className="px-2 py-1 text-xs bg-red-500/30 text-red-100 rounded-[50px] hover:bg-red-500/40 transition-colors border border-red-400/40"
>
Supprimer
</button>
@@ -142,23 +142,23 @@ export function MediaGallery() {
{itemToDelete && (
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4">
<div className="glass-card p-6 rounded-2xl max-w-sm w-full flex flex-col gap-4 border border-white/10">
<h3 className="text-lg font-semibold text-white">
<div className="glass-card p-6 rounded-[30px] max-w-sm w-full flex flex-col gap-4">
<h3 className="text-lg font-semibold">
Confirmer la suppression
</h3>
<p className="text-sm text-zinc-400">
<p className="text-sm opacity-80">
Voulez-vous vraiment supprimer ce fichier ?
</p>
<div className="flex gap-2 justify-end">
<button
onClick={() => setItemToDelete(null)}
className="px-4 py-2 text-sm glass-button rounded-xl text-zinc-300"
className="px-4 py-2 text-sm glass-button rounded-[50px]"
>
Annuler
</button>
<button
onClick={() => handleDelete(itemToDelete)}
className="px-4 py-2 text-sm bg-red-500 text-white rounded-xl hover:bg-red-600 transition-colors"
className="px-4 py-2 text-sm bg-red-500/40 text-red-100 rounded-[50px] hover:bg-red-500/50 transition-colors border border-red-400/40"
>
Confirmer
</button>
@@ -181,13 +181,13 @@ export function MediaGallery() {
src={selectedItem.url}
controls
autoPlay
className="max-w-full max-h-[85vh] rounded-2xl"
className="max-w-full max-h-[85vh] rounded-[30px] glass-card"
/>
) : (
<img
src={selectedItem.url}
alt={selectedItem.filename}
className="max-w-full max-h-[85vh] rounded-2xl object-contain"
className="max-w-full max-h-[85vh] rounded-[30px] glass-card object-contain"
/>
)}
</div>
+1 -1
View File
@@ -4,7 +4,7 @@ interface VideoPlayerProps {
export function VideoPlayer({ streamUrl }: VideoPlayerProps) {
return (
<div className="flex-1 min-h-[300px] relative bg-black rounded-lg overflow-hidden flex items-center justify-center">
<div className="w-full h-full relative bg-black overflow-hidden flex items-center justify-center">
<iframe
src={streamUrl}
className="w-full h-full border-none absolute inset-0"
+63 -19
View File
@@ -2,41 +2,85 @@
@tailwind components;
@tailwind utilities;
@font-face {
font-family: Poppins;
src: url(/Fonts/Poppins/Poppins-Light.ttf);
}
@font-face {
font-family: ReemKufi;
src: url(/Fonts/ReemKufi/reem-kufi-regular.ttf);
}
* {
box-sizing: border-box;
}
:root {
--primary-color: #ededed;
--accent-color: #ededed50;
}
body {
margin: 0;
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
Arial, sans-serif;
background: #09090b;
color: #f4f4f5;
font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
background-image: url(/background_img.jpg);
background-size: cover;
background-position: center;
background-attachment: fixed;
background-color: #000;
color: var(--primary-color);
overflow-x: hidden;
}
button {
font-family: Poppins, sans-serif;
}
a {
text-decoration: none;
color: var(--primary-color);
}
@layer utilities {
.glass {
background: rgba(255, 255, 255, 0.03);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.08);
background: rgba(237, 237, 237, 0.12);
backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.glass-card {
background: rgba(24, 24, 27, 0.6);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(237, 237, 237, 0.12);
backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px);
border: 1px solid rgba(255, 255, 255, 0.12);
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.25);
}
.glass-button {
background: rgba(255, 255, 255, 0.05);
background: rgba(237, 237, 237, 0.2);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
transition: all 0.2s ease;
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.18);
transition: all 0.4s ease;
color: var(--primary-color);
box-shadow: 0px 4px 20px 0px rgba(0, 0, 0, 0.25);
}
.glass-button:hover {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.2);
.glass-button:hover:not(:disabled) {
cursor: pointer;
opacity: 0.8;
background: rgba(237, 237, 237, 0.28);
}
.glass-button:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.trans-bloc {
background: rgba(237, 237, 237, 0.12);
backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 250px;
}
.no-scrollbar::-webkit-scrollbar {
display: none;