diff --git a/package.json b/package.json
index a79788f..5d42757 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "mastopoet",
"private": true,
- "version": "1.0.0",
+ "version": "1.0.1",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/src/App.tsx b/src/App.tsx
index ee42d0e..95a1477 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -101,13 +101,11 @@ function App() {
Mastopoet
- The Mastodon post screenshot tool, running release v1.0.0 (
+ The Mastodon post screenshot tool, running v{__APP_VERSION__} (
- {/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
- {/** @ts-ignore */}
{__COMMIT_HASH__}
)
diff --git a/src/components/VerticalHandlebar.tsx b/src/components/VerticalHandlebar.tsx
index c3bc1ca..f61bacd 100644
--- a/src/components/VerticalHandlebar.tsx
+++ b/src/components/VerticalHandlebar.tsx
@@ -14,39 +14,23 @@ export default function VerticalHandlerbar({
const [holding, setHolding] = useState(false);
const ref = useRef(null);
- // 27.7.2023: I have no f*cking idea how I got this working, but it works now.
- // https://tenor.com/view/do-not-touch-it-programmer-walking-cow-coding-gif-17252607
-
const globalize = (num: number) => num + window.scrollY;
const handleMouseDown = useCallback(() => {
setHolding(true);
- let y =
+ const y =
side === "top"
- ? globalize(ref.current?.getBoundingClientRect().top || 0) + height
+ ? globalize(ref.current?.getBoundingClientRect().top || 0) +
+ height / 2 +
+ 12
: globalize(ref.current?.getBoundingClientRect().bottom || 0) -
- height * 2;
-
- let localHeight = height;
-
- const setLocalHeight = (val: number) => {
- if (val < 0) val = 0;
- if (val > 200) val = 200;
- localHeight = val;
-
- setHeight(val);
- };
+ height / 2 -
+ 4;
const mouseMove = (event: MouseEvent) => {
const difference = side === "top" ? y - event.pageY : event.pageY - y;
- y =
- side === "top"
- ? globalize(ref.current?.getBoundingClientRect().top || 0) +
- localHeight
- : globalize(ref.current?.getBoundingClientRect().bottom || 0) -
- localHeight;
- setLocalHeight(difference);
+ setHeight(difference * 2);
};
document.addEventListener(
@@ -59,7 +43,7 @@ export default function VerticalHandlerbar({
);
document.addEventListener("mousemove", mouseMove);
- }, []);
+ }, [height]);
return (
-declare module "react-best-gradient-color-picker";
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+let __APP_VERSION__: string;
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+let __COMMIT_HASH__: string;
diff --git a/vite.config.ts b/vite.config.ts
index 56880c3..ecaccc4 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -2,13 +2,17 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import stylelint from "vite-plugin-stylelint";
import { execSync } from "child_process";
-
+import { readFileSync } from "fs";
const commitHash = execSync("git rev-parse --short HEAD").toString().trim();
+const packageJson = JSON.parse(
+ readFileSync("./package.json").toString("utf-8"),
+);
// https://vitejs.dev/config/
export default defineConfig({
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
+ __APP_VERSION__: JSON.stringify(packageJson.version),
},
plugins: [
react(),