git commit hash is now short on phones and long on desktops and tablets

This commit is contained in:
corgifist 2025-07-29 03:50:08 +03:00
parent 3a8c07b5df
commit 8b5b67522d
2 changed files with 7 additions and 5 deletions

View File

@ -14,6 +14,8 @@ import { getBuildID, getVersion } from "@/lib/build";
export default function Settings(): ReactNode {
const isMobile = useIsMobile();
const shortBuildId = useIsMobile(1024);
const buildID = getBuildID();
return (
<div className="p-5 w-full h-full">
@ -48,9 +50,9 @@ export default function Settings(): ReactNode {
</AscendingCard>
</Link>
<Link className="text-sm text-muted-foreground flex justify-center" target="_blank" href={
`https://github.com/ClipFusion-org/clipfusion/commit/${getBuildID()}`
`https://github.com/ClipFusion-org/clipfusion/commit/${buildID}`
}>
{getVersion()} ({getBuildID()})
{getVersion()} ({shortBuildId ? buildID?.slice(0, 7) : buildID})
</Link>
</div>
</WideContainer>

View File

@ -2,15 +2,15 @@ import * as React from "react"
const MOBILE_BREAKPOINT = 768
export function useIsMobile() {
export function useIsMobile(breakpoint: number = MOBILE_BREAKPOINT) {
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
React.useEffect(() => {
const onResize = () => {
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
setIsMobile(window.innerWidth < breakpoint)
};
window.addEventListener("resize", onResize)
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
setIsMobile(window.innerWidth < breakpoint)
return () => window.removeEventListener("resize", onResize)
}, []);