From 9fe790ed9c37c407082d01efe46449f105c2aa23 Mon Sep 17 00:00:00 2001 From: E Date: Sun, 7 Mar 2021 21:58:36 -0700 Subject: [PATCH] dank swag pop and lolz --- client/src/pages/Session.tsx | 8 ++-- client/src/pages/SessionPictures.tsx | 66 ++++++++++++++++++---------- 2 files changed, 47 insertions(+), 27 deletions(-) diff --git a/client/src/pages/Session.tsx b/client/src/pages/Session.tsx index 4d73cce..49aa764 100644 --- a/client/src/pages/Session.tsx +++ b/client/src/pages/Session.tsx @@ -23,16 +23,17 @@ export const Session = (props: Props) => { const [active, setActive] = useState(false) const handleStartSession = async () => { - await startSession(clientId) message.loading('Photo sequence starting! Stand by...') + await startSession(clientId) setActive(true) } const handleRestartSession = async () => { setActive(false) - message.loading('Removing all photos...') + message.loading( + 'Deleting photos & restarting capture sequence! Stand by...', + ) await restartSession(clientId) - message.loading('Restarting capture sequence! Stand by...') setActive(true) } @@ -42,6 +43,7 @@ export const Session = (props: Props) => { const handleNuke = async () => { await killSession(clientId) + message.success('Photos Deleted! Going back to dashboard') history.push('/') } diff --git a/client/src/pages/SessionPictures.tsx b/client/src/pages/SessionPictures.tsx index f9f3af8..c057b61 100644 --- a/client/src/pages/SessionPictures.tsx +++ b/client/src/pages/SessionPictures.tsx @@ -1,9 +1,7 @@ import React, { useEffect, useState } from 'react' -import { Card, Spin } from 'antd' +import { Card, Modal, Spin } from 'antd' import { getSession } from '../api' -import { client } from '../data' import settings from '../settings' -import { url } from 'inspector' type Props = { clientId: string @@ -11,6 +9,7 @@ type Props = { export const SessionPictures = ({ clientId }: Props) => { const [urls, setUrls] = useState(null) + const [activeUrl, setActiveUrl] = useState(null) useEffect(() => { const get = async () => { @@ -20,36 +19,55 @@ export const SessionPictures = ({ clientId }: Props) => { if (photos.length) setUrls(photos) } - const interval = setInterval(get, 5000) + const interval = setInterval(get, 250) return () => clearInterval(interval) }, [clientId, urls]) + const closeModal = () => setActiveUrl(null) + const host = settings.env === 'jank' ? 'http://192.168.1.107:5000' : '' if (!urls?.length) return null return ( -
-

Session Pictures

-
- {urls ? ( - urls - .sort((a, b) => a.split('_')[0].localeCompare(b.split('_')[0])) - .map((src) => ( - - lol - - )) - ) : ( - - )} + <> + + large image + +
+

Session Pictures

+
+ {urls ? ( + urls + .sort((a, b) => a.split('_')[0].localeCompare(b.split('_')[0])) + .map((src) => ( + + setActiveUrl(src)} + key={src} + id={src} + src={`${host}/output/${clientId}/${src}`} + alt="lol" + /> + + )) + ) : ( + + )} +
-
+ ) }