From 60c299ca47fd1f50f0651e5f6f8f7e38263dd51d Mon Sep 17 00:00:00 2001 From: Darius Kassi Date: Tue, 13 Jan 2026 07:14:39 +0000 Subject: [PATCH] style: refactor referral screen to use theme colors --- .../components/referrals/referral-stats.tsx | 44 +++++++-------- .../src/components/referrals/share-card.tsx | 54 +++++++++---------- .../src/routes/_auth/app/referrals.tsx | 14 ++--- tasks/prd-referral-color-refactor.md | 42 +++++++++++++++ tasks/tasks-referral-color-refactor.md | 29 ++++++++++ 5 files changed, 127 insertions(+), 56 deletions(-) create mode 100644 tasks/prd-referral-color-refactor.md create mode 100644 tasks/tasks-referral-color-refactor.md diff --git a/apps/user-application/src/components/referrals/referral-stats.tsx b/apps/user-application/src/components/referrals/referral-stats.tsx index 3002479..e2446a2 100644 --- a/apps/user-application/src/components/referrals/referral-stats.tsx +++ b/apps/user-application/src/components/referrals/referral-stats.tsx @@ -31,40 +31,40 @@ export function ReferralStats({ className }: ReferralStatsProps) { label: 'Total parrainages', value: stats?.totalReferrals ?? 0, icon: Users, - color: 'text-zinc-400', - bg: 'bg-zinc-500/10', - border: 'border-zinc-500/20', + color: 'text-muted-foreground', + bg: 'bg-muted/10', + border: 'border-muted/20', }, { label: 'Complétés', value: stats?.completedReferrals ?? 0, icon: CheckCircle, - color: 'text-emerald-400', - bg: 'bg-emerald-500/10', - border: 'border-emerald-500/20', + color: 'text-success-from', + bg: 'bg-success-from/10', + border: 'border-success-from/20', }, { label: 'En attente', value: stats?.pendingReferrals ?? 0, icon: Clock, - color: 'text-amber-400', - bg: 'bg-amber-500/10', - border: 'border-amber-500/20', + color: 'text-warning-from', + bg: 'bg-warning-from/10', + border: 'border-warning-from/20', }, { label: 'Gains totaux', value: formatCurrency(stats?.totalEarnings ?? 0), icon: Coins, - color: 'text-indigo-400', - bg: 'bg-indigo-500/10', - border: 'border-indigo-500/20', + color: 'text-info-from', + bg: 'bg-info-from/10', + border: 'border-info-from/20', }, ] return ( - + - Statistiques de parrainage + Statistiques de parrainage
@@ -79,8 +79,8 @@ export function ReferralStats({ className }: ReferralStatsProps) { >
-

{item.value}

-

{item.label}

+

{item.value}

+

{item.label}

))} @@ -92,18 +92,18 @@ export function ReferralStats({ className }: ReferralStatsProps) { function ReferralStatsSkeleton({ className }: { className?: string }) { return ( - + - +
{[1, 2, 3, 4].map(i => ( -
- +
+
- - + +
))} diff --git a/apps/user-application/src/components/referrals/share-card.tsx b/apps/user-application/src/components/referrals/share-card.tsx index a246df3..b0f190a 100644 --- a/apps/user-application/src/components/referrals/share-card.tsx +++ b/apps/user-application/src/components/referrals/share-card.tsx @@ -66,13 +66,13 @@ export function ReferralShareCard({ className }: ShareCardProps) { } return ( - + - - + + Parrainage - + Invite tes amis et gagne 3€ de crédit pour chaque inscription ! @@ -80,12 +80,12 @@ export function ReferralShareCard({ className }: ShareCardProps) { {/* Referral Code */}
- Ton code de parrainage + Ton code de parrainage
{/* Referral Link */}
- Lien de parrainage + Lien de parrainage
@@ -130,7 +130,7 @@ export function ReferralShareCard({ className }: ShareCardProps) { {/* Share Button */} {/* Reward Info */} -
- - +
+ + Tu gagnes {' '} - 3€ + 3€ {' '} pour chaque ami qui s'abonne ! @@ -155,21 +155,21 @@ export function ReferralShareCard({ className }: ShareCardProps) { function ReferralShareCardSkeleton({ className }: { className?: string }) { return ( - + - - + +
- - + +
- - + +
- +
) diff --git a/apps/user-application/src/routes/_auth/app/referrals.tsx b/apps/user-application/src/routes/_auth/app/referrals.tsx index 39b9c13..ff59e44 100644 --- a/apps/user-application/src/routes/_auth/app/referrals.tsx +++ b/apps/user-application/src/routes/_auth/app/referrals.tsx @@ -18,8 +18,8 @@ function ReferralsPage() {
{/* Ambient Background */}
-
-
+
+
@@ -27,7 +27,7 @@ function ReferralsPage() {
{/* Header */}
-
+

@@ -51,7 +51,7 @@ function ReferralsPage() {

Comment ça marche ?

  1. - + 1
    @@ -62,7 +62,7 @@ function ReferralsPage() {
  2. - + 2
    @@ -73,7 +73,7 @@ function ReferralsPage() {
  3. - + 3
    @@ -81,7 +81,7 @@ function ReferralsPage() {

    Tu reçois {' '} - 3€ + 3€ {' '} de crédit et ton ami bénéficie d'une réduction

    diff --git a/tasks/prd-referral-color-refactor.md b/tasks/prd-referral-color-refactor.md new file mode 100644 index 0000000..c719b0b --- /dev/null +++ b/tasks/prd-referral-color-refactor.md @@ -0,0 +1,42 @@ +# PRD: Referral Screen Inline Color Refactoring + +## Introduction/Overview + +This task addresses a UI/UX bug on the referral screen where colors are currently defined using inline or hardcoded values rather than leveraging the application's established theme colors. This approach leads to inconsistency across the application's UI, makes global theme updates difficult, and can introduce visual regressions. The objective is to refactor the referral screen's styling to exclusively use the defined theme colors. + +## Goals + +1. **Eliminate Inline Colors:** Remove all instances of hardcoded hex codes, RGB values, or named colors that are not part of the theme system in the Referral Screen. +2. **Ensure Theme Consistency:** Bind all color properties to the application's design tokens/theme variables (e.g., Tailwind classes like `text-primary`, `bg-background`, `border-border`). +3. **Visual Parity:** Maintain the current visual design while switching the underlying implementation to the theme system. +4. **Dark/Light Mode Support:** Ensure that the refactoring correctly supports color mode switching (if applicable) by using semantic tokens. + +## User Stories + +- **As a developer**, I want global theme changes to automatically reflect on the referral screen so that the app remains visually consistent. +- **As a user**, I want the referral screen to look and feel like the rest of the application, with consistent colors and styling. + +## Functional Requirements + +1. **Identify Components:** Locate `ReferralPage` (or equivalent) and its sub-components. +2. **Refactor Styling:** + - Replace arbitrary hex values (e.g., `#A020F0`) with semantic classes (e.g., `text-purple-600` or `text-primary` if mapped). + - Replace inline `style={{ color: '...' }}` with Tailwind classes or CSS variables. +3. **Validation:** Ensure text contrast and visual hierarchy remain intact. + +## Technical Considerations + +- **Tech Stack:** React, Tailwind CSS (assumed based on previous file views). +- **Theme Source:** `tailwind.config.ts` or `globals.css` (CSS variables). +- **Scope:** Specifically the Referral/Parrainage screen/route. + +## Acceptance Criteria + +- [ ] No hardcoded color values (hex, rgb, etc.) remain in the referral screen files. +- [ ] All colors use Tailwind utility classes or app-specific CSS variables. +- [ ] The screen looks visually identical to the "before" state (or better, if the hardcoded values were slightly off). +- [ ] No regressions in functionality. + +## Open Questions + +- *Are there specific custom colors used in the referral screen that need to be added to the theme config first?* (Will check during implementation). diff --git a/tasks/tasks-referral-color-refactor.md b/tasks/tasks-referral-color-refactor.md new file mode 100644 index 0000000..2c20fad --- /dev/null +++ b/tasks/tasks-referral-color-refactor.md @@ -0,0 +1,29 @@ +# Tasks: Referral Screen Inline Color Refactoring + +## Relevant Files + +- `apps/user-application/src/routes/_auth/app/referrals.tsx` +- `apps/user-application/src/components/referrals/share-card.tsx` +- `apps/user-application/src/index.css` (for checking theme variables) +- `tailwind.config.ts` (for checking theme configuration) + +## Instructions + +Check off tasks as you go. + +## Tasks + +- [x] 0.0 Create feature branch + - [x] 0.1 Create and checkout branch `fix/referral-inline-colors` +- [x] 1.0 Analyze and Map Colors + - [x] 1.1 Inspect `apps/user-application/src/routes/_auth/app/referrals.tsx` for hardcoded colors. + - [x] 1.2 Inspect `apps/user-application/src/components/referrals/share-card.tsx` for hardcoded colors. + - [x] 1.3 Inspect `apps/user-application/src/components/referrals/referral-stats.tsx` for hardcoded colors. + - [x] 1.4 Map identified colors to existing Tailwind classes or CSS variables. +- [x] 2.0 Refactor Styling + - [x] 2.1 Replace hardcoded colors in `referrals.tsx` with theme classes. + - [x] 2.2 Replace hardcoded colors in `share-card.tsx` with theme classes. + - [x] 2.3 Replace hardcoded colors in `referral-stats.tsx` with theme classes. +- [x] 3.0 Verification + - [x] 3.1 Verify visual consistency. + - [x] 3.2 Ensure no regression.