Skip to content

Add GitHub Profile Card API and UI#10

Draft
google-labs-jules[bot] wants to merge 6 commits intomainfrom
feature/github-profile-card-4409883855516395714
Draft

Add GitHub Profile Card API and UI#10
google-labs-jules[bot] wants to merge 6 commits intomainfrom
feature/github-profile-card-4409883855516395714

Conversation

@google-labs-jules
Copy link
Contributor

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_5 key. A new API endpoint /api/card reads this pre-calculated data to generate a performant SVG image suitable for embedding in GitHub READMEs. The edge-functions directory was renamed to functions as per platform requirements.


PR created automatically by Jules for task 4409883855516395714 started by @OsakaLOOP

- 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.
@google-labs-jules
Copy link
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants