diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..5e31fff
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,31 @@
+name: Build/release
+
+on: push
+
+jobs:
+ release:
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ os: [macos-latest, ubuntu-latest, windows-latest]
+
+ steps:
+ - name: Check out Git repository
+ uses: actions/checkout@v1
+
+ - name: Install Node.js, NPM and Yarn
+ uses: actions/setup-node@v1
+ with:
+ node-version: 10
+
+ - name: Build/release Electron app
+ uses: samuelmeuli/action-electron-builder@v1
+ with:
+ # GitHub token, automatically provided to the action
+ # (No need to define this secret in the repo settings)
+ github_token: ${{ secrets.github_token }}
+
+ # If the commit is tagged with a version (e.g. "v1.0.0"),
+ # release the app after building
+ release: ${{ startsWith(github.ref, 'refs/tags/v') }}
diff --git a/forge.config.ts b/forge.config.ts
index 1dcc889..1ec790d 100644
--- a/forge.config.ts
+++ b/forge.config.ts
@@ -14,6 +14,7 @@ import { rendererConfig } from './webpack.renderer.config';
const config: ForgeConfig = {
packagerConfig: {
asar: true,
+ icon: './images/icon',
},
rebuildConfig: {},
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})],
diff --git a/images/1024.png b/images/1024.png
new file mode 100644
index 0000000..7a8034a
Binary files /dev/null and b/images/1024.png differ
diff --git a/images/icon.icns b/images/icon.icns
new file mode 100644
index 0000000..7d17782
Binary files /dev/null and b/images/icon.icns differ
diff --git a/images/icon.ico b/images/icon.ico
new file mode 100644
index 0000000..ad71f6d
Binary files /dev/null and b/images/icon.ico differ
diff --git a/images/icon.png b/images/icon.png
new file mode 100644
index 0000000..bcfa00a
Binary files /dev/null and b/images/icon.png differ
diff --git a/package.json b/package.json
index b52f690..119957d 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"electron-is-dev": "^3.0.1",
+ "electron-log": "^5.2.0",
"electron-squirrel-startup": "^1.0.1",
"framer-motion": "^11.5.6",
"react": "^18.3.1",
diff --git a/src/components/App.tsx b/src/components/App.tsx
index f396f13..deae8c5 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -1,32 +1,66 @@
import {
+ Box,
+ Container,
+ Flex,
Heading,
Icon,
IconButton,
+ List,
+ ListIcon,
+ ListItem,
+ Link,
+ Spacer,
Table,
TableContainer,
Tbody,
Td,
Th,
Thead,
+ Tooltip,
Tr,
+ useToken,
} from '@chakra-ui/react'
-import { CheckIcon, DeleteIcon, StarIcon } from '@chakra-ui/icons'
+import {
+ CheckIcon,
+ CopyIcon,
+ DeleteIcon,
+ StarIcon,
+ QuestionIcon,
+ RepeatIcon,
+ SettingsIcon,
+} from '@chakra-ui/icons'
+import log from 'electron-log/renderer'
import React, { useEffect, useState } from 'react'
import {
ScatterChart,
CartesianGrid,
Legend,
Scatter,
- Tooltip,
+ Tooltip as RechartsTooltip,
XAxis,
YAxis,
} from 'recharts'
-import type { Corner } from '../types'
+import type { Corner, Solution } from '../types'
const lerp = (a: number, b: number, t: number) => a + (b - a) * t
function App() {
+ const [logfilePath, setLogfilePath] = useState('')
const [corners, setCorners] = useState([] as Corner[])
+ const [solution, setSolution] = useState({} as Solution)
+ const [showHelp, setShowHelp] = useState(false)
+
+ const [green500, yellow300] = useToken(
+ // the key within the theme, in this case `theme.colors`
+ 'colors',
+ // the subkey(s), resolving to `theme.colors.red.100`
+ ['green.500', 'yellow.300']
+ // a single fallback or fallback array matching the length of the previous arg
+ )
+
+ useEffect(() => {
+ window.api.getLogfilePath().then(setLogfilePath)
+ }, [setLogfilePath])
useEffect(() => {
window.api.onClipboardTextUpdated((text: string) => {
@@ -42,47 +76,136 @@ function App() {
position: { x, y, z },
}
+ log.info(`Added corner: ${x}, ${y}, ${z}`)
setCorners((corners) => [...corners, corner])
})
return () => window.api.removeClipboardTextUpdatedListener()
- }, [])
+ }, [setCorners])
- let minX, maxX, minZ, maxZ
- for (const corner of corners) {
- if (minX === undefined || corner.chunk.x < minX) minX = corner.chunk.x
- if (maxX === undefined || corner.chunk.x > maxX) maxX = corner.chunk.x
- if (minZ === undefined || corner.chunk.z < minZ) minZ = corner.chunk.z
- if (maxZ === undefined || corner.chunk.z > maxZ) maxZ = corner.chunk.z
- }
+ useEffect(() => {
+ let minX, maxX, minZ, maxZ
+ for (const corner of corners) {
+ if (minX === undefined || corner.chunk.x < minX) minX = corner.chunk.x
+ if (maxX === undefined || corner.chunk.x > maxX) maxX = corner.chunk.x
+ if (minZ === undefined || corner.chunk.z < minZ) minZ = corner.chunk.z
+ if (maxZ === undefined || corner.chunk.z > maxZ) maxZ = corner.chunk.z
+ }
- const xSort = corners.sort((a, b) => a.chunk.x - b.chunk.x)
- const zSort = corners.sort((a, b) => a.chunk.z - b.chunk.z)
+ const xSort = [...corners].sort((a, b) => a.chunk.x - b.chunk.x)
+ const zSort = [...corners].sort((a, b) => a.chunk.z - b.chunk.z)
- let foundX, foundZ
- for (let i = 0; i < xSort.length - 1; i++) {
- if (xSort[i].chunk.x === xSort[i + 1].chunk.x) {
- foundZ = lerp(xSort[i].chunk.z, xSort[i + 1].chunk.z, 0.5)
- break
+ let foundX, foundZ
+ for (let i = 0; i < xSort.length - 1; i++) {
+ if (xSort[i].chunk.x === xSort[i + 1].chunk.x) {
+ foundZ = lerp(xSort[i].chunk.z, xSort[i + 1].chunk.z, 0.5)
+ break
+ }
}
- }
- for (let i = 0; i < zSort.length - 1; i++) {
- if (zSort[i].chunk.z === zSort[i + 1].chunk.z) {
- foundX = lerp(zSort[i].chunk.x, zSort[i + 1].chunk.x, 0.5)
- break
+ for (let i = 0; i < zSort.length - 1; i++) {
+ if (zSort[i].chunk.z === zSort[i + 1].chunk.z) {
+ foundX = lerp(zSort[i].chunk.x, zSort[i + 1].chunk.x, 0.5)
+ break
+ }
}
- }
+
+ if (foundX && foundZ) log.info(`Found solution: ${foundX}, ${foundZ}`)
+ setSolution({ minX, maxX, minZ, maxZ, foundX, foundZ })
+ }, [corners, setSolution])
+
+ const { minX, maxX, minZ, maxZ, foundX, foundZ } = solution
return (
- <>
-
- Setup bind for Lunar Client{' '} - mod{' '} - - Coordinates - {' '} - to "Copy Coords to Clipboard". -
+