diff --git a/src/components/layouts/TextureReference.js b/src/components/layouts/TextureReference.js deleted file mode 100644 index 788983cc..00000000 --- a/src/components/layouts/TextureReference.js +++ /dev/null @@ -1,40 +0,0 @@ -import React from "react"; -import Header from "../structural/header/Header"; -import Footer from "../structural/Footer"; -import TextureReferencePage from "../reference/TextureReferencePage"; - -import * as layoutTypes from "../../constants/LayoutTypes.js"; - -/** - * Create a layout for texture reference page. - * @param {object} param0 List of props that will be use in components - * @returns {HTMLElement} Layout of the texture reference page - */ -export const TextureReference = ({ editor, editorActions, user, authActions, scene, sceneActions, projectActions, courseActions, projects, courses, match, collectionActions, collections }) => ( -
-
-
- -
-
-); - -export default TextureReference; \ No newline at end of file diff --git a/src/components/reference/AssetReferencePage.js b/src/components/reference/AssetReferencePage.js index a7908112..186807f1 100644 --- a/src/components/reference/AssetReferencePage.js +++ b/src/components/reference/AssetReferencePage.js @@ -9,7 +9,7 @@ import { Hidden, } from "@material-ui/core"; -import "../../css/ModelReferencePage.css"; +import "../../css/ReferencePage.css"; export default class AssetReference extends React.Component { @@ -34,9 +34,9 @@ export default class AssetReference extends React.Component { render() { document.title = "Asset | MYR"; return ( -
+
diff --git a/src/components/reference/ModelReferencePage.js b/src/components/reference/ModelReferencePage.js deleted file mode 100644 index 0ceb35eb..00000000 --- a/src/components/reference/ModelReferencePage.js +++ /dev/null @@ -1,146 +0,0 @@ -import React, { Component } from "react"; -import myrReference from "../../myr/modelReference"; - -import ModelPack from "../structural/Models.js"; - -import { - Tabs, - Tab, - Icon, - IconButton, - Table, - TableBody, - TableHead, - TableRow, - TableCell, - Hidden, -} from "@material-ui/core"; - -import "../../css/ReferencePage.css"; - -/** - * ModelReferencePage is react component for creating Model Reference Page - */ -export default class ModelReferencePage extends Component { - /** - * Constructor - * value represents the current tab that's opened - */ - constructor(props) { - super(props); - this.state = { - value: "a", - }; - this.tableData = myrReference(); - } - - /** - * Handler for when user clicked the tab, it updates the state "value" with value passed in - * - * @param {Event} event - * @param {string} value tab to be changed to. It should be an alphabet - */ - handleChange = (event, value) => { - this.setState({ value }); - }; - - /** - * Helper function for getting the name of the image to retrieve from backend - * - * @param {*} model - * @returns - */ - imageHelper = (model) => { - if(model) { - let models = ModelPack().ModelPack; - - if(models.has(model)) { - let gltf = models.get(model); - return gltf.image; - } - return null; - } - return null; - }; - - /** - * Create a button that will link to the example scene - * - * @param {string} example name of the API - * @returns {HTMLElement} IconButton with link to the example scene - */ - exampleHelper = (example) => { - if(example) { - let link = "/modelReference/" + example; - return ( - - link - - ); - } - return null; - }; - - /** - * Create a table of references by retrieve array of references from tableData by category - * - * @param {string} category name of the category - * @returns {Table} DOM elements of table with references with passed category - */ - TableEx = (category) => { - return ( - - - - Name - - Image - Example - - - - {this.tableData[category].map((row, index) => ( - - {row.name} - - - alt - - {this.exampleHelper(row.example)} - - ))} - -
- ); - }; - - /** - * Render reference page for model - */ - render() { - return ( -
- - model} - label={ - -
MODEL
-
- } - value='a' /> -
- {this.state.value === "a" && -
- {this.TableEx("model")} -
} -
- ); - } -} \ No newline at end of file diff --git a/src/components/reference/ModelReferenceTab.js b/src/components/reference/ModelReferenceTab.js index c82ef5ec..218bef04 100644 --- a/src/components/reference/ModelReferenceTab.js +++ b/src/components/reference/ModelReferenceTab.js @@ -11,7 +11,7 @@ import { TableCell } from "@material-ui/core"; -import "../../css/ModelReferencePage.css"; +import "../../css/ReferencePage.css"; export default class ModelReference extends React.Component { imageHelper = (model) => { diff --git a/src/components/reference/TextureReferencePage.js b/src/components/reference/TextureReferencePage.js deleted file mode 100644 index 04c35643..00000000 --- a/src/components/reference/TextureReferencePage.js +++ /dev/null @@ -1,150 +0,0 @@ -import React from "react"; -import myrReference from "../../myr/textureReference"; - -import TexturePack from "../structural/Textures.js"; - -import { - Tabs, - Tab, - Icon, - IconButton, - Table, - TableBody, - TableHead, - TableRow, - TableCell, - Hidden, -} from "@material-ui/core"; - -import "../../css/ReferencePage.css"; - -/** - * TextureReferencePage is react component for creating Model Reference Page - */ -export default class TextureReferencePage extends React.Component { - /** - * Constructor - * value represents the current tab that's opened - */ - constructor(props) { - super(props); - this.state = { - value: "a", - }; - this.tableData = myrReference(); - } - - /** - * Handler for when user clicked the tab, it updates the state "value" with value passed in - * - * @param {Event} event - * @param {string} value tab to be changed to. It should be an alphabet - */ - handleChange = (event, value) => { - this.setState({ value }); - }; - - /** - * Helper function for getting the name of the image to retrieve from backend - * @param {*} model - * @returns - */ - imageHelper = (image) => { - if(image) { - let textures = TexturePack(); - let textureTitle = [...textures.TexturePack.map(obj => obj.title)]; - let textureURL = [...textures.TexturePack.map(obj => obj.url)]; - - let texture = textureURL[textureTitle.indexOf(image)]; - - return ( - texture - ); - } else { - return null; - } - } - - /** - * Create a button that will link to the example scene - * @param {string} example name of the API - * @returns {HTMLElement} IconButton with link to the example scene - */ - exampleHelper = (example) => { - if (example) { - let link = "/textureReference/" + example; - return ( - - link - - ); - } else { - return null; - } - }; - - /** - * Create a table of references by retrieve array of references from tableData by category - * - * @param {string} category name of the category - * @returns {Table} DOM elements of table with references with passed category - */ - TableEx = (category) => { - return ( - - - - Name - - Image - Image Creator - Example - - - - {this.tableData[category].map((row, index) => ( - - {row.name} - - - alt - - {row.creator} - {this.exampleHelper(row.example)} - - ))} - -
- ); - }; - - /** - * Render reference page for texture - */ - render() { - return ( -
- - texture} - label={ - -
TEXTURE
-
- } - value='a' /> -
- {this.state.value === "a" && -
- {this.TableEx("texture")} -
} -
- ); - } -} diff --git a/src/components/reference/TextureReferenceTab.js b/src/components/reference/TextureReferenceTab.js index d399a1ad..0d64f131 100644 --- a/src/components/reference/TextureReferenceTab.js +++ b/src/components/reference/TextureReferenceTab.js @@ -11,7 +11,7 @@ import { TableCell, } from "@material-ui/core"; -import "../../css/TextureReferencePage.css"; +import "../../css/ReferencePage.css"; export default class TextureReference extends React.Component { imageHelper = (image) => { diff --git a/src/containers/Reference.js b/src/containers/Reference.js index 6d2de060..a6e3219c 100644 --- a/src/containers/Reference.js +++ b/src/containers/Reference.js @@ -1,7 +1,5 @@ import PropTypes from "prop-types"; import ReferencePage from "../components/layouts/Reference.js"; -import TextureReferencePage from "../components/layouts/TextureReference.js"; -import ModelReferencePage from "../components/layouts/ModelReference.js"; import * as Actions from "../actions"; import { bindActionCreators } from "redux"; @@ -45,19 +43,7 @@ const mapDispatchToProps = dispatch => ({ /** * This does the binding to the redux store */ -const Reference = connect( +export default connect( mapStateToProps, mapDispatchToProps -)(ReferencePage); - -const TextureReference = connect( - mapStateToProps, - mapDispatchToProps -)(TextureReferencePage); - -const ModelReference = connect( - mapStateToProps, - mapDispatchToProps -)(ModelReferencePage); - -export { Reference, TextureReference, ModelReference }; +)(ReferencePage); \ No newline at end of file