From 838de4beddf250315dee1920c7de6f0852576105 Mon Sep 17 00:00:00 2001 From: subnub Date: Mon, 22 Jul 2024 10:24:05 -0400 Subject: [PATCH] cleanup --- src/components/Subbar/Subbar.jsx | 80 -------- src/components/Subbar/index.jsx | 172 ------------------ .../UploadStorageSwitcher.jsx | 35 ---- .../UploadStorageSwitcher/index.jsx | 71 -------- 4 files changed, 358 deletions(-) delete mode 100644 src/components/Subbar/Subbar.jsx delete mode 100644 src/components/Subbar/index.jsx delete mode 100644 src/components/UploadStorageSwitcher/UploadStorageSwitcher.jsx delete mode 100644 src/components/UploadStorageSwitcher/index.jsx diff --git a/src/components/Subbar/Subbar.jsx b/src/components/Subbar/Subbar.jsx deleted file mode 100644 index 1b764a5..0000000 --- a/src/components/Subbar/Subbar.jsx +++ /dev/null @@ -1,80 +0,0 @@ -import React from "react"; - -export class Subbar extends React.Component { - - constructor(props) { - super(props); - } - - render() { - - return ( -
- -
- - - -

New

- -
-
- -

Folder

-
- -
- - -

File Upload

- - -
- -
- -

Folder Upload

-
-
-
- - -
- - {(this.props.parentList.length !== 1 || this.props.currentlySearching)? - ( -
- - {this.props.parentNameList.map((parent, index) => { - - const parentID = this.props.parentList[index]; - - return ( -
{this.props.itemClick(parentID, parent, true)}}> -

{parent}

- - {index !== this.props.parentNameList.length - 1 ? () : undefined} - -
- ) - })} - -
) - - : undefined} - - - -
- - - - -
- ) - } -} - - -export default Subbar \ No newline at end of file diff --git a/src/components/Subbar/index.jsx b/src/components/Subbar/index.jsx deleted file mode 100644 index 843f43e..0000000 --- a/src/components/Subbar/index.jsx +++ /dev/null @@ -1,172 +0,0 @@ -import Subbar from "./Subbar"; -import { showSideBar, hideSideBar } from "../../actions/main"; -import { showAddOptions2 } from "../../actions/addOptions"; -import { startAddFile, setFiles, startSetFiles } from "../../actions/files"; -import { - startAddFolder, - setFolders, - startSetFolders, -} from "../../actions/folders"; -import { enableListView, disableListView } from "../../actions/filter"; -import { resetSelected } from "../../actions/selectedItem"; -import Swal from "sweetalert2"; -import { connect } from "react-redux"; -// import { history } from "../../routers/AppRouter"; -import React from "react"; -import mobileCheck from "../../utils/mobileCheck"; -import withNavigate from "../HocComponent"; - -class SubbarContainer extends React.Component { - constructor(props) { - super(props); - - this.uploadInput = React.createRef(); - this.wrapperRef = React.createRef(); - this.isMobile = mobileCheck(); - } - - createFolder = async (e) => { - let inputValue = ""; - - const { value: folderName } = await Swal.fire({ - title: "Enter Folder Name", - input: "text", - inputValue: inputValue, - showCancelButton: true, - inputValidator: (value) => { - if (!value) { - return "Please Enter a Name"; - } - }, - }); - - if (folderName === undefined || folderName === null) { - return; - } - - const parent = this.props.parent; - const owner = this.props.auth.id; - const parentList = this.props.parentList; - - this.props.dispatch(startAddFolder(folderName, owner, parent, parentList)); - }; - - handleClickOutside = (e) => { - if ( - this.wrapperRef && - !this.wrapperRef.current.contains(event.target) && - this.props.showAddOptions2 - ) { - this.addButtonEvent(); - } - }; - - componentDidMount = () => { - if (this.isMobile) { - document.addEventListener("mousedown", this.handleClickOutside); - } - }; - - componentWillUnmount = () => { - if (this.isMobile) { - document.removeEventListener("mousedown", this.handleClickOutside); - } - }; - - addButtonEvent = () => { - const currentAddOptions = !this.props.showAddOptions2; - - this.props.dispatch(showAddOptions2(currentAddOptions)); - }; - - handleUpload = (e) => { - e.preventDefault(); - - this.props.dispatch( - startAddFile( - this.uploadInput.current, - this.props.parent, - this.props.parentList - ) - ); - this.uploadInput.current.value = ""; - }; - - showSideBarEvent = () => { - let show = this.props.showSideBar; - - if (show === "gone") { - show = false; - } - - if (show) { - this.props.dispatch(hideSideBar()); - } else { - this.props.dispatch(showSideBar()); - } - }; - - showListViewEvent = () => { - let listView = this.props.listView; - const parent = this.props.parent; - const sortBy = this.props.sortBy; - const search = this.props.search; - - if (listView) { - this.props.dispatch(resetSelected()); - this.props.dispatch(setFiles([])); - this.props.dispatch(setFolders([])); - this.props.dispatch(disableListView()); - this.props.dispatch(startSetFiles(parent, sortBy, search)); - this.props.dispatch(startSetFolders(parent, sortBy, search)); - } else { - this.props.dispatch(resetSelected()); - this.props.dispatch(setFiles([])); - this.props.dispatch(setFolders([])); - this.props.dispatch(enableListView()); - this.props.dispatch(startSetFiles(parent, sortBy, search)); - this.props.dispatch(startSetFolders(parent, sortBy, search)); - } - }; - - itemClick = (id) => { - if (id === "/") { - this.props.navigate("/home"); - } else { - this.props.navigate(`/folder/${id}`); - } - }; - - render() { - return ( - - ); - } -} - -const connectPropToState = (state) => ({ - auth: state.auth, - listView: state.filter.listView, - parentList: state.parent.parentList, - parentNameList: state.parent.parentNameList, - parent: state.parent.parent, - sortBy: state.filter.sortBy, - showAddOptions2: state.addOptions.showAddOptions2, - showSideBar: state.main.showSideBar, - currentlySearching: state.filter.currentlySearching, - search: state.filter.search, - isGoogle: state.filter.isGoogle, -}); - -export default connect(connectPropToState)(withNavigate(SubbarContainer)); diff --git a/src/components/UploadStorageSwitcher/UploadStorageSwitcher.jsx b/src/components/UploadStorageSwitcher/UploadStorageSwitcher.jsx deleted file mode 100644 index e2579a6..0000000 --- a/src/components/UploadStorageSwitcher/UploadStorageSwitcher.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from "react"; - -const UploadStorageSwitcher = (props) => ( -
- {props.state.options.length !== 0 ? ( - - ) : ( -

No Storage Accounts

- )} -
-); - -export default UploadStorageSwitcher; diff --git a/src/components/UploadStorageSwitcher/index.jsx b/src/components/UploadStorageSwitcher/index.jsx deleted file mode 100644 index a810f3e..0000000 --- a/src/components/UploadStorageSwitcher/index.jsx +++ /dev/null @@ -1,71 +0,0 @@ -import React from "react"; -import {connect} from "react-redux"; -import env from "../../enviroment/envFrontEnd" -import UploadStorageSwitcher from "./UploadStorageSwitcher"; - -class UploadStorageSwitcherContainer extends React.Component { - - constructor(props) { - super(props); - - this.state = { - options: [], - value: "" - } - } - - getOptionList = () => { - - const options = [] - - if (env.activeSubscription || !env.commercialMode) options.push({type:"stripe", name:"myDrive"}); - if (env.googleDriveEnabled) options.push({type:"drive", name:"Google Drive"}); - if (env.s3Enabled) options.push({type:"s3", name:"Amazon S3"}) - - this.setState(() => { - return { - ...this.state, - options, - value: options.length !== 0 ? options[0].type : "" - } - }) - - env.uploadMode = options.length !== 0 ? options[0].type : ""; - } - - changeUploadSwitcher = (e) => { - - const value = e.target.value; - - env.uploadMode = value; - - this.setState(() => ({ - ...this.state, - value - })) - } - - componentDidMount = () => { - - this.getOptionList(); - } - - componentDidUpdate = () => { - - env.uploadMode = this.props.storageSwitcher !== "" ? this.props.storageSwitcher : this.state.value; - } - - render() { - - return - } -} - -const connectStoreToProp = (state) => ({ - storageSwitcher: state.storageSwitcher.selected -}) - -export default connect(connectStoreToProp)(UploadStorageSwitcherContainer); \ No newline at end of file