railyard/apps/ritgram/web/FIXES_AND_PLAN.md
caelum0x f80b04ae0f feat(ritgram): move GitGram app into railyard as Ritgram, next to Rithub
Moved later/gitgram-ai/gitgram/ to apps/ritgram/ (fresh history; full history stays in caelum0x/gitgram).
AITimeMachine stays separate in later/gitgram-ai per the Rithub master plan.
Logs, pid files and env files are ignored; GPL-3.0 mobile/proximity noted in THIRD_PARTY_NOTICES.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 04:18:46 +03:00

129 lines
4.3 KiB
Markdown

# Gitgram Web - Fixes and Implementation Plan
## โœ… COMPLETED FIXES
### 1. Landing Page Layout (FIXED)
- **Issue**: Content was left-aligned instead of centered
- **Fix**:
- Updated `ConditionalLayout` to handle landing page separately
- Added proper centering with `items-center justify-center` on main container
- Changed all text colors to use design system variables (white, foreground-secondary)
- Updated borders and backgrounds to use design system colors
### 2. GitHub OAuth Button (FIXED)
- **Issue**: Button didn't work, no error handling
- **Fix**:
- Added proper error handling for missing `NEXT_PUBLIC_GITHUB_CLIENT_ID`
- Added URL encoding for redirect URI
- Added user-friendly error messages
- Added try-catch for error handling
### 3. Global CSS Reset (FIXED)
- **Issue**: Default browser margins/padding causing layout issues
- **Fix**: Added proper CSS reset for html, body, and all elements
### 4. Auth Pages Centering (FIXED)
- **Issue**: Login/Register pages not centered
- **Fix**: Updated `ConditionalLayout` to properly center auth pages
## ๐Ÿ”ง IMPLEMENTATION PLAN
### Phase 1: Environment Setup (REQUIRED)
1. **Create `.env.local` file in `web/` directory:**
```env
NEXT_PUBLIC_GITHUB_CLIENT_ID=your_github_client_id_here
NEXT_PUBLIC_API_URL=http://localhost:4000/api
```
2. **Get GitHub OAuth Credentials:**
- Go to GitHub Settings > Developer settings > OAuth Apps
- Create new OAuth App
- Set Authorization callback URL: `http://localhost:3000/auth/github/callback`
- Copy Client ID to `.env.local`
### Phase 2: Backend API Verification
1. **Verify Backend Endpoints:**
- `/api/v1/auth/github` - GitHub OAuth callback handler
- `/api/v1/auth/login` - Email/password login
- `/api/v1/auth/register` - User registration
- All endpoints should return proper JSON responses
2. **Test API Connection:**
- Ensure backend is running on port 4000 (or update `NEXT_PUBLIC_API_URL`)
- Test with Postman/curl to verify endpoints work
### Phase 3: Frontend Functionality
1. **Authentication Flow:**
- โœ… GitHub OAuth button (with error handling)
- โœ… Email/password login
- โœ… User registration
- โœ… Token storage in Zustand store
- โœ… Protected routes
2. **Page Layouts:**
- โœ… Landing page (centered, proper styling)
- โœ… Login page (centered)
- โœ… Register page (centered)
- โœ… Feed page (with sidebar)
- โœ… Profile pages
- โœ… All other pages
### Phase 4: Testing Checklist
- [ ] Landing page displays centered
- [ ] "Connect with GitHub" button works (redirects to GitHub)
- [ ] GitHub OAuth callback works (redirects back and logs in)
- [ ] Login form works
- [ ] Register form works
- [ ] All pages are properly centered
- [ ] Navigation works
- [ ] Protected routes redirect to login if not authenticated
## ๐Ÿ› KNOWN ISSUES TO FIX
### 1. Environment Variables
- **Problem**: `NEXT_PUBLIC_GITHUB_CLIENT_ID` might not be set
- **Solution**: Create `.env.local` file (see Phase 1)
### 2. Backend Connection
- **Problem**: API might not be running or URL incorrect
- **Solution**: Verify `NEXT_PUBLIC_API_URL` in `.env.local`
### 3. GitHub OAuth Callback
- **Problem**: Callback URL must match GitHub OAuth app settings
- **Solution**: Ensure callback URL in GitHub matches: `http://localhost:3000/auth/github/callback`
## ๐Ÿ“ NEXT STEPS
1. **Set up environment variables** (`.env.local`)
2. **Start backend server** (if not running)
3. **Test GitHub OAuth flow** end-to-end
4. **Verify all pages load correctly**
5. **Test authentication flows**
## ๐ŸŽจ Design System Consistency
All pages now use:
- **Colors**: Design system variables (primary, background-dark, surface, etc.)
- **Typography**: Space Grotesk font
- **Spacing**: Consistent padding and margins
- **Layout**: Centered content with max-width constraints
- **Components**: Reusable UI components from `components/ui/`
## โš ๏ธ IMPORTANT NOTES
1. **GitHub OAuth requires:**
- GitHub OAuth App created
- Client ID in environment variables
- Backend endpoint `/api/v1/auth/github` working
2. **All functionality is REAL, not mocked:**
- Authentication uses real API calls
- All services connect to backend
- Error handling in place
3. **If something doesn't work:**
- Check browser console for errors
- Verify environment variables are set
- Ensure backend is running
- Check network tab for API calls