Add GitHub Profile Card API and UI#10
Conversation
- Rename `public/edge-functions` to `public/functions`. - Add `public/functions/api/card.js` to serve dynamic SVG profile cards. - Update `public/functions/api/user/data.js` to store `latest_5` stats in KV. - Update frontend to pre-calculate simplified route geometries and stats. - Add "GitHub Decoration" button in StatsView.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Redesigned `/api/card` endpoint to output a Glassmorphic SVG (1:2 ratio, translucent slate background). - Implemented secure access via unique `card_key` (UUID) instead of username. - Created `public/functions/api/user/key.js` to handle secure key generation and persistence. - Added reverse index lookup in KV (`card_key:UUID` -> `username`). - Updated frontend `GithubCardModal` to fetch and use the secure key. - Sanitized SVG input to prevent injection.
- Refactor `calculateLatestStats` in frontend to support multiple path segments (M/L commands) preventing incorrect line connections. - Add fallback geometry calculation using `geoData` to prevent blank SVGs when cache is cold. - Update `api/card.js` to render `<path>` instead of `<polyline>` and allow M/L commands in sanitization. - Enhance security in `api/user/data.js` by explicitly filtering sensitive fields (password) from responses. - Enforce strict key-based access in `api/card.js` (removed legacy user param).
- Refactor `RouteSlice` logic into a shared helper `getRouteVisualData` in `src/RailRound.jsx`. - Update `calculateLatestStats` to use `getRouteVisualData` for generating card SVG data, ensuring consistency with the frontend UI. - Pass `geoData` to `calculateLatestStats` to enable on-the-fly geometry calculation (fallback for cold cache). - Update `api/card.js` to support SVG path commands (M/L) and sanitized input.
- Updated `api/card.js` to render 5 items (previously 3). - Changed SVG card dimensions to 600x340px (approx 2:1 ratio). - Redesigned layout: Moved statistics to the top-right, aligned with the header. - Improved readability: Switched text colors to solid white/slate (removed opacity). - Enforced strict usage of standard Lucide 'Train' icon paths. - Verified frontend logic (`slice(0, 5)`) matches backend rendering capacity.
Implemented a GitHub profile decoration feature. The frontend now calculates summary statistics and simplified route geometries (using PCA) for the 5 most recent trips. This data is saved to the KV store under a new
latest_5key. A new API endpoint/api/cardreads this pre-calculated data to generate a performant SVG image suitable for embedding in GitHub READMEs. Theedge-functionsdirectory was renamed tofunctionsas per platform requirements.PR created automatically by Jules for task 4409883855516395714 started by @OsakaLOOP