Conversation
…n management dashboard and UI cards
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a client/worker subscription system backed by Supabase tables, updates UI/logic to reflect subscription benefits (sorting, commission, discounts), and documents/extends the Capacitor + GitHub Actions APK build pipeline.
Changes:
- Add Supabase subscription helpers and new subscription pages/cards for clients and workers.
- Apply subscription-based behavior in booking payments, invoices, worker discovery ordering, and worker emergency/address/rating access.
- Extend admin dashboard + API route for notification deletion, and expand docs (README + CONTRIBUTING) for build/contribution workflows.
Reviewed changes
Copilot reviewed 27 out of 29 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents build commands and CI/CD APK workflow; adds contributing link. |
| next-env.d.ts | Updates generated typed-routes import path. |
| lib/supabase/worker-subscriptions.ts | Adds worker subscription fetch/subscribe helpers. |
| lib/supabase/subscriptions.ts | Adds client subscription fetch/subscribe helpers. |
| lib/supabase/booking-payments.ts | Computes platform commission based on worker plan. |
| hooks/useHome.ts | Fetches worker subscription and exposes it to worker home UI. |
| hooks/useClientHome.ts | Fetches worker plans and sorts workers by plan tier + proximity/rating. |
| fix_dynamic_routes.py | Removes route-fix helper script. |
| fix_dynamic_routes_v6.py | Removes route-fix helper script. |
| fix_dynamic_routes_v4.py | Removes route-fix helper script. |
| fix_dynamic_routes_v3.py | Removes route-fix helper script. |
| fix_dynamic_routes_v2.py | Removes route-fix helper script. |
| CONTRIBUTING.md | Adds contribution/setup guidance and static-export/dynamic-route notes. |
| components/ui/orders/OrderCard.tsx | Adds subscription-aware order UI (address gating, priority badge, rating visibility). |
| components/subscriptions/WorkerPricingCard.tsx | Adds worker pricing UI card component. |
| components/subscriptions/PricingCard.tsx | Adds client pricing UI card component. |
| components/shared/CraftsmanCard.tsx | Adds worker plan label styling on craftsman cards. |
| capacitor.config.ts | Updates Capacitor server URL. |
| app/client/subscriptions/page.tsx | Adds client subscriptions page with confirmation modal. |
| app/client/profile/page.tsx | Adds “My Subscriptions” entry and VIP CTA for Estate plan. |
| app/client/orders/page.tsx | Adds Estate-only “warranty request” CTA in orders list. |
| app/client/order/invoice/page.tsx | Applies plan benefits: waived inspection fee + 10% discount where applicable. |
| app/client/home/page.tsx | Displays worker plan badge in worker list UI. |
| app/api/admin/delete-notification/route.ts | Adds admin-only API route to delete notifications using service role key. |
| app/admin/page.tsx | Adds subscriptions tab + routes notification deletion via API. |
| app/(main)/worker/subscriptions/page.tsx | Adds worker subscriptions page with confirmation modal. |
| app/(main)/worker/profile/page.tsx | Adds link to worker subscriptions and premium support CTA. |
| app/(main)/worker/home/page.tsx | Gates emergency acceptance CTA based on worker subscription. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+6
| import React, { useState, useEffect } from 'react' | ||
| import Image from 'next/image' | ||
| import { ClipboardCheck, Clock, MapPin, Banknote, Navigation, Save } from 'lucide-react' | ||
| import { ClipboardCheck, Clock, MapPin, Banknote, Navigation, Save, ShieldAlert, Star } from 'lucide-react' | ||
| import { createClient } from '@/lib/supabase/client' | ||
| import { getActiveSubscription } from '@/lib/supabase/subscriptions' | ||
| import { getActiveWorkerSubscription } from '@/lib/supabase/worker-subscriptions' |
| } | ||
|
|
||
| const canViewFullAddress = workerPlan === 'master' || workerPlan === 'premium' | ||
| const canViewClientRating = workerPlan !== 'basic' |
| <span className="text-sm font-bold text-white flex items-center gap-2"> | ||
| {order.client?.full_name || 'عميل'} | ||
| {canViewClientRating && activeTab === 'pending' && ( | ||
| <span className="text-[10px] bg-white/5 px-1.5 py-0.5 rounded text-gray-400 font-normal">تقييم: 4.8</span> |
Comment on lines
20
to
+24
| basic: 'أساسي', | ||
| skilled: 'ماهر', | ||
| pro: 'احترافي', | ||
| master: 'خبير', | ||
| master: 'خبير', |
Comment on lines
+54
to
+63
| // Fetch subscriptions for these workers | ||
| const workerIds = result.map(w => w.id) | ||
| const { data: subs } = await supabase | ||
| .from('worker_subscriptions') | ||
| .select('worker_id, plan_type') | ||
| .in('worker_id', workerIds) | ||
| .eq('status', 'active') | ||
|
|
||
| const subMap = new Map(subs?.map(s => [s.worker_id, s.plan_type]) || []) | ||
| result = result.map(w => ({ ...w, workerPlan: subMap.get(w.id) || 'basic' })) |
| return NextResponse.json({ error: 'Notification ID is required' }, { status: 400 }) | ||
| } | ||
|
|
||
| const cookieStore = await cookies() |
Comment on lines
+64
to
+70
| // 1. Cancel existing active subscriptions | ||
| await supabase | ||
| .from('client_subscriptions') | ||
| .update({ status: 'cancelled', end_date: new Date().toISOString() }) | ||
| .eq('user_id', userId) | ||
| .eq('status', 'active'); | ||
|
|
Comment on lines
+64
to
+70
| // 1. Cancel existing active subscriptions | ||
| await supabase | ||
| .from('worker_subscriptions') | ||
| .update({ status: 'cancelled', end_date: new Date().toISOString() }) | ||
| .eq('worker_id', workerId) | ||
| .eq('status', 'active'); | ||
|
|
Comment on lines
+16
to
+25
| // Fetch active worker subscription to determine commission fee | ||
| const { data: workerSub } = await supabase | ||
| .from('worker_subscriptions') | ||
| .select('plan_type') | ||
| .eq('worker_id', booking.worker_id) | ||
| .eq('status', 'active') | ||
| .order('created_at', { ascending: false }) | ||
| .limit(1) | ||
| .single() | ||
|
|
| const [isAvailable, setIsAvailable] = useState(true) | ||
|
|
||
| const [activeEmergency, setActiveEmergency] = useState<any>(null) | ||
| const [workerSub, setWorkerSub] = useState<any>(null) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.