From a855fda57fc094d94b1d60d1abc5b37625398ac4 Mon Sep 17 00:00:00 2001 From: trippjoe Date: Tue, 8 Feb 2022 13:04:00 -0500 Subject: [PATCH] revised file structure for panel components --- app/src/components/Landing.js | 5 +- .../components/{ => panels}/GettingStarted.js | 0 app/src/components/{ => panels}/Home.js | 0 .../components/{ => panels}/ImportantLinks.js | 2 +- app/src/components/{ => panels}/Settings.js | 2 +- app/src/components/panels/index.js | 11 + app/src/core/nav.jsx | 250 ------------------ 7 files changed, 14 insertions(+), 256 deletions(-) rename app/src/components/{ => panels}/GettingStarted.js (100%) rename app/src/components/{ => panels}/Home.js (100%) rename app/src/components/{ => panels}/ImportantLinks.js (93%) rename app/src/components/{ => panels}/Settings.js (93%) create mode 100644 app/src/components/panels/index.js delete mode 100644 app/src/core/nav.jsx diff --git a/app/src/components/Landing.js b/app/src/components/Landing.js index fbff067..7913beb 100644 --- a/app/src/components/Landing.js +++ b/app/src/components/Landing.js @@ -1,9 +1,6 @@ import React from "react"; import { Flex, Tabs, TabList, TabPanels, TabPanel, Tab } from "@chakra-ui/react"; -import Home from "./Home"; -import GettingStarted from "./GettingStarted"; -import ImportantLinks from "./ImportantLinks"; -import Settings from "./Settings"; +import { Home, GettingStarted, ImportantLinks, Settings } from './panels/index.js'; function Landing() { return ( diff --git a/app/src/components/GettingStarted.js b/app/src/components/panels/GettingStarted.js similarity index 100% rename from app/src/components/GettingStarted.js rename to app/src/components/panels/GettingStarted.js diff --git a/app/src/components/Home.js b/app/src/components/panels/Home.js similarity index 100% rename from app/src/components/Home.js rename to app/src/components/panels/Home.js diff --git a/app/src/components/ImportantLinks.js b/app/src/components/panels/ImportantLinks.js similarity index 93% rename from app/src/components/ImportantLinks.js rename to app/src/components/panels/ImportantLinks.js index e58e37f..18937c6 100644 --- a/app/src/components/ImportantLinks.js +++ b/app/src/components/panels/ImportantLinks.js @@ -1,6 +1,6 @@ import { Button, VStack } from "@chakra-ui/react"; import React from "react"; -const data = require('../assets/data/links.json'); +const data = require('../../assets/data/links.json'); function Feature({ title, link }) { return ( diff --git a/app/src/components/Settings.js b/app/src/components/panels/Settings.js similarity index 93% rename from app/src/components/Settings.js rename to app/src/components/panels/Settings.js index 7ef3617..ad5efe9 100644 --- a/app/src/components/Settings.js +++ b/app/src/components/panels/Settings.js @@ -1,6 +1,6 @@ import React from "react"; import { Button, VStack } from '@chakra-ui/react'; -import { ColorModeSwitcher } from '../ColorModeSwitcher'; +import { ColorModeSwitcher } from '../../ColorModeSwitcher'; const { invoke } = window.api; async function handleCheckUpdates() { diff --git a/app/src/components/panels/index.js b/app/src/components/panels/index.js new file mode 100644 index 0000000..beee63a --- /dev/null +++ b/app/src/components/panels/index.js @@ -0,0 +1,11 @@ +import Home from './Home'; +import GettingStarted from './GettingStarted'; +import ImportantLinks from './ImportantLinks'; +import Settings from './Settings' + +export { + Home, + GettingStarted, + ImportantLinks, + Settings +} \ No newline at end of file diff --git a/app/src/core/nav.jsx b/app/src/core/nav.jsx deleted file mode 100644 index 49ded15..0000000 --- a/app/src/core/nav.jsx +++ /dev/null @@ -1,250 +0,0 @@ -// import React from "react"; -// import ROUTES from "Constants/routes"; -// import { -// validateLicenseRequest, -// validateLicenseResponse, -// } from "secure-electron-license-keys"; - -// class Nav extends React.Component { -// constructor(props) { -// super(props); - -// this.history = props.history; -// this.state = { -// mobileMenuActive: false, -// licenseModalActive: false, - -// // license-specific -// licenseValid: false, -// allowedMajorVersions: "", -// allowedMinorVersions: "", -// appVersion: "", -// licenseExpiry: "", -// }; - -// this.toggleMenu = this.toggleMenu.bind(this); -// this.toggleLicenseModal = this.toggleLicenseModal.bind(this); -// this.navigate = this.navigate.bind(this); -// } - -// componentWillUnmount() { -// window.api.licenseKeys.clearRendererBindings(); -// } - -// componentDidMount() { -// // Set up binding to listen when the license key is -// // validated by the main process -// const _ = this; - -// window.api.licenseKeys.onReceive(validateLicenseResponse, function (data) { -// // If the license key/data is valid -// if (data.success) { -// // Here you would compare data.appVersion to -// // data.major, data.minor and data.patch to -// // ensure that the user's version of the app -// // matches their license -// _.setState({ -// licenseValid: true, -// allowedMajorVersions: data.major, -// allowedMinorVersions: data.minor, -// allowedPatchVersions: data.patch, -// appVersion: data.appVersion, -// licenseExpiry: data.expire, -// }); -// } else { -// _.setState({ -// licenseValid: false, -// }); -// } -// }); -// } - -// toggleMenu(event) { -// this.setState({ -// mobileMenuActive: !this.state.mobileMenuActive, -// }); -// } - -// toggleLicenseModal(event) { -// const previous = this.state.licenseModalActive; - -// // Only send license request if the modal -// // is not already open -// if (!previous) { -// window.api.licenseKeys.send(validateLicenseRequest); -// } - -// this.setState({ -// licenseModalActive: !this.state.licenseModalActive, -// }); -// } - -// // Using a custom method to navigate because we -// // need to close the mobile menu if we navigate to -// // another page -// navigate(url) { -// this.setState( -// { -// mobileMenuActive: false, -// }, -// function () { -// this.history.push(url); -// } -// ); -// } - -// renderLicenseModal() { -// return ( -//
-//
-//
-// {this.state.licenseValid ? ( -//
-// The license key for this product has been validated and the -// following versions of this app are allowed for your use: -//
-// Major versions:{" "} -// {this.state.allowedMajorVersions}
-// Minor versions:{" "} -// {this.state.allowedMinorVersions}
-// Patch versions:{" "} -// {this.state.allowedPatchVersions}
-// Expires on:{" "} -// {!this.state.licenseExpiry -// ? "never!" -// : this.state.licenseExpiry}{" "} -//
( -// -// App version: -// {` v${this.state.appVersion.major}.${this.state.appVersion.minor}.${this.state.appVersion.patch}`} -// -// ) -//
-//
-//
-// ) : ( -//
-//
The license key is not valid.
-//
-// If you'd like to create a license key, follow these steps: -//
    -//
  1. -// Install this package globally ( -// npm i secure-electron-license-keys-cli -g). -//
  2. -//
  3. -// Run secure-electron-license-keys-cli. -//
  4. -//
  5. -// Copy public.key and{" "} -// license.data into the root folder -// of this app. -//
  6. -//
  7. -// Re-run this app (ie. npm run dev). -//
  8. -//
  9. -// If you'd like to further customize your license keys, copy -// this link into your browser:{" "} -// -// https://github.com/reZach/secure-electron-license-keys-cli -// -// . -//
  10. -//
-//
-//
-// )} -//
-// -//
-// ); -// } - -// render() { -// return ( -// -// ); -// } -// } - -// export default Nav;