diff --git a/app/(interactive)/match-list/page.js b/app/(interactive)/match-list/page.js index 2b11785..da501b8 100644 --- a/app/(interactive)/match-list/page.js +++ b/app/(interactive)/match-list/page.js @@ -73,7 +73,9 @@ export default function MatchList() {
  • {match.name} - +
    + +
    setNewName(e.target.value)}/> diff --git a/app/(interactive)/match-list/tennisButtons.js b/app/(interactive)/match-list/tennisButtons.js deleted file mode 100644 index 59a75d9..0000000 --- a/app/(interactive)/match-list/tennisButtons.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -const TennisButtons = ({buttonVal,buttonName,onClick}) => { - // const [val, setVal] = useState(buttonVal); - - const handleClick = () => { - onClick(buttonVal); - }; - - - // Style object for the buttons - const buttonStyle = { - backgroundColor: '#0FADF7', // Cerulean blue color - color: 'white', // White text color - borderRadius: '10px', // Rounded corners - padding: '10px 20px', // Some padding - margin: '5px', // Margin between buttons - border: 'none', // No border - cursor: 'pointer', // Cursor pointer on hover - fontSize: '16px' // Font size - }; - - return ( -
    - -
    - ); -} - -export default TennisButtons; diff --git a/app/(interactive)/tag-match/[slug]/page.js b/app/(interactive)/tag-match/[slug]/page.js index f8a6c8d..fe09693 100644 --- a/app/(interactive)/tag-match/[slug]/page.js +++ b/app/(interactive)/tag-match/[slug]/page.js @@ -1,6 +1,6 @@ 'use client' -import React, { useState, useEffect, useRef } from 'react'; +import React, { useState, useEffect } from 'react'; import VideoPlayer from '../../../components/VideoPlayer'; import { getTaggerButtonData, columnNames } from '../../../services/taggerButtonData.js'; import styles from '../../../styles/TagMatch.module.css'; @@ -18,29 +18,31 @@ export default function TagMatch() { const [videoObject, setVideoObject] = useState(null); const [videoId, setVideoId] = useState(''); const [tableState, setTableState] = useState({ rows: [], activeRowIndex: null }); - const [currentPage, setCurrentPage] = useState('ServerName'); // TODO: the default should continue from what was filled in last + const [currentPage, setCurrentPage] = useState('PointScore'); // TODO: the default should continue from what was filled in last const [taggerHistory, setTaggerHistory] = useState([]); // Array to hold the history of states - const [isPublished, setIsPublished] = useState(false); // TODO: impliment this functionality (only show published matches) + const [isPublished, setIsPublished] = useState(false); // Customers can only see Published matches const [matchMetadata, setMatchMetadata] = useState({}); + const [serverName, setServerName] = useState("Player1"); + const [serverFarNear, setServerFarNear] = useState("Near"); + const [tiebreak, setTiebreak] = useState(false); const [popUp, setPopUp] = useState([]); - const [isVisible, setIsVisible] = useState(false); - const [displayPopUp, setDisplayPopUp] = useState(false); - const popUpTimerId = useRef(null); - const popUpRef = useRef(null); + const [isVisible, setIsVisible] = useState(true); // currently impossible to determine exact YouTube FPS: 24-60 FPS const FRAMERATE = 30; useEffect(() => { - console.log("line 23"); + window.addEventListener('keydown', handleKeyDown); + return () => { + window.removeEventListener('keydown', handleKeyDown); + } + }, [videoObject, videoId, tableState.rows, currentPage]) // TODO: the buttons should be in a different component + + useEffect(() => { getMatchInfo(matchId).then((matchDocument) => { setVideoId(matchDocument.videoId); - if (matchDocument.published) { - setIsPublished(true); - } else { - setIsPublished(false); - } + setIsPublished(matchDocument.published); if (matchDocument.points) { setTableState(oldTableState => { @@ -59,14 +61,8 @@ export default function TagMatch() { }); }, [matchId]); - const handleVideoIdChange = (event) => { - setVideoId(event.target.value); - }; - const handleKeyDown = (event) => { - if (!videoObject) { - return; - } + if (!videoObject) return; const keyActions = { " ": () => { @@ -119,6 +115,10 @@ export default function TagMatch() { }); }; + const getVideoTimestamp = () => { + return Math.round(videoObject.getCurrentTime() * 1000); + } + const convertToCSV = (data) => { const headers = Object.keys(data[0]); const rows = data.map(obj => @@ -145,13 +145,6 @@ export default function TagMatch() { URL.revokeObjectURL(url); } - useEffect(() => { - window.addEventListener('keydown', handleKeyDown); - return () => { - window.removeEventListener('keydown', handleKeyDown); - } - }, [videoObject, videoId, tableState.rows, currentPage]) // TODO: the buttons should be in a different component - const updateActiveRow = (key, value) => { setPopUp(popUp => { const message = `Updating: ${key} = ${value}`; @@ -211,11 +204,6 @@ export default function TagMatch() { pullAndPushRows(tableState.rows, rowToDeleteTimestamp); } - - const getVideoTimestamp = () => { - return Math.round(videoObject.getCurrentTime() * 1000); - } - const saveToHistory = () => { setTaggerHistory(taggerHistory => { // Add the new state to the history @@ -230,44 +218,6 @@ export default function TagMatch() { return updatedHistory; }); } - const showPopUp = () => { - if (displayPopUp) { - if (popUpTimerId.current) { - clearTimeout(popUpTimerId.current); - } - setIsVisible(true); - popUpTimerId.current = setTimeout(() => { - setPopUp(prevState => ({ ...prevState, isVisible: false })); - }, 3000); - } - else { - setIsVisible(false) - } - }; - //Change Font Size Based On Text Size - useEffect(() => { - const adjustFontSize = () => { - const popUpDiv = popUpRef.current; - if (!popUpDiv) return; - let currentFontSize = 16; - popUpDiv.style.fontSize = `${currentFontSize}px`; - while (popUpDiv.scrollHeight > popUpDiv.offsetHeight && currentFontSize > 8) { - currentFontSize--; - popUpDiv.style.fontSize = `${currentFontSize}px`; - } - }; - adjustFontSize(); - }, [popUp]); // Rerun when popUp changes - - const revealPopUp = async () => { - setDisplayPopUp(current => !current); // Toggle the state - } - useEffect(() => { - if (displayPopUp) { - showPopUp(); // Call showPopUp only after displayPopUp has changed - } - }, [displayPopUp]); - const pullAndPushRows = async (rowState, rowToDeleteTimestamp = null) => { try { @@ -336,7 +286,7 @@ export default function TagMatch() { } }; - // Toggle the publushed state of the match + // Toggle the published state of the match const togglePublish = async () => { pullAndPushRows(tableState.rows, null); try { @@ -379,7 +329,12 @@ export default function TagMatch() { }; // This pulls the button data from the taggerButtonData.js file - const buttonData = getTaggerButtonData(updateActiveRow, addNewRowAndSync, setCurrentPage); + const buttonData = getTaggerButtonData(updateActiveRow, addNewRowAndSync, setCurrentPage, + { + serverName, + serverFarNear, + tiebreak + }); const handleImageClick = (event) => { console.log("event: ", event); @@ -423,18 +378,14 @@ export default function TagMatch() { return (
    -
    +
    - {/* temporary means to select video (should it be a form?) */} - - - - +

    {currentPage}

    @@ -454,7 +405,6 @@ export default function TagMatch() { data.activeRowIndex = tableState.activeRowIndex; data.videoTimestamp = getVideoTimestamp(); button.action(data); - showPopUp(); }} />
    ) : ( @@ -466,16 +416,36 @@ export default function TagMatch() { data.activeRowIndex = tableState.activeRowIndex; data.videoTimestamp = getVideoTimestamp(); button.action(data); - showPopUp(); }}> {button.label} ); })}
    -
    +
    +
    +

    Current Server: {serverName}

    + +
    + +
    +

    Current Side: {serverFarNear}

    + +
    + +
    +

    Tiebreak: {tiebreak.toString()}

    + +
    + {isVisible && popUp.length > 0 && ( -
    +

    Altered Rows:

    {popUp.map((message, index) => (

    {message}

    diff --git a/app/(interactive)/tag-match/page.js b/app/(interactive)/timestamp-tagger/page.js similarity index 97% rename from app/(interactive)/tag-match/page.js rename to app/(interactive)/timestamp-tagger/page.js index d4b9809..4ac828e 100644 --- a/app/(interactive)/tag-match/page.js +++ b/app/(interactive)/timestamp-tagger/page.js @@ -1,6 +1,7 @@ 'use client'; import React, { useState, useEffect, useRef } from 'react'; +import { useSearchParams } from 'next/navigation' import VideoPlayer from '../../components/VideoPlayer'; import styles from '../../styles/Tagging.module.css'; @@ -83,7 +84,13 @@ export default function TagMatch() { const [curTimeStart, setCurTimeStart] = useState(0); const FRAMERATE = 30; const inputRef = useRef(null); - + + const searchParams = useSearchParams() + + useEffect(() => { + setVideoId(searchParams.get('videoId')) + }, []); + const handleVideoIdChange = (event) => { setVideoId(event.target.value); }; @@ -214,13 +221,13 @@ export default function TagMatch() { return (
    - -
    + +
    diff --git a/app/services/asdf b/app/services/asdf deleted file mode 100644 index e69de29..0000000 diff --git a/app/services/taggerButtonData.js b/app/services/taggerButtonData.js index 10d2a9e..e0712a8 100644 --- a/app/services/taggerButtonData.js +++ b/app/services/taggerButtonData.js @@ -38,6 +38,7 @@ var player1SetScore = 0; var player2SetScore = 0; var player1GameScore = 0; var player2GameScore = 0; +var isAce = false; function updateScore(shotInRally, isWinner, serverName) { if ((shotInRally % 2 == 0) & @@ -130,7 +131,16 @@ isWinner == '1') { } } } -function chooseSide() { +function chooseSide({ tiebreak = false } = {}) { + if (tiebreak) { + if ((serverScore + returnerScore) % 2 == 0) { + return "Deuce"; + } + else + { + return "Ad"; + } + } if (serverScore == 40 || returnerScore == 40) { if ((serverScore + returnerScore) % 2 == 0) { return "Ad"; @@ -229,131 +239,203 @@ function updateTiebreakScore(shotInRally, isWinner, serverName) { } } } -function chooseTiebreakSide() { - if ((serverScore + returnerScore) % 2 == 0) { - return "Deuce"; - } - else - { - return "Ad"; - } -} -// function endPoint() { -// if (serverScore == 40 && returnerScore == 40) { -// setCurrentPage('PointScore'); -// } -// else { -// updateLastRow('serverFarNear', data.table[data.table.length - 1]['serverFarNear']); -// updateLastRow('serverName', data.table[data.table.length - 1]['serverName']); -// updateLastRow('pointScore', serverScore + '-' + returnerScore); -// updateLastRow('gameScore', player1GameScore + '-' + player2GameScore); -// updateLastRow('setScore', player1SetScore + '-' + player2SetScore); -// updateLastRow('isPointStart', 1); -// updateLastRow('shotInRally', 1); -// updateLastRow('side', chooseSide()); -// setCurrentPage('FirstServe'); -// } -// } -export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) => ({ - - 'ServerName': [ +export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage, toggledValues) => ({ + 'PointScore': [ { - label: 'Player1', - action: () => { + label: '0-0', + action: (data) => { addNewRow(); - updateActiveRow('serverName', 'Player1'); - setCurrentPage('ServerSide') + updateActiveRow('pointScore', '0-0'); + if (data.activeRowIndex > 1) { + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + } + else { + updateActiveRow('gameScore', '0-0'); + updateActiveRow('setScore', '0-0'); + } + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); } }, { - label: 'Player2', - action: () => { + label: '0-15', + action: (data) => { addNewRow(); - updateActiveRow('serverName', 'Player2'); - setCurrentPage('ServerSide') + updateActiveRow('pointScore', '0-15'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Ad'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); } }, - ], - 'ServerNameTiebreak': [ { - label: 'Player1', - action: () => { + label: '15-0', + action: (data) => { addNewRow(); - updateActiveRow('serverName', 'Player1'); - setCurrentPage('ServerSideTiebreak') + updateActiveRow('pointScore', '15-0'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Ad'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); } }, { - label: 'Player2', - action: () => { + label: '15-15', + action: (data) => { addNewRow(); - updateActiveRow('serverName', 'Player2'); - setCurrentPage('ServerSideTiebreak') + updateActiveRow('pointScore', '15-15'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); } }, - ], - 'ServerSide': [ { - label: 'NearSide', - action: () => { - updateActiveRow('serverFarNear', 'Near'); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); + label: '30-0', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '30-0'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); updateActiveRow('isPointStart', 1); updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); - //setCurrentPage('PointScore') } }, { - label: 'FarSide', - action: () => { - updateActiveRow('serverFarNear', 'Far'); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); + label: '0-30', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '0-30'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); updateActiveRow('isPointStart', 1); updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); - // setCurrentPage('PointScore') } }, - ], - 'ServerSideTiebreak': [ { - label: 'NearSide', + label: '30-15', action: (data) => { - updateActiveRow('pointScore', serverScore + '-' + returnerScore); + addNewRow(); + updateActiveRow('pointScore', '30-15'); updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); updateActiveRow('isPointStart', 1); updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseTiebreakSide()); + updateActiveRow('side', 'Ad'); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); } }, { - label: 'FarSide', + label: '15-30', action: (data) => { - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); + addNewRow(); + updateActiveRow('pointScore', '15-30'); updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); updateActiveRow('isPointStart', 1); updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseTiebreakSide()); + updateActiveRow('side', 'Ad'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); + } + }, + { + label: '30-30', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '30-30'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); + } + }, + { + label: '40-15', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '40-15'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Deuce'); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); + } + }, + { + label: '15-40', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '15-40'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Deuce'); + updateActiveRow('isBreakPoint', 1); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); + } + }, + { + label: '30-40', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '15-40'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Ad'); + updateActiveRow('isBreakPoint', 1); + updateActiveRow('pointStartTime', data.videoTimestamp); + setCurrentPage('FirstServe'); + } + }, + { + label: '40-30', + action: (data) => { + addNewRow(); + updateActiveRow('pointScore', '15-40'); + updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); + updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); + updateActiveRow('isPointStart', 1); + updateActiveRow('shotInRally', 1); + updateActiveRow('side', 'Ad'); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); } }, - ], - 'PointScore': [ { label: '40-40 (Ad Side)', action: (data) => { + addNewRow(); updateActiveRow('pointScore', '40-40'); updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); @@ -361,12 +443,14 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) updateActiveRow('shotInRally', 1); updateActiveRow('side', 'Ad'); updateActiveRow('isBreakPoint', 1); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); } }, { label: '40-40 (Deuce Side)', action: (data) => { + addNewRow(); updateActiveRow('pointScore', '40-40'); updateActiveRow('gameScore', data.table[data.activeRowIndex - 1]['gameScore']); updateActiveRow('setScore', data.table[data.activeRowIndex - 1]['setScore']); @@ -374,6 +458,7 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) updateActiveRow('shotInRally', 1); updateActiveRow('side', 'Deuce'); updateActiveRow('isBreakPoint', 1); + updateActiveRow('pointStartTime', data.videoTimestamp); setCurrentPage('FirstServe'); } }, @@ -382,21 +467,36 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) { label: 'Ace', action: () => { - updateActiveRow('isAce', '1'); - updateActiveRow('isPointEnd', '1'); - updateActiveRow('isWinner', '1'); - //setCurrentPage('PointScore') + isAce = true; } }, { courtImage: 'serve', label: 'Select First Serve Position', action: (data) => { + // newly added vars for coordinate checking + const serverName = toggledValues['serverName']; + const serverFarNear = toggledValues['serverFarNear']; + const serverSide = data.table[data.activeRowIndex]['side'] + // chooseSide({ tiebreak: toggledValues['tiebreak'] }); previous code for serverSide, will figure out tiebreaks later... + // serverName + updateActiveRow('serverName', serverName); + // serverSide + updateActiveRow('serverFarNear', serverFarNear); + // updateActiveRow('side', serverSide); + // check Ace after adding new row + if (isAce) { + updateActiveRow('isAce', '1'); + updateActiveRow('isPointEnd', '1'); + updateActiveRow('isWinner', '1'); + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + } + // First Serve Actions updateActiveRow('firstServeXCoord', data.x); - updateActiveRow('firstServeYCoord', data.y); + updateActiveRow('firstServeYCoord', data.y); // Depending on coordinates, fill location of serve, etc... - if (data.table[data.activeRowIndex]['serverFarNear'] == 'Near') { - if ((data.table[data.activeRowIndex])['side'] == 'Deuce') // split by side + if (serverFarNear == 'Near') { + if (serverSide == 'Deuce') // split by side { // Assuming coordinate range of x: 0-(-157), y: 0-245 if (data.x >= -157 & data.x < -101) @@ -405,35 +505,9 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce == '1') { + ace(serverName); + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -451,36 +525,9 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + if (isAce) { + setCurrentPage('PointScore'); + } else { setCurrentPage('GroundstrokeContact'); } @@ -497,36 +544,9 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + if (isAce) { + setCurrentPage('PointScore'); + } else { setCurrentPage('GroundstrokeContact'); } @@ -559,35 +579,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -605,35 +598,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -651,28 +617,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -702,7 +648,7 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) // FAR SIDE else { - if ((data.table[data.activeRowIndex])['side'] == 'Ad') // split by side + if (serverSide == 'Ad') // split by side { // Assuming coordinate range of x: 0-(-157), y: 0-245 if (data.x >= -157 & data.x < -105) @@ -711,35 +657,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -757,35 +676,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -803,35 +695,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -865,35 +730,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -911,35 +749,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -951,41 +762,14 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) setCurrentPage('SecondServe'); } } - else if (data.x > 105 & data.x <= 157) + else if (data.x > 105 & data.x <= 156) { updateActiveRow('firstServeZone', 'Wide'); if (data.y <= -10 & data.y >= -245) { updateActiveRow('firstServeIn', '1'); - if (data.table[data.activeRowIndex]['isAce'] == '1') { - ace(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) - { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - } - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } + if (isAce) { + setCurrentPage('PointScore'); } else { setCurrentPage('GroundstrokeContact'); @@ -1012,18 +796,30 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) } } } + // reset Ace var + isAce = false; } }, ], 'SecondServe': [ + { + label: 'Ace', + action: () => { + isAce = true; + } + }, { courtImage: 'serve', label: 'Select Second Serve Position', action: (data) => { updateActiveRow('secondServeXCoord', data.x); updateActiveRow('secondServeYCoord', data.y); - console.log(data.x); - console.log(data.y); + if (isAce) { + updateActiveRow('isAce', '1'); + updateActiveRow('isPointEnd', '1'); + updateActiveRow('isWinner', '1'); + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + } // Depending on coordinates, fill location of serve, etc... if (data.table[data.activeRowIndex]['serverFarNear'] == 'Near') { if ((data.table[data.activeRowIndex])['side'] == 'Deuce') // split by side @@ -1035,46 +831,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { setCurrentPage('GroundstrokeContact'); } + } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x >= -101 & data.x <= -54) @@ -1083,46 +852,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x > -54 & data.x <= 0) @@ -1131,46 +873,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else @@ -1185,40 +900,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) updateActiveRow('secondServeZone', 'Wide') } updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else // wide and T inverted for Ad side @@ -1229,46 +912,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x >= 55 & data.x <= 105) @@ -1277,45 +933,18 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x > 105 & data.x <= 157) @@ -1324,45 +953,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y >= 10 & data.y <= 245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else @@ -1376,40 +979,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) { updateActiveRow('secondServeZone', 'Wide') } - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } } @@ -1425,46 +996,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x >= -105 & data.x <= -52) @@ -1473,46 +1017,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x > -52 & data.x < 0) @@ -1521,46 +1038,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else @@ -1575,40 +1065,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) updateActiveRow('secondServeZone', 'Wide') } updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else // wide and T inverted for Deuce side @@ -1619,46 +1077,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x >= 50 & data.x <= 105) @@ -1667,46 +1098,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else if (data.x > 105 & data.x <= 157) @@ -1715,46 +1119,19 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if (data.y <= -10 & data.y >= -245) { updateActiveRow('secondServeIn', '1'); - setCurrentPage('GroundstrokeContact'); + if (isAce == '1') { + setCurrentPage('PointScore'); + } + else { + setCurrentPage('GroundstrokeContact'); + } } else { updateActiveRow('secondServeIn', '0'); updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } else @@ -1769,40 +1146,8 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) updateActiveRow('secondServeZone', 'Wide') } updateActiveRow('isPointEnd', '1'); - doubleFault(data.table[data.activeRowIndex]['serverName']); - if (serverScore == 0 && returnerScore == 0) { - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - setCurrentPage('PointScore'); - } - else { - if (data.activeRowIndex > 0) { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex - 1]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex - 1]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - else { - updateActiveRow('serverFarNear', data.table[0]['serverFarNear']); - updateActiveRow('serverName', data.table[0]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', player1GameScore + '-' + player2GameScore); - updateActiveRow('setScore', player1SetScore + '-' + player2SetScore); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } } } @@ -2007,82 +1352,84 @@ export const getTaggerButtonData = (updateActiveRow, addNewRow, setCurrentPage) if ((data.table[data.activeRowIndex]["shotContactY"] >= 0 & ((data.y >= 0 || data.y <-455) || (data.x > 157 || data.x < -157))) || (data.table[data.activeRowIndex]["shotContactY"] < 0 & ((data.y <= 0 || data.y > 455) || (data.x > 157 || data.x < -157))) || (data.table[data.activeRowIndex]["isWinner"] == "1")) { - serverScore = parseInt(data.table[data.activeRowIndex]['pointScore'].split("-")[0]); - returnerScore = parseInt(data.table[data.activeRowIndex]['pointScore'].split("-")[1]); - player1GameScore = parseInt(data.table[data.activeRowIndex]['gameScore'].split("-")[0]); - player2GameScore = parseInt(data.table[data.activeRowIndex]['gameScore'].split("-")[1]); - player1SetScore = parseInt(data.table[data.activeRowIndex]['setScore'].split("-")[0]); - player2SetScore = parseInt(data.table[data.activeRowIndex]['setScore'].split("-")[1]); - if (player1GameScore == 6 && player2GameScore == 6) { - updateTiebreakScore(parseInt(data.table[data.activeRowIndex]["shotInRally"]), - data.table[data.activeRowIndex]["isWinner"], - data.table[data.activeRowIndex]["serverName"]); - if (serverScore >= 7 && (serverScore - returnerScore) >= 2 ) { - player1SetScore += 1; - player1GameScore = 0; - player2GameScore = 0; - serverScore = 0; - returnerScore = 0; - setCurrentPage('ServerName'); - } - else if (returnerScore >= 7 && (returnerScore - serverScore) >= 2 ) { - player1SetScore += 1; - player1GameScore = 0; - player2GameScore = 0; - returnerScore = 0; - serverScore = 0; - setCurrentPage('ServerName'); - } - else { - if ((serverScore + returnerScore) % 2 == 1) { // need to switch scores cuz server switches - var tempServeScore = serverScore; - serverScore = returnerScore; - returnerScore = tempServeScore; - } - setCurrentPage('ServerName'); - } - } - else { - updateScore(parseInt(data.table[data.activeRowIndex]["shotInRally"]), - data.table[data.activeRowIndex]["isWinner"], - data.table[data.activeRowIndex]["serverName"]); - if (serverScore == 0 && returnerScore == 0) { - if (player1GameScore >= 6) { - if (player1GameScore - player2GameScore >= 2) { - player1SetScore += 1; - player1GameScore = 0; - player2GameScore = 0; - } - } - else if (player2GameScore >= 6) { - if (player2GameScore - player1GameScore >= 2) { - player2SetScore += 1; - player2GameScore = 0; - player1GameScore = 0; - } - } - setCurrentPage('ServerName'); - } - else { - addNewRow(); - if (serverScore == 40 && returnerScore == 40) { - updateActiveRow('serverName', data.table[data.activeRowIndex]['serverName']) - updateActiveRow('serverFarNear', data.table[data.activeRowIndex]['serverFarNear']) - setCurrentPage('PointScore'); - } - else { - updateActiveRow('serverFarNear', data.table[data.activeRowIndex]['serverFarNear']); - updateActiveRow('serverName', data.table[data.activeRowIndex]['serverName']); - updateActiveRow('pointScore', serverScore + '-' + returnerScore); - updateActiveRow('gameScore', data.table[data.activeRowIndex]['gameScore']); - updateActiveRow('setScore', data.table[data.activeRowIndex]['setScore']); - updateActiveRow('isPointStart', 1); - updateActiveRow('shotInRally', 1); - updateActiveRow('side', chooseSide()); - setCurrentPage('FirstServe'); - } - } - } + // serverScore = parseInt(data.table[data.activeRowIndex]['pointScore'].split("-")[0]); + // returnerScore = parseInt(data.table[data.activeRowIndex]['pointScore'].split("-")[1]); + // player1GameScore = parseInt(data.table[data.activeRowIndex]['gameScore'].split("-")[0]); + // player2GameScore = parseInt(data.table[data.activeRowIndex]['gameScore'].split("-")[1]); + // player1SetScore = parseInt(data.table[data.activeRowIndex]['setScore'].split("-")[0]); + // player2SetScore = parseInt(data.table[data.activeRowIndex]['setScore'].split("-")[1]); + // if (player1GameScore == 6 && player2GameScore == 6) { + // updateTiebreakScore(parseInt(data.table[data.activeRowIndex]["shotInRally"]), + // data.table[data.activeRowIndex]["isWinner"], + // data.table[data.activeRowIndex]["serverName"]); + // if (serverScore >= 7 && (serverScore - returnerScore) >= 2 ) { + // player1SetScore += 1; + // player1GameScore = 0; + // player2GameScore = 0; + // serverScore = 0; + // returnerScore = 0; + // setCurrentPage('PointScore'); + // } + // else if (returnerScore >= 7 && (returnerScore - serverScore) >= 2 ) { + // player1SetScore += 1; + // player1GameScore = 0; + // player2GameScore = 0; + // returnerScore = 0; + // serverScore = 0; + // setCurrentPage('PointScore'); + // } + // else { + // if ((serverScore + returnerScore) % 2 == 1) { // need to switch scores cuz server switches + // var tempServeScore = serverScore; + // serverScore = returnerScore; + // returnerScore = tempServeScore; + // } + // setCurrentPage('PointScore'); + // } + // } + // else { + // updateScore(parseInt(data.table[data.activeRowIndex]["shotInRally"]), + // data.table[data.activeRowIndex]["isWinner"], + // data.table[data.activeRowIndex]["serverName"]); + // if (serverScore == 0 && returnerScore == 0) { + // if (player1GameScore >= 6) { + // if (player1GameScore - player2GameScore >= 2) { + // player1SetScore += 1; + // player1GameScore = 0; + // player2GameScore = 0; + // } + // } + // else if (player2GameScore >= 6) { + // if (player2GameScore - player1GameScore >= 2) { + // player2SetScore += 1; + // player2GameScore = 0; + // player1GameScore = 0; + // } + // } + // setCurrentPage('PointScore'); + // } + // else { + // addNewRow(); + // if (serverScore == 40 && returnerScore == 40) { + // updateActiveRow('serverName', data.table[data.activeRowIndex]['serverName']) + // updateActiveRow('serverFarNear', data.table[data.activeRowIndex]['serverFarNear']) + // setCurrentPage('PointScore'); + // } + // else { + // updateActiveRow('serverFarNear', data.table[data.activeRowIndex]['serverFarNear']); + // updateActiveRow('serverName', data.table[data.activeRowIndex]['serverName']); + // updateActiveRow('pointScore', serverScore + '-' + returnerScore); + // updateActiveRow('gameScore', data.table[data.activeRowIndex]['gameScore']); + // updateActiveRow('setScore', data.table[data.activeRowIndex]['setScore']); + // updateActiveRow('isPointStart', 1); + // updateActiveRow('shotInRally', 1); + // updateActiveRow('side', chooseSide()); + // setCurrentPage('PointScore'); + // } + // } + // } + updateActiveRow('pointEndTime', data.videoTimestamp + 10); + setCurrentPage('PointScore'); } else { diff --git a/app/styles/TagMatch.module.css b/app/styles/TagMatch.module.css index 0216f4a..0202f07 100644 --- a/app/styles/TagMatch.module.css +++ b/app/styles/TagMatch.module.css @@ -25,11 +25,11 @@ margin-bottom: 5px; width: 300px; height: 240px; - position: fixed; - top: 33%; - left: 80%; - transform: translateX(-50%); - + /* position: fixed; */ + /* top: 33%; + left: 80%; */ + /* transform: translateX(-50%); */ + overflow-y: auto; } .courtImage {