diff --git a/README.md b/README.md index 652e8df..88c908b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ - [Features](#features) - [Download](#download) - [Development](#development) +- [Configuration](#configuration) - [Build packages](#build-packages) - [License](#license) @@ -39,9 +40,10 @@ - re-fetches everything automatically every minute - balances are fetched via etherscan.io API - spot prices are fetched from coingecko.com API -- detects system locale for number formatting - detects dark appearance setting and switches to dark theme automatically (macOS only) - detects system accent color and uses it as primary color (macOS & Windows only) +- Touch Bar support (macOS only) +- detects system locale for number formatting - currently highly optimized for macOS, your mileage on Windows or Linux may vary ## Download @@ -57,6 +59,8 @@ Alternatively, you can [build the app on your system](#build-packages). ## Development +The main app is a React app in `src/renderer/` wrapped within an Electron app defined in `src/main/`. + Clone, and run: ```bash @@ -70,6 +74,18 @@ npm install npm start ``` +## Configuration + +The app has a settings screen where you can add your account addresses. + +When building the app yourself, you can configure more in the `src/config.js` file: + +| Key | Description | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------ | +| `conversions` | Array defining the currencies the Ocean balance is converted to. Every currency listed here will appear in the ticker buttons. | +| `refreshInterval` | Defines the interval prices and balances are refetched. | +| `oceanTokenContract` | Contract address of the Ocean Token. You should not change this. | + ## Build packages ```bash diff --git a/package.json b/package.json index c439cfe..c7cd0a0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "Blowfish", "version": "1.0.2", "description": "🐡 Simple Electron-based desktop app to retrieve and display your total Ocean Token balances.", - "main": "./src/main.js", + "main": "./src/main/index.js", "scripts": { "test": "eslint ./src/**/*.{js,jsx} && stylelint ./src/**/*.css", "start": "webpack-dev-server --hot --host 0.0.0.0 --config=./webpack.dev.config.js", @@ -21,13 +21,8 @@ "license": "MIT", "dependencies": { "@coingecko/cryptoformat": "^0.3.1", - "@reach/router": "^1.2.1", "ethereum-address": "0.0.4", - "ms": "^2.1.1", - "react": "^16.8.6", - "react-blockies": "^1.4.1", - "react-dom": "^16.8.6", - "react-pose": "^4.0.8" + "ms": "^2.1.1" }, "devDependencies": { "@babel/core": "^7.4.5", @@ -36,6 +31,7 @@ "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", "@babel/runtime": "^7.4.5", + "@reach/router": "^1.2.1", "@svgr/webpack": "^4.2.0", "babel-eslint": "^10.0.1", "babel-loader": "^8.0.6", @@ -52,6 +48,10 @@ "html-webpack-plugin": "^3.2.0", "prettier": "^1.17.0", "prettier-stylelint": "^0.4.2", + "react": "^16.8.6", + "react-blockies": "^1.4.1", + "react-dom": "^16.8.6", + "react-pose": "^4.0.8", "style-loader": "^0.23.1", "stylelint": "^10.0.1", "stylelint-config-standard": "^18.3.0", @@ -64,6 +64,7 @@ "appId": "com.kremalicious.blowfish", "files": [ "./build/**/*", + "./src/main/**/*", "./src/*.js", "package.json" ], diff --git a/src/main.js b/src/main/index.js similarity index 96% rename from src/main.js rename to src/main/index.js index d318c1f..a7458c4 100644 --- a/src/main.js +++ b/src/main/index.js @@ -1,9 +1,9 @@ const path = require('path') const { app, BrowserWindow, systemPreferences, ipcMain } = require('electron') -const pkg = require('../package.json') +const pkg = require('../../package.json') const buildMenu = require('./menu') const { buildTouchbar, updateTouchbar } = require('./touchbar') -const { rgbaToHex } = require('./utils') +const { rgbaToHex } = require('../utils') let mainWindow @@ -44,7 +44,7 @@ const createWindow = async () => { mainWindow.loadURL( isDev ? 'http://localhost:8080' - : `file://${path.join(__dirname, '../build/index.html')}` + : `file://${path.join(__dirname, '../../build/index.html')}` ) createWindowEvents(mainWindow) diff --git a/src/menu.js b/src/main/menu.js similarity index 97% rename from src/menu.js rename to src/main/menu.js index c9fdd1e..fd247ca 100644 --- a/src/menu.js +++ b/src/main/menu.js @@ -1,6 +1,6 @@ const { app, Menu } = require('electron') -const { openUrl } = require('./utils') -const { homepage } = require('../package.json') +const { openUrl } = require('../utils') +const { homepage } = require('../../package.json') const buildMenu = mainWindow => { const template = [ diff --git a/src/touchbar.js b/src/main/touchbar.js similarity index 92% rename from src/touchbar.js rename to src/main/touchbar.js index 16dd303..d321bba 100644 --- a/src/touchbar.js +++ b/src/main/touchbar.js @@ -1,6 +1,6 @@ const { TouchBar } = require('electron') -const { cryptoFormatter } = require('./utils') -const { conversions } = require('./config') +const { cryptoFormatter } = require('../utils') +const { conversions } = require('../config') const { TouchBarButton } = TouchBar diff --git a/src/app/App.css b/src/renderer/App.css similarity index 100% rename from src/app/App.css rename to src/renderer/App.css diff --git a/src/app/App.jsx b/src/renderer/App.jsx similarity index 100% rename from src/app/App.jsx rename to src/renderer/App.jsx diff --git a/src/app/components/Account.jsx b/src/renderer/components/Account.jsx similarity index 100% rename from src/app/components/Account.jsx rename to src/renderer/components/Account.jsx diff --git a/src/app/components/Animations.js b/src/renderer/components/Animations.js similarity index 100% rename from src/app/components/Animations.js rename to src/renderer/components/Animations.js diff --git a/src/app/components/Balance.css b/src/renderer/components/Balance.css similarity index 100% rename from src/app/components/Balance.css rename to src/renderer/components/Balance.css diff --git a/src/app/components/Balance.jsx b/src/renderer/components/Balance.jsx similarity index 100% rename from src/app/components/Balance.jsx rename to src/renderer/components/Balance.jsx diff --git a/src/app/components/Spinner.css b/src/renderer/components/Spinner.css similarity index 100% rename from src/app/components/Spinner.css rename to src/renderer/components/Spinner.css diff --git a/src/app/components/Spinner.jsx b/src/renderer/components/Spinner.jsx similarity index 100% rename from src/app/components/Spinner.jsx rename to src/renderer/components/Spinner.jsx diff --git a/src/app/components/Ticker.css b/src/renderer/components/Ticker.css similarity index 100% rename from src/app/components/Ticker.css rename to src/renderer/components/Ticker.css diff --git a/src/app/components/Ticker.jsx b/src/renderer/components/Ticker.jsx similarity index 100% rename from src/app/components/Ticker.jsx rename to src/renderer/components/Ticker.jsx diff --git a/src/app/components/Titlebar.css b/src/renderer/components/Titlebar.css similarity index 100% rename from src/app/components/Titlebar.css rename to src/renderer/components/Titlebar.css diff --git a/src/app/components/Titlebar.jsx b/src/renderer/components/Titlebar.jsx similarity index 100% rename from src/app/components/Titlebar.jsx rename to src/renderer/components/Titlebar.jsx diff --git a/src/app/components/Total.jsx b/src/renderer/components/Total.jsx similarity index 100% rename from src/app/components/Total.jsx rename to src/renderer/components/Total.jsx diff --git a/src/app/components/Welcome.css b/src/renderer/components/Welcome.css similarity index 100% rename from src/app/components/Welcome.css rename to src/renderer/components/Welcome.css diff --git a/src/app/components/Welcome.jsx b/src/renderer/components/Welcome.jsx similarity index 100% rename from src/app/components/Welcome.jsx rename to src/renderer/components/Welcome.jsx diff --git a/src/app/images/cog.svg b/src/renderer/images/cog.svg similarity index 100% rename from src/app/images/cog.svg rename to src/renderer/images/cog.svg diff --git a/src/app/images/icon.icns b/src/renderer/images/icon.icns similarity index 100% rename from src/app/images/icon.icns rename to src/renderer/images/icon.icns diff --git a/src/app/images/icon.ico b/src/renderer/images/icon.ico similarity index 100% rename from src/app/images/icon.ico rename to src/renderer/images/icon.ico diff --git a/src/app/images/icon1024.png b/src/renderer/images/icon1024.png similarity index 100% rename from src/app/images/icon1024.png rename to src/renderer/images/icon1024.png diff --git a/src/app/images/rocket.svg b/src/renderer/images/rocket.svg similarity index 100% rename from src/app/images/rocket.svg rename to src/renderer/images/rocket.svg diff --git a/src/app/index.js b/src/renderer/index.js similarity index 100% rename from src/app/index.js rename to src/renderer/index.js diff --git a/src/app/screens/Home.css b/src/renderer/screens/Home.css similarity index 100% rename from src/app/screens/Home.css rename to src/renderer/screens/Home.css diff --git a/src/app/screens/Home.jsx b/src/renderer/screens/Home.jsx similarity index 100% rename from src/app/screens/Home.jsx rename to src/renderer/screens/Home.jsx diff --git a/src/app/screens/Preferences/Accounts.jsx b/src/renderer/screens/Preferences/Accounts.jsx similarity index 100% rename from src/app/screens/Preferences/Accounts.jsx rename to src/renderer/screens/Preferences/Accounts.jsx diff --git a/src/app/screens/Preferences/index.css b/src/renderer/screens/Preferences/index.css similarity index 100% rename from src/app/screens/Preferences/index.css rename to src/renderer/screens/Preferences/index.css diff --git a/src/app/screens/Preferences/index.jsx b/src/renderer/screens/Preferences/index.jsx similarity index 100% rename from src/app/screens/Preferences/index.jsx rename to src/renderer/screens/Preferences/index.jsx diff --git a/src/app/store/AppProvider.jsx b/src/renderer/store/AppProvider.jsx similarity index 100% rename from src/app/store/AppProvider.jsx rename to src/renderer/store/AppProvider.jsx diff --git a/src/app/store/createContext.jsx b/src/renderer/store/createContext.jsx similarity index 100% rename from src/app/store/createContext.jsx rename to src/renderer/store/createContext.jsx diff --git a/src/app/utils/fetch.js b/src/renderer/utils/fetch.js similarity index 100% rename from src/app/utils/fetch.js rename to src/renderer/utils/fetch.js diff --git a/webpack.common.config.js b/webpack.common.config.js index 807e936..a6e3bdc 100644 --- a/webpack.common.config.js +++ b/webpack.common.config.js @@ -2,10 +2,10 @@ const path = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') const CopyPlugin = require('copy-webpack-plugin') -const defaultInclude = [path.resolve(__dirname, 'src')] +const defaultInclude = [path.resolve(__dirname, 'src', 'renderer')] module.exports = { - entry: path.resolve(__dirname, 'src', 'app', 'index.js'), + entry: path.resolve(__dirname, 'src', 'renderer', 'index.js'), output: { path: path.resolve(__dirname, 'build'), filename: 'bundle.js', @@ -42,7 +42,7 @@ module.exports = { plugins: [ new HtmlWebpackPlugin(), new CopyPlugin([ - { from: './src/app/images/icon.*', to: './', flatten: true } + { from: './src/renderer/images/icon.*', to: './', flatten: true } ]) ] }