-
Notifications
You must be signed in to change notification settings - Fork 0
Night Shift: remove as-any casts in leaderboard #14
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /Users/etanheyman/Gits/songscript/node_modules | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,32 @@ import { ToggleGroup, ToggleGroupItem } from "../ui/toggle-group"; | |
| import { Button } from "../ui/button"; | ||
|
|
||
| type LeaderboardType = "streak" | "progress"; | ||
| type StreakEntry = { rank: number; displayName: string; streak: number; language: string }; | ||
| type ProgressEntry = { rank: number; displayName: string; score: number; topLanguage: string }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated type definitions across two leaderboard filesLow Severity
Additional Locations (1) |
||
|
|
||
| function MiniLeaderboardRow({ rank, displayName, medal, isCurrentUser, value }: { | ||
| rank: number; | ||
| displayName: string; | ||
| medal: string | null; | ||
| isCurrentUser: boolean; | ||
| value: string; | ||
| }) { | ||
| return ( | ||
| <div | ||
| className={`flex items-center justify-between p-2 rounded-lg ${ | ||
| isCurrentUser ? "bg-primary/10 border border-primary/20" : "bg-muted/30" | ||
| }`} | ||
| > | ||
| <div className="flex items-center gap-2"> | ||
| <span className="text-sm font-medium w-6"> | ||
| {medal || `#${rank}`} | ||
| </span> | ||
| <span className="text-sm font-medium">{displayName}</span> | ||
| </div> | ||
| <div className="text-sm text-muted-foreground">{value}</div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export function LeaderboardMiniSection() { | ||
| const [selectedType, setSelectedType] = useState<LeaderboardType>("streak"); | ||
|
|
@@ -35,7 +61,7 @@ export function LeaderboardMiniSection() { | |
| ); | ||
|
|
||
| const hasDisplayName = userInfo?.displayName !== null; | ||
| const leaderboardData = selectedType === "streak" ? streakData : progressData; | ||
| const isStreak = selectedType === "streak"; | ||
|
|
||
| // Medal icons for top 3 | ||
| const getMedalIcon = (rank: number) => { | ||
|
|
@@ -82,32 +108,28 @@ export function LeaderboardMiniSection() { | |
| </div> | ||
| ) : ( | ||
| <div className="space-y-3"> | ||
| {leaderboardData.map((user: typeof leaderboardData[0]) => { | ||
| const isCurrentUser = hasDisplayName && userRank && user.rank === userRank.rank; | ||
| const medal = getMedalIcon(user.rank); | ||
|
|
||
| return ( | ||
| <div | ||
| key={`${user.displayName}-${user.rank}`} | ||
| className={`flex items-center justify-between p-2 rounded-lg ${ | ||
| isCurrentUser ? "bg-primary/10 border border-primary/20" : "bg-muted/30" | ||
| }`} | ||
| > | ||
| <div className="flex items-center gap-2"> | ||
| <span className="text-sm font-medium w-6"> | ||
| {medal || `#${user.rank}`} | ||
| </span> | ||
| <span className="text-sm font-medium">{user.displayName}</span> | ||
| </div> | ||
| <div className="text-sm text-muted-foreground"> | ||
| {selectedType === "streak" | ||
| ? `${(user as any).streak || 0} days` | ||
| : `${(user as any).score || 0} pts` | ||
| } | ||
| </div> | ||
| </div> | ||
| ); | ||
| })} | ||
| {isStreak | ||
| ? streakData.map((user: StreakEntry) => ( | ||
| <MiniLeaderboardRow | ||
| key={`${user.displayName}-${user.rank}`} | ||
| rank={user.rank} | ||
| displayName={user.displayName} | ||
| medal={getMedalIcon(user.rank)} | ||
| isCurrentUser={!!(hasDisplayName && userRank && user.rank === userRank.rank)} | ||
| value={`${user.streak || 0} days`} | ||
| /> | ||
| )) | ||
| : progressData.map((user: ProgressEntry) => ( | ||
| <MiniLeaderboardRow | ||
| key={`${user.displayName}-${user.rank}`} | ||
| rank={user.rank} | ||
| displayName={user.displayName} | ||
| medal={getMedalIcon(user.rank)} | ||
| isCurrentUser={!!(hasDisplayName && userRank && user.rank === userRank.rank)} | ||
| value={`${user.score || 0} pts`} | ||
| /> | ||
| )) | ||
| } | ||
|
|
||
| {/* Show current user's rank if not in top 5 but in top 50 */} | ||
| {hasDisplayName && userRank && userRank.rank > 5 && userRank.rank <= 50 && ( | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally committed node_modules symlink file
High Severity
A file named
node_modules(not the directory) was committed containing a developer's local path/Users/etanheyman/Gits/songscript/node_modules. This appears to be a symlink target that was accidentally tracked. The.gitignoreonly ignoresnode_modules/(with trailing slash, matching directories), so this plain file slips through.