master
parent
11cf67b594
commit
d1e5b0310b
16 changed files with 29421 additions and 10115 deletions
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
@ -0,0 +1,23 @@ |
|||||||
|
import { Client } from '../types' |
||||||
|
|
||||||
|
export const clients: Client[] = [ |
||||||
|
{ |
||||||
|
name: 'Elijah', |
||||||
|
email: 'elijah@elijah.com', |
||||||
|
phone: 4039876543, |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: 'Tanner', |
||||||
|
email: 'tanner@tanner.com', |
||||||
|
phone: 4031234567, |
||||||
|
activeSession: true, |
||||||
|
}, |
||||||
|
] |
||||||
|
export const client: Client = clients[0] |
||||||
|
|
||||||
|
export const session = [ |
||||||
|
'/images/1.jpg', |
||||||
|
'/images/2.jpg', |
||||||
|
'/images/3.jpg', |
||||||
|
'/images/4.jpg', |
||||||
|
] |
@ -1,15 +1,43 @@ |
|||||||
import React from 'react' |
import axios from 'axios' |
||||||
import { useEffect } from 'react' |
import React, { useEffect, useState } from 'react' |
||||||
import { RouteComponentProps } from 'react-router-dom' |
import { RouteComponentProps, useHistory } from 'react-router-dom' |
||||||
|
import { getClient, killSession } from '../api' |
||||||
|
import { SessionPictures } from './SessionPictures' |
||||||
|
|
||||||
type Props = RouteComponentProps<{ clientId: string }> |
type Props = RouteComponentProps<{ clientId: string }> |
||||||
|
|
||||||
export const Session = (props: Props) => { |
export const Session = (props: Props) => { |
||||||
|
const history = useHistory() |
||||||
const { clientId } = props.match.params |
const { clientId } = props.match.params |
||||||
|
|
||||||
const [submitted, setSubmitted] = useState(false) |
const [submitted, setSubmitted] = useState(false) |
||||||
|
|
||||||
useEffect(() => {}) |
const handleExit = async () => { |
||||||
|
history.push('/') |
||||||
|
} |
||||||
|
|
||||||
|
const handleNuke = async () => { |
||||||
|
await killSession(clientId) |
||||||
|
history.push('/') |
||||||
|
} |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
const get = async () => { |
||||||
|
const { activeSession } = await getClient(clientId) |
||||||
|
if (activeSession) setSubmitted(true) |
||||||
|
} |
||||||
|
|
||||||
|
get() |
||||||
|
}) |
||||||
|
|
||||||
return <div>Session {clientId}</div> |
return ( |
||||||
|
<div> |
||||||
|
<h1>Session for {clientId}</h1> |
||||||
|
<button>Capture</button> |
||||||
|
{submitted && <SessionPictures clientId={clientId} />} |
||||||
|
<div className="controls"> |
||||||
|
<button onClick={handleNuke}>Nuke Session</button> |
||||||
|
<button onClick={handleExit}>Exit Session</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
) |
||||||
} |
} |
||||||
|
@ -0,0 +1,29 @@ |
|||||||
|
import React, { useEffect, useState } from 'react' |
||||||
|
import { getSession } from '../api' |
||||||
|
|
||||||
|
type Props = { |
||||||
|
clientId: string |
||||||
|
} |
||||||
|
|
||||||
|
export const SessionPictures = ({ clientId }: Props) => { |
||||||
|
const [pics, setPics] = useState<string[] | null>(null) |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
const get = async () => { |
||||||
|
if (pics) return |
||||||
|
const previewPics = await getSession(clientId) |
||||||
|
if (previewPics) setPics(previewPics) |
||||||
|
} |
||||||
|
|
||||||
|
const interval = setInterval(get, 300) |
||||||
|
|
||||||
|
return () => clearInterval(interval) |
||||||
|
}, [clientId, pics]) |
||||||
|
|
||||||
|
return ( |
||||||
|
<div> |
||||||
|
<h3>Session Pictures</h3> |
||||||
|
{pics && pics.map((src) => <img id={src} src={src} />)} |
||||||
|
</div> |
||||||
|
) |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
export default { |
export default { |
||||||
apiUrl: "http://localhost/api", |
env: 'jank', |
||||||
port: 4442, |
port: 4442, |
||||||
}; |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue