Skip to content

Sami#12

Merged
ByMuhmd merged 3 commits into
mainfrom
Sami
Jul 2, 2026
Merged

Sami#12
ByMuhmd merged 3 commits into
mainfrom
Sami

Conversation

@ByMuhmd

@ByMuhmd ByMuhmd commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 2, 2026 22:09
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hirfa Ready Ready Preview, Comment Jul 2, 2026 10:09pm

Request Review

@ByMuhmd ByMuhmd merged commit f9e72de into main Jul 2, 2026
10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread hooks/useClientHome.ts
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()

Comment thread hooks/useHome.ts
const [isAvailable, setIsAvailable] = useState(true)

const [activeEmergency, setActiveEmergency] = useState<any>(null)
const [workerSub, setWorkerSub] = useState<any>(null)
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.

2 participants