add tag version to footer (#725)
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { cn } from "@core/utils/cn.ts";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Trans } from "react-i18next";
|
||||
|
||||
type FooterProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const Footer = ({ className, ...props }: FooterProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<footer
|
||||
className={cn(
|
||||
@@ -16,11 +14,15 @@ const Footer = ({ className, ...props }: FooterProps) => {
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<div className="justify-start px-2">
|
||||
<div className="px-2">
|
||||
<span className="font-semibold text-gray-500/40 dark:text-gray-400/40">
|
||||
{t("footer.commitSha", {
|
||||
sha: String(import.meta.env.VITE_COMMIT_HASH)?.toUpperCase(),
|
||||
})}
|
||||
{String(import.meta.env.VITE_VERSION)?.toUpperCase()}
|
||||
</span>
|
||||
<span className="font-semibold text-gray-500/40 dark:text-gray-400/40 mx-2">
|
||||
-
|
||||
</span>
|
||||
<span className="font-semibold text-gray-500/40 dark:text-gray-400/40">
|
||||
{`#${String(import.meta.env.VITE_COMMIT_HASH)?.toUpperCase()}`}
|
||||
</span>
|
||||
</div>
|
||||
<p className="ml-auto mr-auto text-gray-500 dark:text-gray-400">
|
||||
|
||||
Vendored
+1
@@ -3,6 +3,7 @@
|
||||
interface ImportMetaEnv {
|
||||
readonly env: {
|
||||
readonly VITE_COMMIT_HASH: string;
|
||||
readonly VITE_VERSION: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
let hash = "";
|
||||
let version = "v0.0.0";
|
||||
try {
|
||||
hash = execSync("git rev-parse --short HEAD", { encoding: "utf8" }).trim();
|
||||
} catch (error) {
|
||||
@@ -13,6 +14,14 @@ try {
|
||||
hash = "DEV";
|
||||
}
|
||||
|
||||
try {
|
||||
version = execSync("git describe --tags --abbrev=0", {
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
} catch (error) {
|
||||
console.error("Error getting git version:", error);
|
||||
}
|
||||
|
||||
const CONTENT_SECURITY_POLICY =
|
||||
"script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' data: https://rsms.me https://cdn.jsdelivr.net; img-src 'self' data:; font-src 'self' data: https://rsms.me https://cdn.jsdelivr.net; worker-src 'self' blob:; object-src 'none'; base-uri 'self';";
|
||||
|
||||
@@ -37,6 +46,7 @@ export default defineConfig({
|
||||
},
|
||||
define: {
|
||||
"import.meta.env.VITE_COMMIT_HASH": JSON.stringify(hash),
|
||||
"import.meta.env.VITE_VERSION": JSON.stringify(version),
|
||||
},
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
|
||||
Reference in New Issue
Block a user