# glancr UI The React frontend for **glancr** - a modern Markdown documentation viewer. This UI provides a clean, responsive interface built with React 19, TypeScript, and Vite. ## Tech Stack - **React 19** - Latest React with concurrent features - **TypeScript** - Type-safe JavaScript development - **Vite** - Fast build tool and dev server - **ESLint** - Code linting and quality checks - **Prettier** - Code formatting - **CSS3** - Modern styling with CSS custom properties ## Prerequisites - **Node.js** 18+ - **npm** (comes with Node.js) ## Quick Start ### Development 1. **Install dependencies** ```bash npm install ``` 2. **Start development server** ```bash npm run dev ``` The UI will be available at http://localhost:5173 3. **Start with backend** (recommended) ```bash npm run dev:full ``` This starts both the Vite dev server and the Go backend server. ### Production Build ```bash npm run build ``` Outputs optimized files to `dist/` directory. ## Available Scripts ### Development - `npm run dev` - Start Vite dev server only - `npm run dev:full` - Start both frontend and backend servers - `npm run watch` - Build in watch mode ### Building - `npm run build` - Production build - `npm run preview` - Preview production build locally ### Code Quality - `npm run lint` - Run ESLint checks - `npm run lint:fix` - Fix auto-fixable ESLint issues - `npm run format` - Format code with Prettier - `npm run format:check` - Check if code is properly formatted ## Project Structure ``` ui/ ├── src/ │ ├── assets/ # Static assets (images, icons, etc.) │ ├── App.tsx # Main application component │ ├── App.css # Application styles │ ├── main.tsx # Application entry point │ ├── index.css # Global styles │ └── vite-env.d.ts # Vite type definitions ├── public/ # Public static files ├── dist/ # Build output (generated) ├── index.html # HTML template ├── package.json # Dependencies and scripts ├── vite.config.ts # Vite configuration ├── tsconfig.json # TypeScript configuration ├── tsconfig.app.json # App-specific TypeScript config ├── tsconfig.node.json # Node-specific TypeScript config ├── eslint.config.ts # ESLint configuration └── prettier.config.ts # Prettier configuration ``` ## Development Guidelines ### Code Style - **TypeScript**: Use strict type checking - **Components**: Functional components with hooks - **Naming**: PascalCase for components, camelCase for functions/variables - **Imports**: Use absolute imports when possible ### File Organization As the project grows, consider this structure: ``` src/ ├── components/ # Reusable UI components │ ├── common/ # Generic components │ └── markdown/ # Markdown-specific components ├── hooks/ # Custom React hooks ├── types/ # TypeScript type definitions ├── utils/ # Utility functions ├── styles/ # CSS modules or styled components └── api/ # API client functions ``` ### Component Guidelines - Use TypeScript interfaces for prop types - Implement proper error boundaries - Follow React best practices for hooks - Use semantic HTML elements - Ensure accessibility (ARIA labels, keyboard navigation) Example component structure: ```typescript interface MyComponentProps { title: string; onAction?: () => void; } export function MyComponent({ title, onAction }: MyComponentProps) { // Component logic here return (