feat: responsive UI, camera 4:3, animations and feedbacks
CD — Kai-Sa-Cam Deployment / deploy (push) Failing after 10s

- Responsive layout to fit PC/tablet/mobile without vertical scroll
- Smaller logo on mobile, dynamic heights (dvh), tighter spacing
- Switch camera to 1280x720 (16:9) MJPEG with higher framerate
- Keep logo unchanged size ratio per request
- Add animations: fade-in, pulse for recording/talk
- Add visual feedback on all actions (scale transforms)
- Improve glassmorphism and controls/media gallery UX
This commit is contained in:
2026-10-30 14:55:09 +01:00
parent fa73617d53
commit 067d9dc21a
6 changed files with 73 additions and 45 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ rtsp:
streams:
webcam:
- "exec:ffmpeg -hide_banner -loglevel info -f v4l2 -video_size 640x480 -framerate 15 -i /dev/video0 -thread_queue_size 512 -f pulse -i default -c:v libx264 -preset ultrafast -tune zerolatency -profile:v baseline -pix_fmt yuv420p -g 30 -af volume=6,alimiter=limit=0.9 -c:a aac -b:a 64k -rtsp_transport tcp -f rtsp {output}"
- "exec:ffmpeg -hide_banner -loglevel info -f v4l2 -video_size 1280x720 -framerate 30 -input_format mjpeg -i /dev/video0 -thread_queue_size 512 -f pulse -i default -c:v libx264 -preset ultrafast -tune zerolatency -profile:v baseline -pix_fmt yuv420p -g 30 -af volume=6,alimiter=limit=0.9 -c:a aac -b:a 64k -rtsp_transport tcp -f rtsp {output}"
ffmpeg:
global: "-hide_banner -loglevel warning"
+15 -15
View File
@@ -81,21 +81,21 @@ export function App() {
};
return (
<div className="min-h-screen flex flex-col">
<section className="relative mx-auto w-[95%] h-[90vh] mt-[3vh]">
<header className="absolute z-[2] top-0 left-0 flex items-center">
<div className="h-screen max-h-screen overflow-hidden flex flex-col">
<section className="relative mx-auto w-[96%] h-[96vh] max-h-[96vh] mt-[2vh] flex flex-col">
<header className="relative z-[2] flex items-center shrink-0">
<img
src="/logo.png"
alt="Logo"
className="h-[10vh] object-contain drop-shadow-[0px_4px_20px_rgba(0,0,0,0.25)]"
className="h-[6vh] sm:h-[7vh] md:h-[8vh] max-h-[70px] object-contain drop-shadow-[0px_4px_20px_rgba(0,0,0,0.25)]"
/>
</header>
{sessionExpired && (
<div className="absolute z-[3] top-[calc(10vh+0.75rem)] left-0 right-0 glass-card px-6 py-2 flex items-center justify-between rounded-[50px] text-base">
<div className="absolute z-[3] top-[calc(6vh+0.5rem)] sm:top-[calc(7vh+0.5rem)] md:top-[calc(8vh+0.5rem)] left-0 right-0 glass-card px-4 sm:px-6 py-1.5 sm:py-2 flex items-center justify-between rounded-[50px] text-sm sm:text-base animate-fade-in">
<span>Session expirée.</span>
<button
className="glass-button px-4 py-1 rounded-[50px] text-base font-medium"
className="glass-button px-3 sm:px-4 py-1 rounded-[50px] text-sm sm:text-base font-medium transition-transform active:scale-95"
onClick={() => reauthenticate().catch(() => {})}
>
Se reconnecter
@@ -103,10 +103,10 @@ export function App() {
</div>
)}
<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">
<main className="flex-1 flex flex-col min-h-0">
<nav className="mx-auto mt-[1vh] sm:mt-[1.5vh] flex gap-2 trans-bloc p-1 rounded-[50px] w-fit shrink-0">
<button
className={`px-10 py-2.5 rounded-[50px] text-base md:text-lg transition-all ${
className={`px-6 sm:px-8 md:px-10 py-1.5 sm:py-2 md:py-2.5 rounded-[50px] text-sm sm:text-base md:text-lg transition-all active:scale-95 ${
activeTab === "live"
? "glass-button font-medium"
: "bg-transparent hover:opacity-80"
@@ -116,7 +116,7 @@ export function App() {
Live
</button>
<button
className={`px-10 py-2.5 rounded-[50px] text-base md:text-lg transition-all ${
className={`px-6 sm:px-8 md:px-10 py-1.5 sm:py-2 md:py-2.5 rounded-[50px] text-sm sm:text-base md:text-lg transition-all active:scale-95 ${
activeTab === "media"
? "glass-button font-medium"
: "bg-transparent hover:opacity-80"
@@ -128,8 +128,8 @@ export function App() {
</nav>
{activeTab === "live" ? (
<div className="flex-1 flex flex-col items-center gap-5 mt-5 px-2 overflow-auto no-scrollbar">
<div className="w-full flex-1 min-h-[55vh] rounded-[30px] overflow-hidden glass-card">
<div className="flex-1 flex flex-col items-center gap-2 sm:gap-3 md:gap-4 mt-2 sm:mt-3 px-1 sm:px-2 min-h-0">
<div className="w-full flex-1 min-h-0 rounded-[20px] sm:rounded-[30px] overflow-hidden glass-card animate-fade-in">
{/* Même origine => même session Access, plus de stream.esiah.dev.
Le key force le rechargement du flux après une reconnexion. */}
<VideoPlayer
@@ -137,7 +137,7 @@ export function App() {
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
/>
</div>
<div className="w-full max-w-6xl">
<div className="w-full max-w-6xl shrink-0">
<Controls
isRecording={isRecording}
recordingTime={recordingTime}
@@ -151,13 +151,13 @@ export function App() {
/>
</div>
{(recError || talkError) && (
<div className="text-red-400 text-base text-center px-4 error-message">
<div className="text-red-400 text-xs sm:text-sm text-center px-4 error-message animate-fade-in shrink-0">
{recError || talkError}
</div>
)}
</div>
) : (
<div className="flex-1 flex flex-col mt-5 px-2 overflow-auto no-scrollbar">
<div className="flex-1 flex flex-col mt-2 sm:mt-3 px-1 sm:px-2 min-h-0 overflow-auto no-scrollbar">
<MediaGallery />
</div>
)}
+11 -11
View File
@@ -28,14 +28,14 @@ export function Controls({
};
return (
<div className="glass-card p-5 rounded-[50px] flex flex-col md:flex-row items-center justify-between gap-5">
<div className="flex items-center gap-3">
<div className="glass-card p-2 sm:p-3 md:p-4 rounded-[30px] sm:rounded-[50px] flex flex-col sm:flex-row items-center justify-between gap-2 sm:gap-3 md:gap-4">
<div className="flex items-center gap-2 sm:gap-3 flex-wrap justify-center">
<button
onClick={onRecord}
disabled={disabled}
className={`px-7 py-2.5 rounded-[50px] text-base font-medium transition-all ${
className={`px-4 sm:px-5 md:px-7 py-1.5 sm:py-2 md:py-2.5 rounded-[50px] text-xs sm:text-sm md:text-base font-medium transition-all active:scale-95 ${
isRecording
? "bg-red-500/30 text-red-200 border border-red-400/40"
? "bg-red-500/40 text-red-100 border border-red-400/60 animate-pulse-slow"
: "glass-button"
}`}
>
@@ -46,15 +46,15 @@ export function Controls({
<button
onClick={onSnapshot}
disabled={disabled}
className="px-7 py-2.5 rounded-[50px] text-base font-medium glass-button"
className="px-4 sm:px-5 md:px-7 py-1.5 sm:py-2 md:py-2.5 rounded-[50px] text-xs sm:text-sm md:text-base font-medium glass-button active:scale-95 transition-transform"
>
Capture
</button>
</div>
<div className="flex items-center gap-5">
<div className="flex items-center gap-3">
<span className="text-sm opacity-80">Gain micro</span>
<div className="flex items-center gap-3 sm:gap-4 md:gap-5 flex-wrap justify-center">
<div className="flex items-center gap-2 sm:gap-3">
<span className="text-xs sm:text-sm opacity-80">Gain micro</span>
<input
type="range"
min="0.2"
@@ -62,15 +62,15 @@ export function Controls({
step="0.1"
value={gain}
onChange={(e) => onGainChange(Number(e.target.value))}
className="w-32 accent-white"
className="w-24 sm:w-28 md:w-32 accent-white cursor-pointer"
/>
</div>
<button
onClick={onTalk}
disabled={disabled}
className={`px-7 py-2.5 rounded-[50px] text-base font-medium transition-all ${
className={`px-4 sm:px-5 md:px-7 py-1.5 sm:py-2 md:py-2.5 rounded-[50px] text-xs sm:text-sm md:text-base font-medium transition-all active:scale-95 ${
isTalking
? "bg-blue-400/30 text-blue-100 border border-blue-300/40"
? "bg-blue-400/40 text-blue-100 border border-blue-300/60 animate-pulse-slow"
: "glass-button"
}`}
>
+17 -17
View File
@@ -75,32 +75,32 @@ 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 glass-card px-5 py-2.5 rounded-[50px]">
<span className="text-base opacity-80">{media.length} fichiers</span>
<div className="flex-1 flex flex-col p-2 sm:p-3 md:p-4 gap-2 sm:gap-3 md:gap-4 overflow-y-auto">
<div className="flex justify-between items-center glass-card px-3 sm:px-4 md:px-5 py-1.5 sm:py-2 md:py-2.5 rounded-[30px] sm:rounded-[50px] flex-wrap gap-2">
<span className="text-xs sm:text-sm md:text-base opacity-80">{media.length} fichiers</span>
<div className="flex gap-2">
<button
onClick={fetchMedia}
className="px-5 py-1.5 text-sm glass-button rounded-[50px]"
className="px-3 sm:px-4 md:px-5 py-1 sm:py-1.5 text-xs sm:text-sm glass-button rounded-[50px] active:scale-95 transition-transform"
>
Actualiser
</button>
{media.length > 0 && (
<button
onClick={handleExportAll}
className="px-5 py-1.5 text-sm glass-button rounded-[50px]"
className="px-3 sm:px-4 md:px-5 py-1 sm:py-1.5 text-xs sm:text-sm glass-button rounded-[50px] active:scale-95 transition-transform"
>
Tout télécharger et vider
</button>
)}
</div>
</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">
{error && <div className="text-red-400 text-xs sm:text-sm text-center error-message animate-fade-in">{error}</div>}
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 sm:gap-3 md:gap-4">
{media.map((item) => (
<div
key={item.filename}
className="glass-card rounded-[20px] overflow-hidden flex flex-col"
className="glass-card rounded-[16px] sm:rounded-[20px] overflow-hidden flex flex-col transition-transform hover:scale-[1.02] active:scale-[0.98]"
>
<div
className="relative aspect-video bg-black/40 flex items-center justify-center cursor-pointer"
@@ -116,21 +116,21 @@ export function MediaGallery() {
/>
)}
</div>
<div className="p-3 flex items-center justify-between gap-2">
<span className="text-xs truncate opacity-90">
<div className="p-2 sm:p-3 flex items-center justify-between gap-1 sm:gap-2">
<span className="text-[10px] sm: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-[50px]"
className="px-1.5 sm:px-2 py-0.5 sm:py-1 text-[10px] sm:text-xs glass-button rounded-[50px] active:scale-95 transition-transform"
>
DL
</a>
<button
onClick={() => setItemToDelete(item.filename)}
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"
className="px-1.5 sm:px-2 py-0.5 sm:py-1 text-[10px] sm:text-xs bg-red-500/30 text-red-100 rounded-[50px] hover:bg-red-500/40 transition-colors border border-red-400/40 active:scale-95"
>
Supprimer
</button>
@@ -141,7 +141,7 @@ export function MediaGallery() {
</div>
{itemToDelete && (
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4">
<div className="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-fade-in">
<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
@@ -152,13 +152,13 @@ export function MediaGallery() {
<div className="flex gap-2 justify-end">
<button
onClick={() => setItemToDelete(null)}
className="px-4 py-2 text-sm glass-button rounded-[50px]"
className="px-4 py-2 text-sm glass-button rounded-[50px] active:scale-95 transition-transform"
>
Annuler
</button>
<button
onClick={() => handleDelete(itemToDelete)}
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"
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 active:scale-95"
>
Confirmer
</button>
@@ -169,11 +169,11 @@ export function MediaGallery() {
{selectedItem && (
<div
className="fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-50 p-4"
className="fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-50 p-4 animate-fade-in"
onClick={() => setSelectedItem(null)}
>
<div
className="relative max-w-4xl w-full max-h-[90vh] flex items-center justify-center"
className="relative max-w-5xl w-full max-h-[90vh] flex items-center justify-center"
onClick={(e) => e.stopPropagation()}
>
{selectedItem.type === "video" ? (
+2 -1
View File
@@ -7,7 +7,8 @@ export function VideoPlayer({ streamUrl }: VideoPlayerProps) {
<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 scale-[1.02]"
className="w-full h-full border-none absolute inset-0"
style={{ objectFit: "contain" }}
allow="autoplay; encrypted-media; fullscreen"
title="Flux caméra"
/>
+27
View File
@@ -96,4 +96,31 @@ a {
-ms-overflow-style: none;
scrollbar-width: none;
}
.animate-fade-in {
animation: fade-in 0.3s ease-in-out;
}
.animate-pulse-slow {
animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
}
@keyframes fade-in {
from {
opacity: 0;
transform: translateY(-4px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes pulse-slow {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}