Skip to content

Commit 711425f

Browse files
committed
feat(affiliate-link): enhance avatar display with GitHub styling
Add conditional styling for affiliate avatars sourced from GitHub by checking the URL pattern. Apply rounded corners, border, and subtle shadow effects with hover transitions to improve visual consistency. Update affiliate-link model to include a computed property that detects GitHub avatars based on URL. Modify test data to use a realistic GitHub avatar URL and include relevant affiliate properties. These changes improve UI polish and provide clearer differentiation for GitHub-based avatars on the accept referral container.
1 parent 12cb8c0 commit 711425f

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

app/components/affiliate-link-page/accept-referral-container.hbs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<div
22
class="flex flex-col items-center gap-y-6 bg-teal-50/25 dark:bg-teal-800/40 border-teal-500 dark:border-teal-600 px-4
33
{{if (eq @verticalSize 'tall') 'py-12' 'py-8'}}
4-
border rounded-md shadow-xl"
4+
border rounded-md shadow-xl group"
55
...attributes
66
>
77
<div class="flex items-center justify-center">
8-
<img alt="avatar" src={{@affiliateLink.affiliateAvatarUrl}} class="w-16 h-16 mr-2" />
8+
{{#if @affiliateLink.avatarIsGitHubAvatar}}
9+
<img
10+
alt="avatar"
11+
src={{@affiliateLink.affiliateAvatarUrl}}
12+
class="w-16 h-16 mr-2 rounded-md border border-gray-300 shadow-xs group-hover:shadow-sm transition-shadow"
13+
/>
14+
{{else}}
15+
<img alt="avatar" src={{@affiliateLink.affiliateAvatarUrl}} class="w-16 h-16 mr-2" />
16+
{{/if}}
917

1018
{{svg-jar "plus" class="w-10 h-10 text-gray-600 dark:text-gray-400 mr-2 opacity-90 group-hover:opacity-100 transition-all"}}
1119

app/models/affiliate-link.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export default class AffiliateLinkModel extends Model {
1414
@attr('string') declare slug: string;
1515
@attr('string') declare url: string;
1616

17+
get avatarIsGitHubAvatar(): boolean {
18+
return this.affiliateAvatarUrl.includes('avatars.githubusercontent.com');
19+
}
20+
1721
get totalEarningsAmountInCents() {
1822
return this.referrals.reduce((sum, referral) => sum + referral.totalEarningsAmountInCents, 0);
1923
}

tests/acceptance/affiliate-link-page/accept-referral-offer-test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ module('Acceptance | affiliate-link-page | accept-referral-offer', function (hoo
3434
signIn(this.owner, this.server);
3535

3636
const referrer = this.server.create('user', {
37-
avatarUrl: 'https://github.com/sarupbanskota.png',
37+
avatarUrl: 'https://avatars.githubusercontent.com/u/1234567890?v=4',
3838
createdAt: new Date(),
3939
githubUsername: 'sarupbanskota',
4040
username: 'sarupbanskota',
4141
});
4242

43-
this.server.create('affiliate-link', { user: referrer });
43+
this.server.create('affiliate-link', {
44+
user: referrer,
45+
affiliateUsername: 'sarupbanskota',
46+
affiliateAvatarUrl: 'https://avatars.githubusercontent.com/u/1234567890?v=4',
47+
});
4448

4549
await affiliateLinkPage.visit({ via: 'referral1' });
4650
await affiliateLinkPage.acceptReferralButtons[0].click();

0 commit comments

Comments
 (0)