Skip to content

Commit

Permalink
Bump version, 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
raikasdev committed Jul 29, 2023
1 parent 3ffc48c commit c2d179e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mastopoet",
"private": true,
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
4 changes: 1 addition & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,11 @@ function App() {
<div className="center-text">
<h1>Mastopoet</h1>
<p>
The Mastodon post screenshot tool, running release v1.0.0 (
The Mastodon post screenshot tool, running v{__APP_VERSION__} (
<a
href="https://github.com/raikasdev/mastopoet"
className="commit-link"
>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/** @ts-ignore */}
{__COMMIT_HASH__}
</a>
)
Expand Down
32 changes: 8 additions & 24 deletions src/components/VerticalHandlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,23 @@ export default function VerticalHandlerbar({
const [holding, setHolding] = useState(false);
const ref = useRef<HTMLDivElement>(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(
Expand All @@ -59,7 +43,7 @@ export default function VerticalHandlerbar({
);

document.addEventListener("mousemove", mouseMove);
}, []);
}, [height]);

return (
<div
Expand Down
4 changes: 2 additions & 2 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function mastodonStatusToPost(
try {
const res = await axios.get(webFingerURL.toString(), {
headers: {
"User-Agent": "mastopoet/1.0.0",
"User-Agent": `mastopoet/${__APP_VERSION__}`,
},
});

Expand Down Expand Up @@ -146,7 +146,7 @@ export async function submitUrl(url: string) {
);
const res = await axios.get(targetUrl.toString(), {
headers: {
"User-Agent": "mastopoet/1.0.0",
"User-Agent": `mastopoet/${__APP_VERSION__}`,
},
});

Expand Down
5 changes: 4 additions & 1 deletion src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/// <reference types="vite/client" />
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;
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit c2d179e

Please sign in to comment.