diff --git a/admin/src/Components/CollectionTable.js b/admin/src/Components/CollectionTable.js index 91137963..7ff6ac7d 100644 --- a/admin/src/Components/CollectionTable.js +++ b/admin/src/Components/CollectionTable.js @@ -3,13 +3,11 @@ import * as _ from "underscore"; import { confirmModal } from "../message"; const CollectionTable = (props) => { - // State variables const [sort, setSort] = useState({ key: null, order: "up" }); const [items, setItems] = useState(null); const [page, setPage] = useState({}); const [loading, setLoading] = useState(true); - // Destructure props const { collection, rowComponent, @@ -19,7 +17,6 @@ const CollectionTable = (props) => { onPageNav, } = props; - // useEffect to handle subscription useEffect(() => { const unsubscribe = collection.subscribe(({ page, items }) => { setPage(page); @@ -31,7 +28,6 @@ const CollectionTable = (props) => { }; }, [collection]); - // Functions const renderHeading = (column, i) => { const sortState = sort; @@ -127,7 +123,6 @@ const CollectionTable = (props) => { ); }; - // Render logic let rows = null; if (items !== null) { rows = items.map((item, i) => ( diff --git a/admin/src/Components/DatePeriodInput.js b/admin/src/Components/DatePeriodInput.js index cb010b05..37b71bd1 100644 --- a/admin/src/Components/DatePeriodInput.js +++ b/admin/src/Components/DatePeriodInput.js @@ -7,7 +7,6 @@ const DatePeriodInput = ({ period }) => { const [end, setEnd] = useState(period.end || null); useEffect(() => { - // Synchronize state with period on subscription updates const unsubscribe = period.subscribe(() => { setStart(period.start); setEnd(period.end); diff --git a/admin/src/Components/FileInput.jsx b/admin/src/Components/FileInput.jsx index 28510c0a..7c6145fd 100644 --- a/admin/src/Components/FileInput.jsx +++ b/admin/src/Components/FileInput.jsx @@ -1,104 +1,12 @@ import React, { useState } from "react"; const FileInput = () => { - // const [progressbarVisible, setProgressbarVisible] = useState(false); - // const [progressbarWidth, setProgressbarWidth] = useState(0); const [filename, setFilename] = useState(""); - /* - var _this = this; - var settings = { - action: config.apiBasePath + this.props.action, - allow : "*.(txt|xml|csv)", - headers: { - "Authorization": "Bearer " + auth.getAccessToken() - }, - loadstart: function() - { - _this.setState({ - progressbarVisible: true, - progressbarWidth: 0, - }); - }, - - progress: function(percent) - { - _this.setState({ - progressbarWidth: Math.ceil(percent), - }); - }, - - allcomplete: function(response, xhr) - { - // Show the progress bar for another seconds - setTimeout(function() - { - _this.setState({ - progressbarVisible: false, - progressbarWidth: 0, - }); - }, 1000); - - // Fix error handling - if(xhr.status == 201) - { - // Save the filename - var result = JSON.parse(response); - _this.setState({filename: result.data.filename}); - - if(_this.props.onFile !== undefined) - { - _this.props.onFile(result.data.filename); - } - } - else - { - alert("Upload failed"); - } - - } - }; - - var select = UIkit.uploadSelect($("#upload-select"), settings), - drop = UIkit.uploadDrop($("#upload-drop"), settings); - */ - - /* - var _this = this; - - // A sync event is fired when the model is saved - // When the model is saved the field is no longer dirty - this.state.model.on("sync", function(event) - { - _this.setState({ - isDirty: _this.state.model.attributeHasChanged(_this.props.name), - }); - }); - - // Update this component when the model is changed - this.state.model.on("change", function() - { - if(_this.state.model.changed[_this.props.name] !== undefined) - { - _this.setState({ - value: _this.state.model.changed[_this.props.name], - isDirty: _this.state.model.attributeHasChanged(_this.props.name), - }); - } - }); -*/ - const clearUpload = () => { setFilename(""); }; - /* - onChange(event) - { - this.state.model.set(this.props.name, event.target.value); - } -*/ - return (
{this.state.error_message}
- : ""} -