fix: use snapshot version for dev

This commit is contained in:
ReaJason
2025-04-06 11:39:11 +08:00
parent c0f3eed50e
commit 262820a987
3 changed files with 7 additions and 7 deletions
@@ -36,7 +36,7 @@ public class VersionController {
@GetMapping
public VersionInfo version() {
if ("dev".equals(version)) {
if (version.endsWith("-SNAPSHOT")) {
return VersionInfo.builder()
.currentVersion(version)
.latestVersion(version).build();
+4 -3
View File
@@ -1,5 +1,6 @@
import { Button, type ButtonProps } from "@/components/ui/button";
import { Button, buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { VariantProps } from "class-variance-authority";
import { Check, Copy } from "lucide-react";
import { type HTMLProps, type ReactNode, useCallback, useEffect, useState } from "react";
import { CopyToClipboard } from "react-copy-to-clipboard";
@@ -8,12 +9,12 @@ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { materialDark } from "react-syntax-highlighter/dist/esm/styles/prism";
import { toast } from "sonner";
interface CopyButtonProps extends ButtonProps {
interface CopyButtonProps extends React.ComponentProps<"button"> {
value: string;
src?: string;
}
export function CopyButton({ value }: Readonly<CopyButtonProps>) {
export function CopyButton({ value }: Readonly<CopyButtonProps & VariantProps<typeof buttonVariants>>) {
const [hasCopied, setHasCopied] = useState(false);
const { t } = useTranslation();
+2 -3
View File
@@ -25,7 +25,6 @@ const VersionBadge: React.FC = () => {
});
const inProduction = env.MODE === "production";
const { t } = useTranslation();
const version = data?.currentVersion === "dev" ? data?.currentVersion : `v${data?.currentVersion}`;
return (
<div className="flex items-center space-x-2">
@@ -77,11 +76,11 @@ const VersionBadge: React.FC = () => {
)}
{data && (!data.hasUpdate || !inProduction) && (
<Button
className="rounded-full bg-green-500 text-white hover:bg-green-600 hover:text-white"
className="rounded-full text-xs bg-green-500 text-white hover:bg-green-600 hover:text-white"
size="sm"
variant="ghost"
>
<span>{version}</span>
<span>v{data?.currentVersion}</span>
</Button>
)}
</div>