- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
Feature/sharecard #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            FO214
  wants to merge
  5
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feature/SHARECARD
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 2 commits
      Commits
    
    
            Show all changes
          
          
            5 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      e7f3c78
              
                card looking much nicer now, need to fix sharing/downloading
              
              
                FO214 e3da12d
              
                newer and more beautiful share card
              
              
                FO214 44b55af
              
                Update components/stats/share-modal.tsx
              
              
                FO214 5909b88
              
                scrolling bug
              
              
                FO214 26c5b8c
              
                Merge branch 'feature/SHARECARD' of https://github.com/greptileai/pro…
              
              
                FO214 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
This file was deleted.
      
      Oops, something went wrong.
      
    
  This file was deleted.
      
      Oops, something went wrong.
      
    
  This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -75,4 +75,4 @@ body { | |
| body { | ||
| @apply bg-background text-foreground; | ||
| } | ||
| } | ||
| } | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| 'use client' | ||
| 
     | 
||
| import { motion } from 'framer-motion'; | ||
| import Image from 'next/image'; | ||
| import GitHubCalendar from 'react-github-calendar'; | ||
| import { GitHubStats } from '@/types/github'; | ||
| import { GitCommit, Plus, Minus } from 'lucide-react'; | ||
| 
     | 
||
| interface ShareCardProps { | ||
| stats: GitHubStats; | ||
| username: string; | ||
| archetype: { | ||
| title: string; | ||
| icon: string; | ||
| description: string; | ||
| color: { | ||
| from: string; | ||
| to: string; | ||
| }; | ||
| powerMove: string; | ||
| }; | ||
| achillesHeel: { | ||
| title: string; | ||
| icon: string; | ||
| color: { | ||
| from: string; | ||
| to: string; | ||
| }; | ||
| description: string; | ||
| quickTip: string; | ||
| }; | ||
| scores: { | ||
| score: number; | ||
| topPercentages: { | ||
| overall: number; | ||
| commits: number; | ||
| additions: number; | ||
| deletions: number; | ||
| }; | ||
| icons: { | ||
| overall: string; | ||
| commits: string; | ||
| additions: string; | ||
| deletions: string; | ||
| }; | ||
| }; | ||
| } | ||
| 
     | 
||
| const formatNumber = (num: number) => { | ||
| if (num >= 1000000) { | ||
| return (num / 1000000).toFixed(1) + 'M'; | ||
| } else if (num >= 1000) { | ||
| return (num / 1000).toFixed(1) + 'k'; | ||
| } | ||
| return num.toString(); | ||
| }; | ||
                
      
                  FO214 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| export default function ShareCard({ stats, username, archetype, achillesHeel, scores }: ShareCardProps) { | ||
| return ( | ||
| <motion.div | ||
| id="share-card" | ||
| key={username} | ||
| className="relative bg-black p-10 rounded-lg shadow-lg border border-gray-800 max-w-md mx-auto overflow-visible min-h-[480px]" | ||
| initial={{ opacity: 0, y: 20 }} | ||
| animate={{ opacity: 1, y: 0 }} | ||
| transition={{ duration: 0.5 }} | ||
| > | ||
| <div className="absolute inset-0"> | ||
| <GitHubCalendar | ||
| username={username} | ||
| hideTotalCount={true} | ||
| hideColorLegend={true} | ||
| hideMonthLabels={true} | ||
| blockSize={8} | ||
| blockRadius={10} | ||
| blockMargin={10} | ||
| /> | ||
| </div> | ||
| <div className="relative z-10 flex flex-col items-center"> | ||
| <div className="relative w-32 h-32 mb-4 overflow-hidden rounded-full border-4 border-emerald-500"> | ||
| <Image | ||
| key={stats.avatarUrl} | ||
| src={stats.avatarUrl} | ||
| alt={`${username}'s profile picture`} | ||
| width={128} | ||
| height={128} | ||
| className="object-cover w-full h-full" | ||
| crossOrigin="anonymous" | ||
| /> | ||
| </div> | ||
| <h1 className="text-3xl text-white font-bold">{stats.name}</h1> | ||
| <p className="text-gray-400 text-lg">@{stats.login}</p> | ||
| <div className="mt-4 flex justify-around w-full text-gray-300"> | ||
| <div className="text-center border border-gray-600 p-4 rounded-lg flex flex-col items-center"> | ||
| <GitCommit className="w-8 h-8 text-emerald-500 mb-2" /> | ||
| <p className="text-2xl font-semibold">{formatNumber(stats.totalCommits)}</p> | ||
| <p>Commits</p> | ||
| </div> | ||
| <div className="text-center border border-gray-600 p-4 rounded-lg flex flex-col items-center"> | ||
| <Plus className="w-8 h-8 text-emerald-500 mb-2" /> | ||
| <p className="text-2xl font-semibold">{formatNumber(stats.totalAdditions)}</p> | ||
| <p>Additions</p> | ||
| </div> | ||
| <div className="text-center border border-gray-600 p-4 rounded-lg flex flex-col items-center"> | ||
| <Minus className="w-8 h-8 text-emerald-500 mb-2" /> | ||
| <p className="text-2xl font-semibold">{formatNumber(stats.totalDeletions)}</p> | ||
| <p>Deletions</p> | ||
| </div> | ||
| </div> | ||
| <div className="mt-6 w-full"> | ||
| <div className="flex items-center"> | ||
| <div className="w-32 h-32 rounded-full border-8 border-emerald-500 flex items-center justify-center bg-black mr-6"> | ||
| <span className="text-6xl text-white">{scores.score}</span> | ||
| </div> | ||
| <div className="flex flex-col items-start"> | ||
| <p className="text-gray-400 text-lg"> | ||
| Developer Archetype <br/> <span className="text-white font-bold">{archetype.icon} {archetype.title}</span> | ||
| </p> | ||
| <br/> | ||
| <p className="text-gray-400 text-lg"> | ||
| Developer Quirk <br/> <span className="text-white font-bold">{achillesHeel.icon} {achillesHeel.title}</span> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </motion.div> | ||
| ); | ||
| } | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.