feat: tab slide animation, hover feedback, snapshot toast
CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 10s
CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 10s
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 132 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 383 KiB |
+65
-39
@@ -19,6 +19,7 @@ export function App() {
|
|||||||
const [snapshots, setSnapshots] = useState<string[]>([]);
|
const [snapshots, setSnapshots] = useState<string[]>([]);
|
||||||
const [sessionExpired, setSessionExpired] = useState(false);
|
const [sessionExpired, setSessionExpired] = useState(false);
|
||||||
const [streamKey, setStreamKey] = useState(0);
|
const [streamKey, setStreamKey] = useState(0);
|
||||||
|
const [toast, setToast] = useState<string | null>(null);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
startRecording,
|
startRecording,
|
||||||
@@ -70,8 +71,12 @@ export function App() {
|
|||||||
if (!res.ok) throw new Error("Snapshot failed");
|
if (!res.ok) throw new Error("Snapshot failed");
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setSnapshots((prev) => [data.filename, ...prev]);
|
setSnapshots((prev) => [data.filename, ...prev]);
|
||||||
|
setToast("Capture d'écran prise");
|
||||||
|
setTimeout(() => setToast(null), 2000);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Snapshot error:", e);
|
console.error("Snapshot error:", e);
|
||||||
|
setToast("Erreur lors de la capture");
|
||||||
|
setTimeout(() => setToast(null), 2000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,23 +108,33 @@ export function App() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<main className="flex-1 flex flex-col min-h-0">
|
<main className="flex-1 flex flex-col min-h-0 relative">
|
||||||
<nav className="mx-auto mt-[1vh] sm:mt-[1.5vh] flex gap-2 trans-bloc p-1 rounded-[50px] w-fit shrink-0">
|
{toast && (
|
||||||
|
<div className="absolute top-2 right-2 z-50 glass-card px-4 py-2 rounded-[50px] text-sm animate-fade-in">
|
||||||
|
{toast}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<nav className="mx-auto mt-[1vh] sm:mt-[1.5vh] flex gap-2 trans-bloc p-1 rounded-[50px] w-fit shrink-0 relative overflow-hidden">
|
||||||
|
<div
|
||||||
|
className={`absolute top-1 bottom-1 w-[calc(50%-4px)] rounded-[50px] glass-button transition-transform duration-300 ease-in-out ${
|
||||||
|
activeTab === "media" ? "translate-x-[calc(100%+4px)]" : "translate-x-0"
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
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 ${
|
className={`relative z-10 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"
|
activeTab === "live"
|
||||||
? "glass-button font-medium"
|
? "font-medium"
|
||||||
: "bg-transparent hover:opacity-80"
|
: "hover:bg-white/5"
|
||||||
}`}
|
}`}
|
||||||
onClick={() => setActiveTab("live")}
|
onClick={() => setActiveTab("live")}
|
||||||
>
|
>
|
||||||
Live
|
Live
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
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 ${
|
className={`relative z-10 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"
|
activeTab === "media"
|
||||||
? "glass-button font-medium"
|
? "font-medium"
|
||||||
: "bg-transparent hover:opacity-80"
|
: "hover:bg-white/5"
|
||||||
}`}
|
}`}
|
||||||
onClick={() => setActiveTab("media")}
|
onClick={() => setActiveTab("media")}
|
||||||
>
|
>
|
||||||
@@ -127,40 +142,51 @@ export function App() {
|
|||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{activeTab === "live" ? (
|
<div className="flex-1 min-h-0 relative overflow-hidden">
|
||||||
<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
|
||||||
<div className="w-full flex-1 min-h-0 rounded-[20px] sm:rounded-[30px] overflow-hidden glass-card animate-fade-in">
|
className={`absolute inset-0 flex flex-col transition-transform duration-300 ease-in-out ${
|
||||||
{/* Même origine => même session Access, plus de stream.esiah.dev.
|
activeTab === "live" ? "translate-x-0" : "-translate-x-full"
|
||||||
Le key force le rechargement du flux après une reconnexion. */}
|
}`}
|
||||||
<VideoPlayer
|
>
|
||||||
key={streamKey}
|
<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">
|
||||||
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
|
<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.
|
||||||
</div>
|
Le key force le rechargement du flux après une reconnexion. */}
|
||||||
<div className="w-full max-w-6xl shrink-0">
|
<VideoPlayer
|
||||||
<Controls
|
key={streamKey}
|
||||||
isRecording={isRecording}
|
streamUrl="/go2rtc/stream.html?src=webcam&mode=mse"
|
||||||
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-xs sm:text-sm text-center px-4 error-message animate-fade-in shrink-0">
|
|
||||||
{recError || talkError}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
<div className="w-full max-w-6xl shrink-0">
|
||||||
|
<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-xs sm:text-sm text-center px-4 error-message animate-fade-in shrink-0">
|
||||||
|
{recError || talkError}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
<div
|
||||||
<div className="flex-1 flex flex-col mt-2 sm:mt-3 px-1 sm:px-2 min-h-0 overflow-auto no-scrollbar">
|
className={`absolute inset-0 flex flex-col transition-transform duration-300 ease-in-out ${
|
||||||
<MediaGallery />
|
activeTab === "media" ? "translate-x-0" : "translate-x-full"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<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>
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ body {
|
|||||||
"Helvetica Neue",
|
"Helvetica Neue",
|
||||||
Arial,
|
Arial,
|
||||||
sans-serif;
|
sans-serif;
|
||||||
background-image: url(/background_img.png);
|
background-image: url(/background_img.jpeg);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
|
|||||||
Reference in New Issue
Block a user