From a1dc2b537043811f9c212e658ef54f71734f7c8a Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 06:51:53 +0000 Subject: [PATCH] Visual edit in Lovable Edited UI in Lovable --- src/components/SyncSettings.tsx | 58 ++++++++------------------------- 1 file changed, 14 insertions(+), 44 deletions(-) diff --git a/src/components/SyncSettings.tsx b/src/components/SyncSettings.tsx index df0f817..d14b617 100644 --- a/src/components/SyncSettings.tsx +++ b/src/components/SyncSettings.tsx @@ -1,4 +1,3 @@ - import React, { useState, useEffect } from 'react'; import { Switch } from "@/components/ui/switch"; import { Label } from "@/components/ui/label"; @@ -8,19 +7,18 @@ import { toast } from "@/components/ui/use-toast"; import { useAuth } from "@/contexts/AuthContext"; import { useNavigate } from "react-router-dom"; import { Button } from "@/components/ui/button"; - const SyncSettings = () => { const [enabled, setEnabled] = useState(isSyncEnabled()); const [syncing, setSyncing] = useState(false); const [lastSync, setLastSync] = useState(getLastSyncTime()); - const { user } = useAuth(); + const { + user + } = useAuth(); const navigate = useNavigate(); - useEffect(() => { // 마지막 동기화 시간 업데이트 setLastSync(getLastSyncTime()); }, []); - const handleSyncToggle = async (checked: boolean) => { if (!user && checked) { toast({ @@ -30,10 +28,8 @@ const SyncSettings = () => { }); return; } - setEnabled(checked); setSyncEnabled(checked); - if (checked && user) { // 동기화 활성화 시 즉시 동기화 실행 try { @@ -41,7 +37,7 @@ const SyncSettings = () => { await syncAllData(user.id); toast({ title: "동기화 설정 완료", - description: "모든 데이터가 클라우드에 동기화되었습니다.", + description: "모든 데이터가 클라우드에 동기화되었습니다." }); setLastSync(getLastSyncTime()); } catch (error) { @@ -55,7 +51,6 @@ const SyncSettings = () => { } } }; - const handleManualSync = async () => { if (!user) { toast({ @@ -65,13 +60,12 @@ const SyncSettings = () => { }); return; } - try { setSyncing(true); await syncAllData(user.id); toast({ title: "동기화 완료", - description: "모든 데이터가 클라우드에 동기화되었습니다.", + description: "모든 데이터가 클라우드에 동기화되었습니다." }); setLastSync(getLastSyncTime()); } catch (error) { @@ -84,16 +78,12 @@ const SyncSettings = () => { setSyncing(false); } }; - const formatLastSyncTime = () => { if (!lastSync) return "아직 동기화된 적 없음"; - const date = new Date(lastSync); return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`; }; - - return ( -
+ return
@@ -106,40 +96,20 @@ const SyncSettings = () => { 여러 기기에서 예산 및 지출 데이터를 동기화합니다.

- +
- {enabled && ( -
+ {enabled &&
마지막 동기화: {formatLastSyncTime()} - {user ? ( - - ) : ( - : - )} + }
-
- )} -
- ); +
} +
; }; - -export default SyncSettings; +export default SyncSettings; \ No newline at end of file