Skip to content

feat(profile): load Codeforces avatar and introduce reusable EmptyStateView#14

Open
mvanhorn wants to merge 1 commit into
Sandesh282:mainfrom
mvanhorn:osc/9-avatar-and-emptystate
Open

feat(profile): load Codeforces avatar and introduce reusable EmptyStateView#14
mvanhorn wants to merge 1 commit into
Sandesh282:mainfrom
mvanhorn:osc/9-avatar-and-emptystate

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented May 3, 2026

Description

Two related UI improvements bundled per issue #9.

Part A. Profile screen now loads the user's actual Codeforces avatar via SDWebImageSwiftUI's WebImage instead of the SF Symbol placeholder. Protocol-relative URLs from the API (//userpic.codeforces.org/...) are normalized by prepending https:. The original person.fill symbol remains as the placeholder for nil URLs and load failures, with the same circular shape, gradient border, and neon shadow.

Part B. New reusable CForge/Views/Common/EmptyStateView.swift standardizes empty, error, and loading states across ContestListView, ProblemListView, ProfileView, and ProblemSubmissionsView. Switching off ContentUnavailableView in ProblemSubmissionsView also lifts the iOS 17+ floor for that screen.

Happy to split this into two PRs (avatar first, sweep second) if you'd prefer smaller review units. Let me know.

Related Issue

Closes #9

Changes Made

  • ProfileModels.swift: add avatar: String? and titlePhoto: String? to CodeforcesUser.
  • ProfileView.swift: replace the SF Symbol in profileHeader(user:) with WebImage(url: normalizeAvatarURL(user.titlePhoto ?? user.avatar)) and a person.fill placeholder. Add normalizeAvatarURL(_:) helper for protocol-relative URLs. Replace the raw red error text with EmptyStateView.
  • New Views/Common/EmptyStateView.swift: configurable icon, title, optional subtitle, optional action button. Neon-themed.
  • ContestListView.swift: replace bare ProgressView() initial-load placeholder with EmptyStateView (loading variant). Keeps the existing .onAppear trigger.
  • ProblemListView.swift: replace the inline error VStack with EmptyStateView.
  • ProblemSubmissionsView.swift: replace three ContentUnavailableView calls (signed-out, error, no-attempts) with EmptyStateView.

Screenshots (if UI changes)

Before After

Will add before / after pairs for the Profile avatar and one or two empty states before review.

Checklist

  • I have tested my changes on the iOS Simulator
  • The project builds without errors (Cmd+B)
  • My code follows the existing code style
  • I have not committed signing/team configuration changes
  • I have linked the related issue above

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

@mvanhorn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 51 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 92c9b4ad-d0bd-47f0-a5c7-3b932ee8f9d7

📥 Commits

Reviewing files that changed from the base of the PR and between d744e41 and 6a9faaf.

📒 Files selected for processing (6)
  • CForge/Views/Common/EmptyStateView.swift
  • CForge/Views/Contest/ContestListView.swift
  • CForge/Views/Problem/ProblemListView.swift
  • CForge/Views/Problem/ProblemSubmissionsView.swift
  • CForge/Views/Profile/ProfileModels.swift
  • CForge/Views/Profile/ProfileView.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 59 minutes and 51 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@mvanhorn
Copy link
Copy Markdown
Contributor Author

mvanhorn commented May 3, 2026

Heads up: I didn't run this on a Simulator locally. No new tests in this one (EmptyStateView is a pure-View struct), so manual QA on Profile avatar load + the four empty-state screens is on you before merge. If anything looks off in the build, ping me and I'll iterate.

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.

[Feature Request]: Display Codeforces avatar on Profile and create reusable Empty State component

1 participant