A local-first personal finance app
Improve homepage a bit, clean up old/unused code (#200)
Jed Foxbe0dc4ecd4e7
diff --git a/docs/budgeting/howitworks.md b/docs/budgeting/howitworks.mdindex f07f3619fc..7d17eda8ab 100644--- a/docs/budgeting/howitworks.md+++ b/docs/budgeting/howitworks.md@@ -46,7 +46,7 @@ Most likely, a common workflow will be to "hold" income you make this month for-3. Press `Enter` to hold all available money, or enter a custom amount to hold.+3. Press <Key k="enter" /> to hold all available money, or enter a custom amount to hold.This doesn't do anything except takes out money from the **To Budget** amount for that month, allowing you to "zero it out" and mark it to be used for later. That money will appear in next month's **To Budget**.@@ -114,5 +114,3 @@ This might sound complex, but it's really not! You can get as detailed as you waIf you don't have a savings account, you can simply skip step 6. The **Savings** category will build up a balance and represent the savings that you are keeping in your account.This also assumes you have enough income to cover a full month plus any overspending. If you don't, you need to watch your budget more carefully and make sure to cover overspending from other categories.--<NextLink href="/docs/budgeting/categories/">Next step: learn about categories</NextLink>diff --git a/docs/components/Key.js b/docs/components/Key.jsdeleted file mode 100644index 1c6d10f6d1..0000000000--- a/docs/components/Key.js+++ /dev/null@@ -1,55 +0,0 @@-import React, { useEffect, useState } from 'react';--function title(str) {- if (str.length > 0) {- return str[0].toUpperCase() + str.slice(1).toLowerCase();- }- return '';-}--function detectMac() {- return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);-}--function transform(mod, isMacLike) {- if (isMacLike) {- return mod;- }-- switch (mod.toLowerCase()) {- case 'cmd':- return 'ctrl';- default:- return mod;- }-}--export default function Key({ mod, mods = [], k }) {- let [isMacLike, setMacLike] = useState(true);-- useEffect(() => {- setMacLike(detectMac());- }, []);-- if (mod) {- mods = [mod];- }-- mods = mods.map(mod => transform(mod, isMacLike)).map(title);-- let keys = [...mods, k];-- return (- <div className="inline-block">- {keys.reduce((acc, key, idx) => {- if (idx !== 0) {- acc.push(<span className="ml-1"></span>);- }- acc.push(- <div className="bg-gray-300 inline-block rounded px-1">{key}</div>,- );- return acc;- }, [])}- </div>- );-}diff --git a/docs/components/NextLink.js b/docs/components/NextLink.jsdeleted file mode 100644index 69a33bc5e7..0000000000--- a/docs/components/NextLink.js+++ /dev/null@@ -1,16 +0,0 @@-import React from 'react';--export default function NextLink({ href, children }) {- return (- <div className="flex flex-col items-center mt-16">- <div className="link-color-inherit text-white">- <a- className="no-underline bg-blue-500 px-6 py-4 rounded-full shadow-lg"- href={href}- >- {children}- </a>- </div>- </div>- );-}diff --git a/docs/components/Step.js b/docs/components/Step.jsdeleted file mode 100644index c6f875ed93..0000000000--- a/docs/components/Step.js+++ /dev/null@@ -1,16 +0,0 @@-import React from 'react';--export default function Step({ n, text }) {- return (- <div className="flex items-center flex-row mb-6 mt-12">- <div className="w-10 h-10 text-teal-100 relative flex items-center justify-center">- <div className="w-10 h-10 rounded-full bg-teal-500 absolute top-0 left-0" />- <div className="z-10" style={{ lineHeight: '1em' }}>- {n}- </div>- </div>-- <div className="ml-3 font-bold">{text}</div>- </div>- );-}diff --git a/docs/contributing/windows.md b/docs/contributing/windows.mdindex d17626f884..5b0e0dddd4 100644--- a/docs/contributing/windows.md+++ b/docs/contributing/windows.md@@ -14,7 +14,7 @@ Many of the build scripts are bash scripts and not natively invokable in Windows## How to build the Electron app on Windows1. Follow steps 1 - 6 above.-2. Run `yarn start`. If you get an error about bundle.desktop.js, just CTRL+C and rerun `yarn start`.+2. Run `yarn start`. If you get an error about bundle.desktop.js, just <Key mod="ctrl" k="c" /> and rerun `yarn start`.3. If you get an error from electron, run `yarn rebuild-electron` and rerun `yarn start`;# Errorsdiff --git a/docs/getting-started/managefiles.md b/docs/getting-started/managefiles.mdindex 881266ed88..375e0bdd2b 100644--- a/docs/getting-started/managefiles.md+++ b/docs/getting-started/managefiles.md@@ -10,7 +10,7 @@ These instructions relate exclusively to the desktop application### Desktop-- On the desktop app, go to the file management screen from the **File** > **Open file…** menu item, or press `CTRL & O`.+- On the desktop app, go to the file management screen from the **File** > **Open file…** menu item, or press <Key mod="cmd" k="o" />.- Click **Create new file**.## Delete a filediff --git a/docs/getting-started/tipstricks.md b/docs/getting-started/tipstricks.mdindex e5fa96a075..28c1e4e1dc 100644--- a/docs/getting-started/tipstricks.md+++ b/docs/getting-started/tipstricks.md@@ -5,44 +5,44 @@ title: 'Tips & Tricks'## Undo/redo-If you ever make a mistake, pressing `Ctrl & z` will undo, and `Ctrl, Shift & z` will redo. This is an undo system that you can rely on; any change can be undone and the UI will walk back in time.+If you ever make a mistake, pressing <Key mod="cmd" k="z" /> will undo, and pressing <Key mod="cmd shift" k="z" /> will redo. This is an undo system that you can rely on; any change can be undone and the UI will walk back in time.## Keyboard shortcutsA few global shortcuts:-- `Ctrl & 1` will show the budget-- `Ctrl & 2` will show reports-- `Ctrl & 3` will show all accounts-- `Ctrl & o` will close the file and list other available files to open+- <Key mod="cmd" k="1" /> will show the budget+- <Key mod="cmd" k="2" /> will show reports+- <Key mod="cmd" k="3" /> will show all accounts+- <Key mod="cmd" k="o" /> will close the file and list other available files to open### Budget-- `Enter` while editing a budget amount will move to the next category.-- `Shift & Enter` will move to the previous category.+- <Key k="enter" /> while editing a budget amount will move to the next category.+- <Key mod="shift" k="enter" /> will move to the previous category.### Transaction Editing-- When editing, `Enter` and `Shift & Enter` will move down and up. If a dropdown is open and you've typed a new value, this will instead save the value and close the dropdown.-- When editing, `Tab` and `Shift & Tab` will move left and right-- When adding a new transaction, `Ctrl & Enter` will add it regardless of where you are editing. Pressing `Enter` in either the Payment or Deposit columns will add it as well.+- When editing, <Key k="enter" /> and <Key mod="shift" k="enter" /> will move down and up. If a dropdown is open and you've typed a new value, this will instead save the value and close the dropdown.+- When editing, <Key k="tab" /> and <Key mod="shift" k="tab" /> will move left and right+- When adding a new transaction, <Key mod="cmd" k="enter" /> will add it regardless of where you are editing. Pressing <Key k="enter" /> in either the Payment or Deposit columns will add it as well.### Transaction Management-- `f` Show only selected transactions.-- `d` Delete selected transactions.-- `a` Set account for selected transations.-- `p` set payee for selected transactions.-- `n` Set notes for selected transactions.-- `c` Set category for selected transactions.-- `l` Toggle cleared for current transaction.+- <Key k="f" /> Show only selected transactions.+- <Key k="d" /> Delete selected transactions.+- <Key k="a" /> Set account for selected transations.+- <Key k="p" /> set payee for selected transactions.+- <Key k="n" /> Set notes for selected transactions.+- <Key k="c" /> Set category for selected transactions.+- <Key k="l" /> Toggle cleared for current transaction.The following require a transaction to have been selected first:-- `j/Down Arrow` Move to the next transaction down.-- `k/Up Arrow` Move to the next transaction up.-- `Space` Toggle selection of current transaction.-- `Shift & Space` Add all transactions between current transaction and most recently selected transaction.+- <Key k="J" />/<Key arrow="down" /> Move to the next transaction down.+- <Key k="K" />/<Key arrow="up" /> Move to the next transaction up.+- <Key k="space" /> Toggle selection of current transaction.+- <Key mod="shift" k="space" /> Add all transactions between current transaction and most recently selected transaction.## View multiple months at oncediff --git a/docs/install/local.md b/docs/install/local.mdindex b37c29a174..496c4d3678 100644--- a/docs/install/local.md+++ b/docs/install/local.md@@ -56,7 +56,7 @@ When first accessing Actual, you may be prompted to provide a URL for the serverWhen we publish a new release, you’ll need to follow these steps to update:-1. Stop the server if it’s running. You can use the keyboard shortcut `Ctrl & c` (even on macOS) to stop the server, or close the terminal window it’s running from.+1. Stop the server if it’s running. You can use the keyboard shortcut <Key mod="ctrl" k="c" /> (even on macOS) to stop the server, or close the terminal window it’s running from.2. Run `git pull` from the directory you cloned the project into. This will download the latest server code.3. Run `yarn install` from that same directory. This will download the latest web client code, along with any updated dependencies for the server.4. Restart the server by running `yarn start`.diff --git a/docusaurus.config.js b/docusaurus.config.jsindex 1bbb938ace..b5deebbe1f 100644--- a/docusaurus.config.js+++ b/docusaurus.config.js@@ -77,7 +77,7 @@ module.exports = {position: 'right',},{- href: 'https://github.com/actualbudget/docs',+ href: 'https://github.com/actualbudget/actual',label: 'GitHub',position: 'right',},@@ -87,31 +87,20 @@ module.exports = {style: 'dark',links: [{- title: 'GitHub',- items: [- {- label: 'GitHub',- href: 'https://github.com/actualbudget',- },- ],+ label: 'Discord',+ href: 'https://discord.gg/8JfAXSgfRf',},{- title: 'Discord',- items: [- {- label: 'Discord',- href: 'https://discord.gg/8JfAXSgfRf',- },- ],+ label: 'GitHub',+ href: 'https://github.com/actualbudget/actual',+ },+ {+ label: 'Website Source',+ href: 'https://github.com/actualbudget/docs',},{- title: 'RSS Feed',- items: [- {- label: 'RSS Feed',- href: 'https://actualbudget.org/blog/rss.xml',- },- ],+ label: 'RSS Feed',+ href: 'https://actualbudget.org/blog/rss.xml',},],copyright: `Copyright © ${new Date().getFullYear()} Actual Budget. Built with Docusaurus.`,diff --git a/src/components/Key.jsx b/src/components/Key.jsxnew file mode 100644index 0000000000..7b6b63cf61--- /dev/null+++ b/src/components/Key.jsx@@ -0,0 +1,69 @@+import React, { useEffect, useState } from 'react';+import classes from './Key.module.css';++function title(str) {+ if (str.length > 0) {+ return str[0].toUpperCase() + str.slice(1).toLowerCase();+ }+ return '';+}++function detectMac() {+ return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);+}++function transform(mod, isMacLike) {+ if (isMacLike) {+ return mod;+ }++ switch (mod.toLowerCase()) {+ case 'cmd':+ return 'ctrl';+ default:+ return mod;+ }+}++const arrows = {+ up: '↑',+ down: '↓',+ left: '←',+ right: '→',+};++export default function Key({ mod, fixed, mods = [], k, arrow }) {+ let [isMacLike, setMacLike] = useState(true);++ useEffect(() => {+ setMacLike(detectMac());+ }, []);++ if (mod) {+ mods = mod.split(' ');+ }++ if (arrow) {+ k = arrows[arrow];+ }++ mods = mods.map(mod => (fixed ? mod : transform(mod, isMacLike))).map(title);++ let keys = [...mods, title(k)];++ return (+ <div style={{ display: 'inline-flex' }}>+ {keys.map(+ (key, idx) => (+ <div+ className={classes.key}+ style={{ marginLeft: idx === 0 ? 0 : '0.25rem' }}+ >+ {key}+ </div>+ ),+ [],+ )}+ </div>+ );+}diff --git a/src/components/Key.module.css b/src/components/Key.module.cssnew file mode 100644index 0000000000..5e445b96fc--- /dev/null+++ b/src/components/Key.module.css@@ -0,0 +1,12 @@+.key {+ display: inline-block;+ border-radius: 0.25rem;+ padding-inline: 0.25rem;+ /* “Disabmiguation” */+ font-feature-settings: 'ss02' on;+ background-color: var(--ifm-color-primary-contrast-background);+}++[data-theme='dark'] .key {+ background-color: var(--ifm-color-secondary-contrast-background);+}diff --git a/src/css/custom.css b/src/css/custom.cssindex 5988dcd70a..df58a8227c 100644--- a/src/css/custom.css+++ b/src/css/custom.css@@ -4,7 +4,7 @@* work well for content-centric websites.*/-@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&display=swap');+@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:wght@400;700&family=Inter:[email protected]&display=swap');h1,.serif-header {@@ -21,31 +21,32 @@ h1 {/* You can override the default Infima variables here. */:root {--ifm-color-primary: #6b46c1;- --ifm-color-primary-dark: #6b46c1;- --ifm-color-primary-darker: #6b46c1;- --ifm-color-primary-darkest: #6b46c1;- --ifm-color-primary-light: #6b46c1;- --ifm-color-primary-lighter: #6b46c1;- --ifm-color-primary-lightest: #6b46c1;+ --ifm-color-primary-dark: var(--ifm-color-primary);+ --ifm-color-primary-darker: var(--ifm-color-primary);+ --ifm-color-primary-darkest: var(--ifm-color-primary);+ --ifm-color-primary-light: var(--ifm-color-primary);+ --ifm-color-primary-lighter: var(--ifm-color-primary);+ --ifm-color-primary-lightest: var(--ifm-color-primary);--ifm-code-font-size: 95%;--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);}/* For readability concerns, you should choose a lighter palette in dark mode. */[data-theme='dark'] {- --ifm-color-primary: #6b46c1;- --ifm-color-primary-dark: #6b46c1;- --ifm-color-primary-darker: #6b46c1;- --ifm-color-primary-darkest: #6b46c1;- --ifm-color-primary-light: #6b46c1;- --ifm-color-primary-lighter: #6b46c1;- --ifm-color-primary-lightest: #6b46c1;+ --ifm-color-primary: #967bd3;+ --ifm-color-primary-dark: var(--ifm-color-primary);+ --ifm-color-primary-darker: var(--ifm-color-primary);+ --ifm-color-primary-darkest: var(--ifm-color-primary);+ --ifm-color-primary-light: var(--ifm-color-primary);+ --ifm-color-primary-lighter: var(--ifm-color-primary);+ --ifm-color-primary-lightest: var(--ifm-color-primary);--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);}.footer,.footer--dark {--ifm-footer-background-color: #2e346b;+ --ifm-footer-link-hover-color: #ccc;}.menu__link--unavailable {@@ -80,4 +81,4 @@ h1 {img {height: auto;-}\ No newline at end of file+}diff --git a/src/pages/index.js b/src/pages/index.jsindex 0f04c71a6f..26cc494811 100644--- a/src/pages/index.js+++ b/src/pages/index.js@@ -88,7 +88,7 @@ export default function Hello() {your real income instead of made up numbers. This makes you face yourreal spending, and clearly shows how much you are saving each month.We make this process as simple as possible.{' '}- <Link to="/docs/budgeting/howitworks">Learn more</Link>+ <Link to="/docs/budgeting/howitworks">Learn more</Link></BigFeature><BigFeature@@ -232,7 +232,8 @@ function SmallFeature({ title, icon, learnMore, children }) {<div class={classes.smallFeatureContent}><h3 class={classes.smallFeatureTitle}>{title}</h3><p class={classes.smallFeatureText}>- {children} {learnMore ? <Link to={learnMore}>Learn more</Link> : null}+ {children}{' '}+ {learnMore ? <Link to={learnMore}>Learn more</Link> : null}</p></div></div>diff --git a/src/pages/index.module.css b/src/pages/index.module.cssindex c1895d24d2..e2d4da5e3e 100644--- a/src/pages/index.module.css+++ b/src/pages/index.module.css@@ -169,7 +169,7 @@.smallFeaturesGrid {display: grid;- grid-template-columns: 50% 50%;+ grid-template-columns: 1fr 1fr;gap: 4rem;margin-bottom: 4rem;}diff --git a/src/theme/MDXComponents.js b/src/theme/MDXComponents.jsindex d2efc99038..e753cc7b11 100644--- a/src/theme/MDXComponents.js+++ b/src/theme/MDXComponents.js@@ -1,7 +1,8 @@import MDXComponents from '@theme-original/MDXComponents';import Image from '@site/src/components/Image';-+import Key from '../components/Key';export default {...MDXComponents,img: Image,+ Key,};