Visual edit in Lovable
Edited UI in Lovable
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
|
||||
import React, { useCallback, useEffect, useState, useRef } from 'react';
|
||||
import { getAppVersionInfo, isAndroidPlatform } from '@/utils/platform';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
|
||||
interface AppVersionInfoProps {
|
||||
className?: string;
|
||||
showDevInfo?: boolean; // 개발자 정보 표시 여부
|
||||
editable?: boolean; // 편집 가능 여부
|
||||
}
|
||||
|
||||
const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
className,
|
||||
showDevInfo = true,
|
||||
@@ -24,7 +21,6 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
versionName: '1.0.0',
|
||||
buildNumber: 1
|
||||
});
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState(false);
|
||||
const [retries, setRetries] = useState(0);
|
||||
@@ -38,7 +34,6 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
if (!editable) {
|
||||
setLoading(true);
|
||||
setError(false);
|
||||
|
||||
try {
|
||||
console.log('앱 버전 정보 요청 시작... (retries:', retries, ')');
|
||||
console.log('현재 플랫폼은', isAndroidPlatform() ? 'Android' : '기타');
|
||||
@@ -47,7 +42,6 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
if (retries > 0) {
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
}
|
||||
|
||||
const info = await getAppVersionInfo();
|
||||
console.log('받은 앱 버전 정보:', info);
|
||||
|
||||
@@ -55,7 +49,6 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
if (!info || typeof info !== 'object') {
|
||||
throw new Error('유효하지 않은 응답 형식');
|
||||
}
|
||||
|
||||
setVersionInfo({
|
||||
versionName: info.versionName,
|
||||
buildNumber: info.buildNumber,
|
||||
@@ -65,7 +58,6 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
// 편집 가능한 필드도 업데이트
|
||||
setEditableVersionName(info.versionName);
|
||||
setEditableBuildNumber(String(info.buildNumber));
|
||||
|
||||
setLoading(false);
|
||||
console.log('앱 버전 정보 표시 준비 완료');
|
||||
} catch (error) {
|
||||
@@ -111,10 +103,8 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
}
|
||||
}
|
||||
}, [fetchVersionInfo, error, loading, editable]);
|
||||
|
||||
if (editable) {
|
||||
return (
|
||||
<div className={className}>
|
||||
return <div className={className}>
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<Label htmlFor="versionName">앱 버전</Label>
|
||||
@@ -131,44 +121,24 @@ const AppVersionInfo: React.FC<AppVersionInfoProps> = ({
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="notes">메모</Label>
|
||||
<Textarea
|
||||
id="notes"
|
||||
placeholder="추가 정보를 입력하세요"
|
||||
className="h-20"
|
||||
/>
|
||||
<Label htmlFor="notes">세부 설명</Label>
|
||||
<Textarea id="notes" placeholder="추가 정보를 입력하세요" className="h-20" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
</div>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{loading ? (
|
||||
<div className="py-1 text-center">
|
||||
return <div className={className}>
|
||||
{loading ? <div className="py-1 text-center">
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
) : (
|
||||
<div className="py-1 text-center">
|
||||
</div> : <div className="py-1 text-center">
|
||||
<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>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
{showDevInfo && versionInfo.versionCode && <p className="text-xs text-gray-400 mt-1 font-mono">versionCode: {versionInfo.versionCode}</p>}
|
||||
</div>}
|
||||
</div>;
|
||||
};
|
||||
|
||||
export default AppVersionInfo;
|
||||
Reference in New Issue
Block a user