Spaces:
Running
Running
Upload pages/index.js with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135import React, { useState } from 'react';import Sidebar from '../components/Sidebar';import CodeEditor from '../components/CodeEditor';
export default function Home() { const [files] = useState([ { id: 1, name: "styles/global.css", type: "css", status: "modified", content: `body { background-color: #0f1117; color: #f0f6fc; /* Updated contrast for better readability */}
.sidebar { width: 320px; border-right: 1px solid #30363d;}` }, { id: 2, name: "components/Header.js", type: "js", status: "modified", content: `import React from 'react';import { Link } from 'react-router-dom';
const Header = () => { return ( <header> <h1>DevTrack</h1> {/* Added new navigation link */} <Link to="/settings">Settings</Link> </header> );}` }, { id: 3, name: "utils/helpers.ts", type: "ts", status: "added", content: `export function calculateDiff(oldStr: string, newStr: string) { const diff = []; // Implementation of LCS algorithm return diff;}
export const VERSION = '1.0.4';` }, { id: 4, name: "assets/old_logo.png", type: "img", status: "deleted", content: `[Binary File Deleted - Original Logo Removed]` }, { id: 5, name: "package.json", type: "json", status: "modified", content: `{ "name": "dev-track-app", "version": "2.1.0", "dependencies": { "react": "^18.2.0", "lodash": "^4.17.21" // Updated version }}` } ]);
const [selectedFileId, setSelectedFileId] = useState(null); const [filter, setFilter] = useState('all');
const selectedFile = files.find(f => f.id === selectedFileId); const modifiedFilesCount = files.filter(f => f.status === 'modified').length;
const handleCommit = () => { if (!selectedFileId) return; alert(`Changes in ${selectedFile.name} committed successfully!`); // In a real app, this would update the state };
const handleDiscard = () => { if (!selectedFileId) return; if (confirm(`Are you sure you want to discard changes in ${selectedFile.name}?`)) { setSelectedFileId(null); } };
return ( <div className="flex flex-col h-screen bg-app-bg text-app-text font-sans selection:bg-accent-primary/30"> {/* Header */} <header className="h-16 border-b border-app-bg flex items-center justify-between px-6 bg-app-bg/90 backdrop-blur-sm sticky top-0 z-50"> <div className="flex items-center gap-3"> <div className="p-2 bg-app-sidebar rounded-lg border border-app-border"> <i className="fa-solid fa-code-branch text-accent-primary text-xl"></i> </div> <h1 className="font-semibold text-lg tracking-tight">DevTrack UI</h1> </div> <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" rel="noopener noreferrer" className="text-xs font-medium text-app-muted hover:text-accent-primary transition-colors flex items-center gap-2 px-3 py-1.5 rounded-full bg-app-sidebar border border-app-border hover:border-accent-primary/50 hover:bg-accent-primary/10" > <span>anycoder</span> <i className="fa-solid fa-arrow-up-right-from-square text-[10px]"></i> </a> </header>
{/* Main Workspace */} <main className="flex-1 flex overflow-hidden"> <Sidebar files={files} selectedId={selectedFileId} onSelect={setSelectedFileId} filter={filter} setFilter={setFilter} /> <CodeEditor file={selectedFile} onCommit={handleCommit} onDiscard={handleDiscard} /> </main> </div> );}pages/index.jsAdded+135