Skip to content

Commit

Permalink
Completely remove data viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-m-2983 committed Jul 10, 2024
1 parent 9c5ee29 commit a144a56
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 290 deletions.
17 changes: 0 additions & 17 deletions src/app/api/pull/route.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/app/api/push/route.ts

This file was deleted.

43 changes: 6 additions & 37 deletions src/app/lib/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

import { modals } from "@mantine/modals";
import { Code, Stack, Text } from "@mantine/core";
import { useSessionStorage } from "@mantine/hooks";
import MD5 from "crypto-js/md5";
import React from "react";

export async function exportData(sendQueue: any, clearSendQueue: any) {
modals.open({
title: "This is still being worked on!",
})
}

export async function exportDataOLD(sendQueue: any, clearSendQueue: any) {
fetch("/api/push", {
method: 'post',
headers: {
Expand Down Expand Up @@ -65,40 +70,4 @@ export async function exportData(sendQueue: any, clearSendQueue: any) {
),
modalId: "uploadModal"
});
}

/**
* Returns all active data on the server in one huge array.
* This specific function is meant to be used from the
* client-side only, as it receives the result over the network.
*
* @param setterFunction A callback for the result
*/
export async function getAllData(setterFunction: Function) {
fetch("/api/pull", {
method: 'get'
}).then(r => r.json()).then((data: any) => {
setterFunction(data);
});
}

/**
* A hook for using all turbo-scout data. This is a better way
* of accessing this data than using the `getAllData` function directly.
*
* @returns An array of entries.
*/
export function useTurboScoutData() {
//const [data, setData] = React.useState<any[]>([]);
const [ data, setData] = useSessionStorage({
key: 'pulled-ts-data',
defaultValue: []
});

React.useEffect(() => {
if(data.length != 0) return;
getAllData(setData);
}, [data, setData]);

return data;
}
4 changes: 1 addition & 3 deletions src/app/navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { AppShell, Burger, Group, UnstyledButton, Image, Text, Stack, ActionIcon, useMantineColorScheme, Center, Tooltip } from "@mantine/core";
import { AppShell, Burger, Group, UnstyledButton, Image, Text, Stack, ActionIcon, useMantineColorScheme, Center } from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import Link from "next/link";
import { IconSun, IconMoon, IconShare2, IconTrash } from '@tabler/icons-react';
import { useRouter } from "next/navigation";
import { TurboContext } from "./lib/context";
import React from "react";
import { exportData } from "./lib/server";
Expand Down Expand Up @@ -64,7 +63,6 @@ export function ContentLayout(props: { children: React.ReactNode }) {
<NavButton destination='/pit' onClick={() => closeIfOnMobile()}>Pit Scouting</NavButton>
<NavButton destination='/match' onClick={() => closeIfOnMobile()}>Match Scouting</NavButton>
<NavButton destination='/note' onClick={() => closeIfOnMobile()}>Notes</NavButton>
<NavButton destination='/view' onClick={() => closeIfOnMobile()}>Data Viewer</NavButton>
</Stack>
<Center>Welcome, {username}!</Center>
</Stack>
Expand Down
83 changes: 0 additions & 83 deletions src/app/view/entries.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions src/app/view/page.tsx

This file was deleted.

72 changes: 0 additions & 72 deletions src/app/view/progress.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions src/app/view/turbo-image.tsx

This file was deleted.

0 comments on commit a144a56

Please sign in to comment.