Severian commited on
Commit
ebf109c
·
verified ·
1 Parent(s): 1b6fd69

Update App.tsx

Browse files
Files changed (1) hide show
  1. App.tsx +39 -19
App.tsx CHANGED
@@ -167,6 +167,7 @@ const MAX_HISTORY_ITEMS = 10;
167
  // --- MAIN COMPONENT ---
168
 
169
  const App: React.FC = () => {
 
170
  const [history, setHistory] = useLocalStorage<JobHistoryItem[]>('ace-copywriting-history', []);
171
  const [preferences, setPreferences] = useUserPreferences();
172
  const [view, setView] = useState<ViewState>(() => history.length > 0 ? { type: 'new_job' } : { type: 'welcome' });
@@ -710,35 +711,37 @@ const App: React.FC = () => {
710
  if (!storageInfo) return null;
711
 
712
  return (
713
- <div className="bg-gray-700 rounded-lg p-4 mb-4">
714
  <div className="flex items-center justify-between mb-2">
715
- <h3 className="text-sm font-semibold text-gray-200">Storage Status</h3>
716
  <button
717
  onClick={clearAllData}
718
- className="text-xs px-2 py-1 bg-red-600 hover:bg-red-700 text-white rounded"
 
719
  >
720
- Clear All Data
721
  </button>
722
  </div>
723
- <div className="grid grid-cols-2 gap-4 text-xs">
724
  <div>
725
- <div className="text-gray-400">Storage Used</div>
726
- <div className="text-white">{storageInfo.usedSpace}KB / {storageInfo.totalSpace}KB</div>
727
  <div className="w-full bg-gray-600 rounded-full h-1 mt-1">
728
  <div
729
- className={`h-1 rounded-full ${storageInfo.usedPercentage > 80 ? 'bg-red-500' : storageInfo.usedPercentage > 60 ? 'bg-yellow-500' : 'bg-green-500'}`}
730
  style={{ width: `${Math.min(storageInfo.usedPercentage, 100)}%` }}
731
  ></div>
732
  </div>
733
  </div>
734
  <div>
735
- <div className="text-gray-400">Job History</div>
736
- <div className="text-white">{storageInfo.historyCount} / {storageInfo.maxHistoryItems}</div>
737
  </div>
738
  </div>
739
  {storageInfo.usedPercentage > 80 && (
740
- <div className="text-xs text-yellow-400 mt-2">
741
- ⚠️ Storage is getting full. Consider clearing old jobs.
 
742
  </div>
743
  )}
744
  </div>
@@ -747,11 +750,29 @@ const App: React.FC = () => {
747
 
748
  return (
749
  <div className="flex h-screen bg-gray-900 text-gray-100">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
750
  {/* --- SIDEBAR --- */}
751
- <aside className="w-80 bg-gray-800/50 p-4 flex flex-col flex-shrink-0 border-r border-gray-700 overflow-hidden">
752
- <header className="px-2 mb-6">
753
- <h1 className="text-2xl font-bold text-white tracking-tight">ACE Pipeline</h1>
754
- </header>
755
  <button
756
  onClick={handleStartNewJob}
757
  className={`w-full flex items-center gap-3 p-3 rounded-lg text-left font-semibold mb-4 transition-colors min-w-0 ${getActiveJobId() === jobId && view.type === 'new_job' ? 'bg-blue-600 text-white' : 'bg-gray-700 hover:bg-gray-600 text-gray-200'}`}
@@ -809,9 +830,9 @@ const App: React.FC = () => {
809
  </aside>
810
 
811
  {/* --- MAIN CONTENT --- */}
812
- <main className="flex-grow p-8 flex items-center justify-center overflow-auto">
813
  {error && view.type === 'new_job' && (
814
- <div className="fixed top-4 right-4 max-w-sm text-left text-red-200 bg-red-900/70 p-4 rounded-lg shadow-lg border border-red-700">
815
  <div className="flex items-start justify-between gap-3">
816
  <div>
817
  <div className="font-semibold">Issues detected during processing</div>
@@ -834,7 +855,6 @@ const App: React.FC = () => {
834
  </div>
835
  )}
836
  {renderMainContent()}
837
- <StorageInfoComponent />
838
  </main>
839
 
840
  {/* --- DELETE CONFIRMATION DIALOG --- */}
 
167
  // --- MAIN COMPONENT ---
168
 
169
  const App: React.FC = () => {
170
+ const { user, logout } = useAuth();
171
  const [history, setHistory] = useLocalStorage<JobHistoryItem[]>('ace-copywriting-history', []);
172
  const [preferences, setPreferences] = useUserPreferences();
173
  const [view, setView] = useState<ViewState>(() => history.length > 0 ? { type: 'new_job' } : { type: 'welcome' });
 
711
  if (!storageInfo) return null;
712
 
713
  return (
714
+ <div className="bg-gray-700/80 backdrop-blur-sm rounded-lg p-3 border border-gray-600">
715
  <div className="flex items-center justify-between mb-2">
716
+ <h3 className="text-xs font-semibold text-gray-200">Storage</h3>
717
  <button
718
  onClick={clearAllData}
719
+ className="text-xs px-2 py-1 bg-red-600 hover:bg-red-700 text-white rounded transition-colors"
720
+ title="Clear all stored data"
721
  >
722
+ Clear
723
  </button>
724
  </div>
725
+ <div className="grid grid-cols-2 gap-3 text-xs">
726
  <div>
727
+ <div className="text-gray-400 text-xs">Used</div>
728
+ <div className="text-white font-medium">{storageInfo.usedSpace}KB</div>
729
  <div className="w-full bg-gray-600 rounded-full h-1 mt-1">
730
  <div
731
+ className={`h-1 rounded-full transition-all ${storageInfo.usedPercentage > 80 ? 'bg-red-500' : storageInfo.usedPercentage > 60 ? 'bg-yellow-500' : 'bg-green-500'}`}
732
  style={{ width: `${Math.min(storageInfo.usedPercentage, 100)}%` }}
733
  ></div>
734
  </div>
735
  </div>
736
  <div>
737
+ <div className="text-gray-400 text-xs">History</div>
738
+ <div className="text-white font-medium">{storageInfo.historyCount}/{storageInfo.maxHistoryItems}</div>
739
  </div>
740
  </div>
741
  {storageInfo.usedPercentage > 80 && (
742
+ <div className="text-xs text-yellow-400 mt-2 flex items-center gap-1">
743
+ <span>⚠️</span>
744
+ <span>Storage full</span>
745
  </div>
746
  )}
747
  </div>
 
750
 
751
  return (
752
  <div className="flex h-screen bg-gray-900 text-gray-100">
753
+ {/* --- FIXED HEADER --- */}
754
+ <div className="fixed top-0 left-0 right-0 z-40 bg-gray-800/95 backdrop-blur-sm border-b border-gray-700 px-6 py-3">
755
+ <div className="flex justify-between items-center">
756
+ <div className="flex items-center gap-4">
757
+ <h1 className="text-xl font-bold text-white">ACE Pipeline</h1>
758
+ <div className="text-sm text-gray-400">
759
+ {user?.name && `Welcome, ${user.name}`}
760
+ </div>
761
+ </div>
762
+ <div className="flex items-center gap-4">
763
+ <StorageInfoComponent />
764
+ <button
765
+ onClick={() => logout()}
766
+ className="bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded text-sm font-medium transition-colors"
767
+ >
768
+ Sign Out
769
+ </button>
770
+ </div>
771
+ </div>
772
+ </div>
773
+
774
  {/* --- SIDEBAR --- */}
775
+ <aside className="w-80 bg-gray-800/50 p-4 flex flex-col flex-shrink-0 border-r border-gray-700 overflow-hidden" style={{ marginTop: '60px' }}>
 
 
 
776
  <button
777
  onClick={handleStartNewJob}
778
  className={`w-full flex items-center gap-3 p-3 rounded-lg text-left font-semibold mb-4 transition-colors min-w-0 ${getActiveJobId() === jobId && view.type === 'new_job' ? 'bg-blue-600 text-white' : 'bg-gray-700 hover:bg-gray-600 text-gray-200'}`}
 
830
  </aside>
831
 
832
  {/* --- MAIN CONTENT --- */}
833
+ <main className="flex-grow p-8 flex items-center justify-center overflow-auto" style={{ marginTop: '60px' }}>
834
  {error && view.type === 'new_job' && (
835
+ <div className="fixed top-20 right-4 max-w-sm text-left text-red-200 bg-red-900/70 p-4 rounded-lg shadow-lg border border-red-700 z-50">
836
  <div className="flex items-start justify-between gap-3">
837
  <div>
838
  <div className="font-semibold">Issues detected during processing</div>
 
855
  </div>
856
  )}
857
  {renderMainContent()}
 
858
  </main>
859
 
860
  {/* --- DELETE CONFIRMATION DIALOG --- */}