Display app version information

Display the app version and build number in the settings. Remove the build number and the number 1 below the app version.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-21 12:19:51 +00:00
parent 6c85debea5
commit 7fb0299c57

View File

@@ -1,11 +1,13 @@
import React, { useCallback, useEffect, useState, useRef } from 'react'; import React, { useCallback, useEffect, useState, useRef } from 'react';
import { getAppVersionInfo, isAndroidPlatform } from '@/utils/platform'; import { getAppVersionInfo, isAndroidPlatform } from '@/utils/platform';
import { Label } from '@/components/ui/label'; import { Label } from '@/components/ui/label';
interface AppVersionInfoProps { interface AppVersionInfoProps {
className?: string; className?: string;
showDevInfo?: boolean; // 개발자 정보 표시 여부 showDevInfo?: boolean;
editable?: boolean; // 편집 가능 여부 editable?: boolean;
} }
const AppVersionInfo: React.FC<AppVersionInfoProps> = ({ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
className, className,
showDevInfo = true, showDevInfo = true,
@@ -125,18 +127,29 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
</div> </div>
</div>; </div>;
} }
return <div className={className}> return (
{loading ? <div className="py-1 text-center"> <div className={className}>
{loading ? (
<div className="py-1 text-center">
<p className="text-sm text-gray-400 animate-pulse"> ...</p> <p className="text-sm text-gray-400 animate-pulse"> ...</p>
</div> : error ? <div className="py-1 text-center"> </div>
) : error ? (
<div className="py-1 text-center">
<p className="text-sm text-red-500"> </p> <p className="text-sm text-red-500"> </p>
<button onClick={handleRetry} className="text-xs text-blue-500 underline mt-1 px-2 py-0.5 rounded hover:bg-blue-50"> <button onClick={handleRetry} className="text-xs text-blue-500 underline mt-1 px-2 py-0.5 rounded hover:bg-blue-50">
</button> </button>
</div> : <div className="py-1 text-center"> </div>
<p className="text-sm"> {versionInfo.versionName} <span className="font-mono">( {versionInfo.buildNumber})</span></p> ) : (
{showDevInfo && versionInfo.versionCode && <p className="text-xs text-gray-400 mt-1 font-mono">versionCode: {versionInfo.versionCode}</p>} <div className="py-1 text-center">
</div>} <p className="text-sm">{versionInfo.versionName} (build {versionInfo.buildNumber})</p>
</div>; {showDevInfo && versionInfo.versionCode && (
<p className="text-xs text-gray-400 mt-1 font-mono">versionCode: {versionInfo.versionCode}</p>
)}
</div>
)}
</div>
);
}; };
export default AppVersionInfo;
export default AppVersionInfo;