diff --git a/packages/mui/src/components/CreateTokenFormComponent/CreateTokenFormComponent.tsx b/packages/mui/src/components/CreateTokenFormComponent/CreateTokenFormComponent.tsx index e131cc2..e4f808e 100644 --- a/packages/mui/src/components/CreateTokenFormComponent/CreateTokenFormComponent.tsx +++ b/packages/mui/src/components/CreateTokenFormComponent/CreateTokenFormComponent.tsx @@ -118,7 +118,6 @@ const CreateTokenFormComponent = () => { /> - import('./FindTokenComponent')); + +const FindTokenComponent = (props: JSX.IntrinsicAttributes & { children?: React.ReactNode; }) => ( + + + +); + +export default FindTokenComponent; diff --git a/packages/mui/src/components/FindTokenComponent/FindTokenComponent.module.css b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.module.css new file mode 100644 index 0000000..10a261e --- /dev/null +++ b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.module.css @@ -0,0 +1 @@ +.FindTokenComponent {} \ No newline at end of file diff --git a/packages/mui/src/components/FindTokenComponent/FindTokenComponent.test.tsx b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.test.tsx new file mode 100644 index 0000000..00c1024 --- /dev/null +++ b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.test.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import FindTokenComponent from './FindTokenComponent'; + +describe('', () => { + test('it should mount', () => { + render(); + + const findTokenComponent = screen.getByTestId('FindTokenComponent'); + + expect(findTokenComponent).toBeInTheDocument(); + }); +}); \ No newline at end of file diff --git a/packages/mui/src/components/FindTokenComponent/FindTokenComponent.tsx b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.tsx new file mode 100644 index 0000000..d7bade0 --- /dev/null +++ b/packages/mui/src/components/FindTokenComponent/FindTokenComponent.tsx @@ -0,0 +1,91 @@ +import { Box, ListItem, ListSubheader, Paper, TextField } from "@mui/material"; +import { AppReducerState } from "../../reducers/AppReducer"; +import { useSelector } from "react-redux"; +import { useEffect } from "react"; +// import styles from "./FindTokenComponent.module.css"; + +// interface FindTokenComponentProps {} + +const FindTokenComponent = () => { + const tokens = useSelector((state: AppReducerState) => state.content.tokens); + + useEffect(() => {}, []); + + /** {scenes.map((scene) => ( + handleDeleteScene(scene)} + > + + + } */ + return ( + // , height: `calc(100vh - 72px)` + + + + + {/* handleDeleteScene(scene)} + > + + + } + > */} + {tokens.map((token) => ( + {token.name} + ))} + {/* setClassSelected(event.target.value)} + sx={{ m: 1, margin: "1em" }} + > + {classes.map((classroom: ClassRoom) => ( + + {classroomText(classroom)} + + ))} + */} + {/* selected(student)} + /> */} + {/* The text field above is 3.5em, so we shrink the paper by 3.5em and let it handle overflow + to keep the scrolling to within the list it contains. */} + + + ); +}; + +export default FindTokenComponent; diff --git a/packages/mui/src/components/TokenInfoDrawerComponent/TokenInfoDrawerComponent.tsx b/packages/mui/src/components/TokenInfoDrawerComponent/TokenInfoDrawerComponent.tsx index e4b3171..1a37345 100644 --- a/packages/mui/src/components/TokenInfoDrawerComponent/TokenInfoDrawerComponent.tsx +++ b/packages/mui/src/components/TokenInfoDrawerComponent/TokenInfoDrawerComponent.tsx @@ -7,14 +7,13 @@ import { ListItemButton, ListItemIcon, ListItemText, - Paper, - TextField, } from "@mui/material"; import SearchIcon from "@mui/icons-material/Search"; import AddIcon from "@mui/icons-material/Add"; import { useState } from "react"; import { ExpandLess, ExpandMore } from "@mui/icons-material"; import CreateTokenFormComponent from "../CreateTokenFormComponent/CreateTokenFormComponent.lazy"; +import FindTokenComponent from "../FindTokenComponent/FindTokenComponent.lazy"; // interface TokenInfoDrawerComponentProps {} const TokenInfoDrawerComponent = () => { @@ -37,47 +36,7 @@ const TokenInfoDrawerComponent = () => { - - {/* setClassSelected(event.target.value)} - sx={{ m: 1, margin: "1em" }} - > - {classes.map((classroom: ClassRoom) => ( - - {classroomText(classroom)} - - ))} - */} - {/* selected(student)} - /> */} - {/* The text field above is 3.5em, so we shrink the paper by 3.5em and let it handle overflow - to keep the scrolling to within the list it contains. */} - + diff --git a/packages/mui/src/middleware/ContentMiddleware.ts b/packages/mui/src/middleware/ContentMiddleware.ts index 90cceec..36ae31a 100644 --- a/packages/mui/src/middleware/ContentMiddleware.ts +++ b/packages/mui/src/middleware/ContentMiddleware.ts @@ -37,10 +37,10 @@ function isBlob(payload: URL | Blob): payload is File { type Operation = "put" | "delete"; -const FriendlyOperation : {[key in Operation]: string } = { - "put": "Update succesfull", - "delete": "Deletion successful" -} +const FriendlyOperation: { [key in Operation]: string } = { + put: "Update succesfull", + delete: "Deletion successful", +}; async function update( state: AppReducerState, @@ -94,6 +94,21 @@ async function operate( next({ type: "content/error", payload: err }); } } +// async function retrieve( +// state: AppReducerState, +// store: MiddlewareAPI, unknown>, +// path: string, +// action: unknown & { type: string; payload: T }, +// ) { +// const url = `${state.environment.api}/${path}`; +// getToken(state, store) +// .then((headers) => axios.get(url, { headers: headers })) +// .then((value) => next({ type: action.type, payload: value.data })) +// .catch((err) => +// // TODO MICAH display error +// console.error(`Unable to fetch assets: ${JSON.stringify(err)}`), +// ); +// } async function updateAssetData( state: AppReducerState, @@ -226,6 +241,9 @@ export const ContentMiddleware: Middleware = operate(state, store, next, "delete", "asset", action); break; } + case "content/tokens": { + // operate(state, store, next, "get", "asset"); + } case "content/assets": { const url = `${state.environment.api}/asset`; getToken(state, store)