Skip to content

feat: implemented gists#293

Open
Cyberistic wants to merge 19 commits intobetter-auth:mainfrom
Cyberistic:feat/gists
Open

feat: implemented gists#293
Cyberistic wants to merge 19 commits intobetter-auth:mainfrom
Cyberistic:feat/gists

Conversation

@Cyberistic
Copy link
Contributor

@Cyberistic Cyberistic commented Mar 5, 2026

Changes

  • Added gists tab to user profile with count badge, similar to how repos work
  • Tried best to match api calls to gist.github.com

In profile:
image

gist view:
image

TODO

  • Add ability to comment
  • Show stars for each gist in profile (also repos don't have stars in profile either?)
  • Add ability to create gist under /gist
image - Update extensions to auto redirect from gist.github.com - Needs better skeletons and loading for gist page - Still a lot of work needed, but basic system is there

- Added gists tab to user profile with count badge
- Implemented search and filters (All, Public, Secret, Starred)
- Added sorting by Updated/Created
- Created gist detail page with file viewer
- Added API functions for fetching gists and starred gists
- Added caching support for gist data
@vercel
Copy link

vercel bot commented Mar 5, 2026

@Cyberistic is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

- Added gist route at /[owner]/gist/[gistId] to match link URLs
- Fixed import path in /gists/[gistId] page
- Made stars field optional in UserGist interface
- Gists now redirect to owner-specific URLs
- Add GistStarButton component for starring/unstarring gists
- Create server actions for gist star/unstar operations
- Update fetchGistFromGitHub to check viewer star status
- Add viewerHasStarred field to GistDetail type
- Refactor gist page into layout with tab navigation:
  - Create GistNav component matching repo tab style
  - Create GistHeader component for shared header
  - Create separate pages for Files, Revisions, and Comments tabs
  - Remove sidebar revisions panel in favor of tab
- Add modular components: gist-files, gist-revisions, gist-comments
- Delete monolithic gist-detail-content.tsx
@Cyberistic Cyberistic marked this pull request as ready for review March 5, 2026 02:58
Copilot AI review requested due to automatic review settings March 5, 2026 02:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a gists feature to the user profile, enabling users to view gists associated with any user profile (including public, secret, and starred gist filtering), as well as a dedicated gist detail view with file rendering, revision history, and comments.

Changes:

  • Adds a "Gists" tab to user profiles with filtering (all/public/secret/starred), sorting, and search
  • Adds a gist detail page at /:owner/gist/:gistId with file rendering, revision history, and comments sub-pages
  • Improves the contribution chart and repo list for mobile responsiveness

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
apps/web/src/proxy.ts Routes /:owner/gist/:gistId to the internal /repos/:owner/gist/:gistId app path
apps/web/src/lib/github.ts Adds getUserGists, getUserStarredGists, getGist, getGistComments API functions with caching and sync job support
apps/web/src/lib/github-types.ts Defines new shared UserGist, GistDetail, and GistComment interfaces
apps/web/src/lib/github-utils.ts Extends URL parsing and internal URL routing to handle gist.github.com URLs
apps/web/src/components/users/user-profile-gists.tsx New component rendering a list of gists with metadata
apps/web/src/components/users/user-profile-content.tsx Adds gists tab to user profile, plus mobile layout improvements for repos and contribution chart
apps/web/src/components/gist/ New gist-specific components: header, file viewer, revisions, comments, nav, star button
apps/web/src/app/(app)/repos/[owner]/gist/ New gist pages (layout, files, revisions, comments) and server actions for starring
apps/web/src/app/(app)/[owner]/page.tsx Fetches gists and starred gists alongside existing profile data
apps/web/src/components/dashboard/contribution-chart.tsx Adds mobile half-year toggle, touch/hold interactions, and tooltip Y-axis positioning
apps/web/next.config.ts Adds gists to the known routes list to prevent URL rewriting
apps/web/prisma/migrations/20260228005751_init/migration.sql Placeholder migration file for DB backwards compatibility
CONTRIBUTING.md Updates npx to bunx for Prisma commands

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +9 to +16
export function GistComments({ gist, comments }: GistCommentsProps) {
return (
<div className="border border-border rounded-md overflow-hidden">
<div className="px-4 py-3 border-b border-border bg-muted/30">
<h3 className="text-sm font-medium">Comments</h3>
</div>
<div className="p-4">
<CommentThread comments={comments} />
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gist prop in GistComments is declared in the GistCommentsProps interface and destructured, but it is never actually used inside the component body. This unused prop adds unnecessary complexity. If it's intended for future use (e.g., to show context or allow adding comments), it should be noted with a comment; otherwise it should be removed.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended for the future

Comment on lines +92 to +96
// /:owner/gist/:gistId → /repos/:owner/gist/:gistId
if (repo === "gist" && rest[0]) {
const url = request.nextUrl.clone();
url.pathname = `/repos/${owner}/gist/${rest.join("/")}`;
return NextResponse.rewrite(url);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says // /:owner/gist/:gistId → /repos/:owner/gist/:gistId but this route also handles sub-paths (like /:owner/gist/:gistId/revisions and /:owner/gist/:gistId/comments). The comment should mention that sub-paths are included, e.g. // /:owner/gist/:gistId(/...) → /repos/:owner/gist/:gistId(/...).

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +26
export interface UserGist {
id: string;
description: string | null;
html_url: string;
public: boolean;
created_at: string;
updated_at: string;
stars?: number;
files: Record<
string,
{
filename: string;
type: string;
language: string | null;
size: number;
}
>;
comments: number;
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UserGist interface is duplicated: one definition exists in apps/web/src/lib/github-types.ts (the canonical, shared type) and another local one is declared in apps/web/src/components/users/user-profile-gists.tsx. These two definitions differ subtly — stars is number (required) in github-types.ts but number | undefined (optional) in the component file.

The component's user-profile-content.tsx then imports the type via an inline import() expression (import("@/components/users/user-profile-gists").UserGist) rather than from github-types.ts. The local duplicate should be removed in favor of the canonical UserGist from @/lib/github-types.

Copilot uses AI. Check for mistakes.
Cyberistic and others added 6 commits March 5, 2026 06:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…st type

- Add comment explaining gist prop is reserved for future use in GistComments

- Update proxy.ts route comment to indicate sub-paths are included

- Remove duplicate UserGist interface from user-profile-gists.tsx

- Import UserGist from @/lib/github-types in user-profile-content.tsx
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.

2 participants