From 19e6d78a919c4d577ac674f534e5e4eb17ce61ff Mon Sep 17 00:00:00 2001 From: aguilar1x Date: Wed, 21 Jan 2026 22:20:08 -0600 Subject: [PATCH 1/5] fix: resolve Biome linting issues in backend - Organize imports in backend files (eventListener.ts, sync.service.ts) - Add missing 'rpc' import from @stellar/stellar-sdk - Resolve git merge conflict in roles.ts type definition - All backend files now pass Biome formatting and import organization rules --- apps/backend/src/blockchain/eventListener.ts | 2 +- apps/backend/src/services/sync.service.ts | 2 +- apps/web/src/types/roles.ts | 3 --- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/backend/src/blockchain/eventListener.ts b/apps/backend/src/blockchain/eventListener.ts index 5e67ff55..abb1f514 100644 --- a/apps/backend/src/blockchain/eventListener.ts +++ b/apps/backend/src/blockchain/eventListener.ts @@ -1,4 +1,4 @@ -import { Contract, Networks, xdr } from '@stellar/stellar-sdk'; +import { Contract, Networks, rpc, xdr } from '@stellar/stellar-sdk'; import { Server as SorobanRpcServer } from '@stellar/stellar-sdk/rpc'; import { supabase } from '../config/supabase'; import { loggingService } from '../services/logging.service'; diff --git a/apps/backend/src/services/sync.service.ts b/apps/backend/src/services/sync.service.ts index 8d4e4e00..fdc75fde 100644 --- a/apps/backend/src/services/sync.service.ts +++ b/apps/backend/src/services/sync.service.ts @@ -18,7 +18,7 @@ * - Status monitoring and statistics */ -import { Contract, Networks, nativeToScVal, scValToNative } from '@stellar/stellar-sdk'; +import { Contract, Networks, nativeToScVal, rpc, scValToNative } from '@stellar/stellar-sdk'; import { Server as SorobanRpcServer } from '@stellar/stellar-sdk/lib/rpc'; import { supabase } from '../config/supabase'; import { bookingService } from './booking.service'; diff --git a/apps/web/src/types/roles.ts b/apps/web/src/types/roles.ts index ddd34da7..8dc8c646 100644 --- a/apps/web/src/types/roles.ts +++ b/apps/web/src/types/roles.ts @@ -8,8 +8,5 @@ export interface RoleInfo { hostStatus?: HostStatus; canAccessHostDashboard: boolean; hasProperties: boolean; -<<<<<<< HEAD isLoading?: boolean; -======= ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup) } From 4319505302b7815323ed7472e4cb28dc88b405fd Mon Sep 17 00:00:00 2001 From: aguilar1x Date: Wed, 21 Jan 2026 22:25:02 -0600 Subject: [PATCH 2/5] fix: implement Stellar CLI fallback for ledger retrieval (#196) - Add Stellar CLI command 'stellar ledger latest' as fallback method - Implement robust error handling for malformed JSON responses - Add comprehensive fallback mechanism when RPC endpoint is unavailable - SDK method (getLatestLedger) as primary, CLI method as secondary - Enhanced error handling with specific error types and timeouts - Verified CLI availability and functionality on testnet Fixes #196: Blockchain Sync Service - Use Correct Stellar RPC Endpoint --- apps/backend/src/services/sync.service.ts | 102 +++++++++++++++++++++- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/apps/backend/src/services/sync.service.ts b/apps/backend/src/services/sync.service.ts index fdc75fde..32d7badf 100644 --- a/apps/backend/src/services/sync.service.ts +++ b/apps/backend/src/services/sync.service.ts @@ -20,8 +20,12 @@ import { Contract, Networks, nativeToScVal, rpc, scValToNative } from '@stellar/stellar-sdk'; import { Server as SorobanRpcServer } from '@stellar/stellar-sdk/lib/rpc'; +import { exec } from 'node:child_process'; +import { promisify } from 'node:util'; import { supabase } from '../config/supabase'; import { bookingService } from './booking.service'; + +const execAsync = promisify(exec); import { loggingService } from './logging.service'; export interface SyncEvent { @@ -345,23 +349,113 @@ export class SyncService { /** * Get current block height from Stellar network */ + /** + * Get the latest ledger sequence using Stellar SDK (primary method) + */ + private async getLatestLedgerFromSDK(): Promise { + const currentLedger = await this.server.getLatestLedger(); + return currentLedger.sequence || 0; + } + + /** + * Get the latest ledger sequence using Stellar CLI (fallback method) + */ + private async getLatestLedgerFromCLI(): Promise { + try { + const network = process.env.STELLAR_NETWORK || 'testnet'; + const command = `stellar ledger latest --network ${network} --output json`; + + const { stdout, stderr } = await execAsync(command, { + timeout: 15000, // 15 second timeout + maxBuffer: 1024 * 1024 // 1MB buffer + }); + + if (stderr && stderr.trim()) { + console.warn('Stellar CLI stderr:', stderr); + } + + // Parse JSON response with robust error handling + let result: { sequence: number }; + try { + result = JSON.parse(stdout.trim()); + } catch (parseError) { + console.error('Failed to parse JSON response from Stellar CLI:', parseError); + console.error('Raw response:', stdout); + throw new Error(`Failed to parse JSON response from Stellar CLI: ${(parseError as Error).message}`); + } + + if (!result || typeof result.sequence !== 'number') { + throw new Error('Invalid response format from Stellar CLI: missing or invalid sequence field'); + } + + return result.sequence; + } catch (error) { + // Enhanced error handling with specific error types + if (error instanceof SyntaxError) { + console.error('JSON parsing failed:', error.message); + throw new Error(`JSON parsing failed: ${error.message}`); + } + + const err = error as NodeJS.ErrnoException & { signal?: string; message?: string }; + + if (err.code === 'ENOENT') { + const installMessage = 'Stellar CLI not found. Please install: curl -s https://get.stellar.org | bash'; + console.error(installMessage); + throw new Error(installMessage); + } + + if (err.code === 'ETIMEDOUT' || err.signal === 'SIGTERM') { + console.error('Stellar CLI command timed out'); + throw new Error('Stellar CLI command timed out - RPC endpoint may be unresponsive'); + } + + if (err.code === '1' && err.message?.includes('network')) { + console.error('Stellar network connection failed'); + throw new Error('Stellar network connection failed - check network configuration'); + } + + // Log and re-throw other errors + console.error('Stellar CLI command failed:', err.message || err); + throw new Error(`Stellar CLI command failed: ${err.message || err}`); + } + } + private async getCurrentBlockHeight(): Promise { const maxRetries = Number.parseInt(process.env.SYNC_MAX_RETRIES || '3', 10); const retryDelay = Number.parseInt(process.env.SYNC_RETRY_DELAY || '1000', 10); + // Try SDK method first (primary) + for (let attempt = 1; attempt <= maxRetries; attempt++) { + try { + console.log(`Attempting to get current block height using SDK (attempt ${attempt}/${maxRetries})`); + const blockHeight = await this.getLatestLedgerFromSDK(); + console.log(`Successfully retrieved ledger ${blockHeight} using SDK`); + return blockHeight; + } catch (error) { + console.error(`SDK method failed on attempt ${attempt}:`, error instanceof Error ? error.message : String(error)); + if (attempt < maxRetries) { + await new Promise((resolve) => setTimeout(resolve, retryDelay)); + } + } + } + + // Fallback to CLI method + console.log('SDK method failed, trying CLI fallback...'); for (let attempt = 1; attempt <= maxRetries; attempt++) { try { - const currentLedger = await this.server.getLatestLedger(); - return currentLedger.sequence || 0; + console.log(`Attempting to get current block height using CLI (attempt ${attempt}/${maxRetries})`); + const blockHeight = await this.getLatestLedgerFromCLI(); + console.log(`Successfully retrieved ledger ${blockHeight} using CLI fallback`); + return blockHeight; } catch (error) { - console.error(`Attempt ${attempt} failed to get current block height:`, error); + console.error(`CLI method failed on attempt ${attempt}:`, error instanceof Error ? error.message : String(error)); if (attempt < maxRetries) { await new Promise((resolve) => setTimeout(resolve, retryDelay)); } } } - console.warn('All retries failed. Returning last known block.'); + console.warn(`All ${maxRetries} attempts failed for both SDK and CLI methods. Using fallback block height: ${this.lastProcessedBlock}`); return this.lastProcessedBlock; } From 5fd9343a1102492153db2860689250181b9ed4fe Mon Sep 17 00:00:00 2001 From: aguilar1x Date: Wed, 21 Jan 2026 22:27:26 -0600 Subject: [PATCH 3/5] fix: resolve Biome linting issues in backend - Organize imports in sync.service.ts (node modules first, then stellar SDK) - Fix optional chaining usage in CLI stderr handling - Apply automatic code formatting to fix long lines - All backend files now pass Biome linting with 0 errors, 0 warnings Resolves linting issues identified in sync.service.ts --- apps/backend/src/services/sync.service.ts | 43 ++++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/apps/backend/src/services/sync.service.ts b/apps/backend/src/services/sync.service.ts index 32d7badf..e2d5dcc5 100644 --- a/apps/backend/src/services/sync.service.ts +++ b/apps/backend/src/services/sync.service.ts @@ -18,15 +18,15 @@ * - Status monitoring and statistics */ -import { Contract, Networks, nativeToScVal, rpc, scValToNative } from '@stellar/stellar-sdk'; -import { Server as SorobanRpcServer } from '@stellar/stellar-sdk/lib/rpc'; import { exec } from 'node:child_process'; import { promisify } from 'node:util'; +import { Contract, Networks, nativeToScVal, rpc, scValToNative } from '@stellar/stellar-sdk'; +import { Server as SorobanRpcServer } from '@stellar/stellar-sdk/lib/rpc'; import { supabase } from '../config/supabase'; import { bookingService } from './booking.service'; +import { loggingService } from './logging.service'; const execAsync = promisify(exec); -import { loggingService } from './logging.service'; export interface SyncEvent { id: string; @@ -367,10 +367,10 @@ export class SyncService { const { stdout, stderr } = await execAsync(command, { timeout: 15000, // 15 second timeout - maxBuffer: 1024 * 1024 // 1MB buffer + maxBuffer: 1024 * 1024, // 1MB buffer }); - if (stderr && stderr.trim()) { + if (stderr?.trim()) { console.warn('Stellar CLI stderr:', stderr); } @@ -381,11 +381,15 @@ export class SyncService { } catch (parseError) { console.error('Failed to parse JSON response from Stellar CLI:', parseError); console.error('Raw response:', stdout); - throw new Error(`Failed to parse JSON response from Stellar CLI: ${(parseError as Error).message}`); + throw new Error( + `Failed to parse JSON response from Stellar CLI: ${(parseError as Error).message}` + ); } if (!result || typeof result.sequence !== 'number') { - throw new Error('Invalid response format from Stellar CLI: missing or invalid sequence field'); + throw new Error( + 'Invalid response format from Stellar CLI: missing or invalid sequence field' + ); } return result.sequence; @@ -399,7 +403,8 @@ export class SyncService { const err = error as NodeJS.ErrnoException & { signal?: string; message?: string }; if (err.code === 'ENOENT') { - const installMessage = 'Stellar CLI not found. Please install: curl -s https://get.stellar.org | bash'; + const installMessage = + 'Stellar CLI not found. Please install: curl -s https://get.stellar.org | bash'; console.error(installMessage); throw new Error(installMessage); } @@ -427,12 +432,17 @@ export class SyncService { // Try SDK method first (primary) for (let attempt = 1; attempt <= maxRetries; attempt++) { try { - console.log(`Attempting to get current block height using SDK (attempt ${attempt}/${maxRetries})`); + console.log( + `Attempting to get current block height using SDK (attempt ${attempt}/${maxRetries})` + ); const blockHeight = await this.getLatestLedgerFromSDK(); console.log(`Successfully retrieved ledger ${blockHeight} using SDK`); return blockHeight; } catch (error) { - console.error(`SDK method failed on attempt ${attempt}:`, error instanceof Error ? error.message : String(error)); + console.error( + `SDK method failed on attempt ${attempt}:`, + error instanceof Error ? error.message : String(error) + ); if (attempt < maxRetries) { await new Promise((resolve) => setTimeout(resolve, retryDelay)); } @@ -443,19 +453,26 @@ export class SyncService { console.log('SDK method failed, trying CLI fallback...'); for (let attempt = 1; attempt <= maxRetries; attempt++) { try { - console.log(`Attempting to get current block height using CLI (attempt ${attempt}/${maxRetries})`); + console.log( + `Attempting to get current block height using CLI (attempt ${attempt}/${maxRetries})` + ); const blockHeight = await this.getLatestLedgerFromCLI(); console.log(`Successfully retrieved ledger ${blockHeight} using CLI fallback`); return blockHeight; } catch (error) { - console.error(`CLI method failed on attempt ${attempt}:`, error instanceof Error ? error.message : String(error)); + console.error( + `CLI method failed on attempt ${attempt}:`, + error instanceof Error ? error.message : String(error) + ); if (attempt < maxRetries) { await new Promise((resolve) => setTimeout(resolve, retryDelay)); } } } - console.warn(`All ${maxRetries} attempts failed for both SDK and CLI methods. Using fallback block height: ${this.lastProcessedBlock}`); + console.warn( + `All ${maxRetries} attempts failed for both SDK and CLI methods. Using fallback block height: ${this.lastProcessedBlock}` + ); return this.lastProcessedBlock; } From 5131aa348c303291fed9a262617cfc0a10d5171a Mon Sep 17 00:00:00 2001 From: Renzo Barcos Date: Thu, 22 Jan 2026 23:23:12 -0300 Subject: [PATCH 4/5] fix: solve merge problems on useUserRole.tsx --- apps/web/src/hooks/useUserRole.tsx | 47 ------------------------------ 1 file changed, 47 deletions(-) diff --git a/apps/web/src/hooks/useUserRole.tsx b/apps/web/src/hooks/useUserRole.tsx index 0205a095..753421d8 100644 --- a/apps/web/src/hooks/useUserRole.tsx +++ b/apps/web/src/hooks/useUserRole.tsx @@ -1,7 +1,6 @@ 'use client'; import { useEffect, useState } from 'react'; -<<<<<<< HEAD import { profileAPI } from '~/services/api'; import type { RoleInfo, UserRole } from '~/types/roles'; import { useAuth } from './auth/use-auth'; @@ -11,19 +10,12 @@ interface UseUserRoleReturn extends RoleInfo { } export function useUserRole(): UseUserRoleReturn { -======= -import type { RoleInfo, UserRole } from '~/types/roles'; -import { useAuth } from './auth/use-auth'; - -export function useUserRole(): RoleInfo { ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup) const { user, isAuthenticated } = useAuth(); const [roleInfo, setRoleInfo] = useState({ role: 'guest', canAccessHostDashboard: false, hasProperties: false, }); -<<<<<<< HEAD const [isLoading, setIsLoading] = useState(true); useEffect(() => { @@ -120,43 +112,4 @@ export function useUserRole(): RoleInfo { }, [user, isAuthenticated]); return { ...roleInfo, isLoading }; -======= - - useEffect(() => { - if (!isAuthenticated || !user) { - setRoleInfo({ - role: 'guest', - canAccessHostDashboard: false, - hasProperties: false, - }); - return; - } - - // Check if user has host status in localStorage or from API - const storedHostStatus = localStorage.getItem('hostStatus'); - const storedHasProperties = localStorage.getItem('hasProperties') === 'true'; - - let role: UserRole = 'guest'; - let canAccessHostDashboard = false; - - // User is a host if they have verified host status and properties - if (storedHostStatus === 'verified' && storedHasProperties) { - role = 'dual'; // Can be both guest and host - canAccessHostDashboard = true; - } else if (storedHostStatus === 'verified') { - // Verified but no properties yet - role = 'host'; - canAccessHostDashboard = false; // No dashboard access without properties - } - - setRoleInfo({ - role, - hostStatus: storedHostStatus as 'pending' | 'verified' | 'rejected' | 'suspended' | undefined, - canAccessHostDashboard, - hasProperties: storedHasProperties, - }); - }, [user, isAuthenticated]); - - return roleInfo; ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup) } From 53ea3a2f6cfb51898bb1431fe08b9197be2ac3c8 Mon Sep 17 00:00:00 2001 From: Renzo Barcos Date: Fri, 23 Jan 2026 00:14:24 -0300 Subject: [PATCH 5/5] fix: ci/cd configuration problems with biome --- 1 | 0 apps/web/src/app/booking/page.tsx | 2 +- .../components/AddPropertyModal.tsx | 1 - .../components/AvailableBalance.tsx | 2 - .../components/BookingStats.tsx | 1 - .../components/EarningsStats.tsx | 1 - .../components/PayoutHistory.tsx | 2 - .../components/RecentTransactions.tsx | 1 - .../app/dashboard/tenant-dashboard/page.tsx | 25 +--- apps/web/src/app/list/page.tsx | 1 - apps/web/src/app/search/property/page.tsx | 3 - apps/web/src/app/tenant-dashboard/page.tsx | 16 +-- .../blockchain/BlockchainStatusBadge.tsx | 8 +- .../src/components/booking/BookingForm.tsx | 2 +- .../src/components/dashboard/Analytics.tsx | 6 - .../components/dashboard/BookingHistory.tsx | 6 - .../dashboard/NotificationSystem.tsx | 7 -- .../dashboard/ProfileManagement.tsx | 3 - .../components/dashboard/PropertyCalendar.tsx | 3 - .../dashboard/PropertyManagement.tsx | 7 -- .../features/properties/PropertyDetail.tsx | 2 - .../properties/PropertyImageGallery.tsx | 2 +- apps/web/src/components/guards/RoleGuard.tsx | 29 +---- .../src/components/search/FilterSidebar.tsx | 2 +- apps/web/src/components/search/Map.tsx | 2 +- apps/web/src/components/search/SearchBar.tsx | 3 +- .../hooks/escrows/useInitializeContract.tsx | 1 - .../hooks/stellar/tests/useStellar.spec.ts | 10 +- apps/web/src/hooks/useBookingDetails.ts | 4 +- apps/web/src/hooks/useDashboard.ts | 1 - .../src/providers/TrustlessWorkProvider.tsx | 2 - apps/web/src/services/api.ts | 117 +++++------------- biome.json | 52 ++++---- 33 files changed, 81 insertions(+), 243 deletions(-) create mode 100644 1 diff --git a/1 b/1 new file mode 100644 index 00000000..e69de29b diff --git a/apps/web/src/app/booking/page.tsx b/apps/web/src/app/booking/page.tsx index ca259e6c..17f03d44 100644 --- a/apps/web/src/app/booking/page.tsx +++ b/apps/web/src/app/booking/page.tsx @@ -20,7 +20,7 @@ interface BookingPageProps { type BookingFlowStep = 'form' | 'payment' | 'confirmation'; export default function BookingPage({ params }: BookingPageProps) { - const { theme } = useTheme(); + const { theme: _theme } = useTheme(); const _router = useRouter(); const { isConnected, connect, publicKey } = useWallet(); diff --git a/apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx b/apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx index 8c27141a..3ed19b81 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/AddPropertyModal.tsx @@ -1,7 +1,6 @@ 'use client'; import { X } from 'lucide-react'; import type React from 'react'; -import type { Property } from '../types'; interface AddPropertyModalProps { open: boolean; diff --git a/apps/web/src/app/dashboard/host-dashboard/components/AvailableBalance.tsx b/apps/web/src/app/dashboard/host-dashboard/components/AvailableBalance.tsx index f18aac03..e308d545 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/AvailableBalance.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/AvailableBalance.tsx @@ -1,5 +1,3 @@ -import type React from 'react'; - interface AvailableBalanceProps { balance: number; onRequestPayout?: () => void; diff --git a/apps/web/src/app/dashboard/host-dashboard/components/BookingStats.tsx b/apps/web/src/app/dashboard/host-dashboard/components/BookingStats.tsx index 76dcba09..1d4295ea 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/BookingStats.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/BookingStats.tsx @@ -1,5 +1,4 @@ import { Calendar, Check, CheckCircle, Clock } from 'lucide-react'; -import type React from 'react'; import type { Booking } from '../types'; interface BookingStatsProps { diff --git a/apps/web/src/app/dashboard/host-dashboard/components/EarningsStats.tsx b/apps/web/src/app/dashboard/host-dashboard/components/EarningsStats.tsx index 7daa72aa..97d8e33a 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/EarningsStats.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/EarningsStats.tsx @@ -1,5 +1,4 @@ import { DollarSign, TrendingUp, Wallet } from 'lucide-react'; -import type React from 'react'; interface EarningsStatsProps { totalEarnings: number; diff --git a/apps/web/src/app/dashboard/host-dashboard/components/PayoutHistory.tsx b/apps/web/src/app/dashboard/host-dashboard/components/PayoutHistory.tsx index b6af286b..074d63f8 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/PayoutHistory.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/PayoutHistory.tsx @@ -1,5 +1,3 @@ -import type React from 'react'; - interface PayoutRecord { id: string; date: string; diff --git a/apps/web/src/app/dashboard/host-dashboard/components/RecentTransactions.tsx b/apps/web/src/app/dashboard/host-dashboard/components/RecentTransactions.tsx index 4eecd672..6bc8f7c3 100644 --- a/apps/web/src/app/dashboard/host-dashboard/components/RecentTransactions.tsx +++ b/apps/web/src/app/dashboard/host-dashboard/components/RecentTransactions.tsx @@ -1,5 +1,4 @@ import { Download } from 'lucide-react'; -import type React from 'react'; interface Transaction { id: number; diff --git a/apps/web/src/app/dashboard/tenant-dashboard/page.tsx b/apps/web/src/app/dashboard/tenant-dashboard/page.tsx index 5c4af42a..dee58ca0 100644 --- a/apps/web/src/app/dashboard/tenant-dashboard/page.tsx +++ b/apps/web/src/app/dashboard/tenant-dashboard/page.tsx @@ -5,44 +5,21 @@ import NotificationSystem from '@/components/dashboard/NotificationSystem'; import ProfileManagement from '@/components/dashboard/ProfileManagement'; import RoleGuard from '@/hooks/auth/RoleGuard'; import { - Activity, - AlertCircle, BarChart3, - Bath, - Bed, - Bell, Calendar, Check, CheckCircle, - ChevronDown, - ChevronRight, - Clock, - CreditCard, DollarSign, Download, Edit3, - Eye, - Filter, - Home, - Info, - MapPin, - MessageSquare, PieChart, - Plus, - Search, Settings, Star, - Trash2, - TrendingUp, User, - Users, Wallet, - X, - XCircle, } from 'lucide-react'; import Image from 'next/image'; -import type React from 'react'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; interface Booking { id: string; diff --git a/apps/web/src/app/list/page.tsx b/apps/web/src/app/list/page.tsx index d380194a..4506d385 100644 --- a/apps/web/src/app/list/page.tsx +++ b/apps/web/src/app/list/page.tsx @@ -1,5 +1,4 @@ 'use client'; -import React from 'react'; import ListingForm from '~/components/properties/ListingForm'; import { useAuthGuard } from '~/hooks/auth/use-auth-guard'; const Page = () => { diff --git a/apps/web/src/app/search/property/page.tsx b/apps/web/src/app/search/property/page.tsx index d05c0227..f20a4538 100644 --- a/apps/web/src/app/search/property/page.tsx +++ b/apps/web/src/app/search/property/page.tsx @@ -1,10 +1,7 @@ 'use client'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; -import { format } from 'date-fns/format'; import { Calendar, Home, MapPin, Star, Users, Wallet } from 'lucide-react'; -import { CalendarIcon } from 'lucide-react'; import Image from 'next/image'; import { useSearchParams } from 'next/navigation'; import type { FullPropertyProps } from 'public/mock-data'; diff --git a/apps/web/src/app/tenant-dashboard/page.tsx b/apps/web/src/app/tenant-dashboard/page.tsx index fa5edcd9..05e2cd86 100644 --- a/apps/web/src/app/tenant-dashboard/page.tsx +++ b/apps/web/src/app/tenant-dashboard/page.tsx @@ -1,17 +1,5 @@ 'use client'; -import { - AlertCircle, - Bell, - Check, - ChevronDown, - Home, - Loader2, - RefreshCw, - Search, - Settings, - User, - Wallet, -} from 'lucide-react'; +import { AlertCircle, Check, Home, Loader2, RefreshCw, Settings, User, Wallet } from 'lucide-react'; import Image from 'next/image'; import { useRouter } from 'next/navigation'; import { useEffect, useRef, useState } from 'react'; @@ -23,10 +11,8 @@ import { transformFromLegacyUser, transformToLegacyBooking, transformToLegacyUse import type { LegacyBooking as BookingType, Notification, - Transaction, LegacyUserProfile as UserProfile, } from '@/types'; -import BookingCard from './components/booking-card'; import { BookingModal, CancelModal } from './components/modal'; import ProfileManagement from './components/profile-management'; import WalletTransactions from './components/wallet-transaction'; diff --git a/apps/web/src/components/blockchain/BlockchainStatusBadge.tsx b/apps/web/src/components/blockchain/BlockchainStatusBadge.tsx index 74442786..4c4be3b1 100644 --- a/apps/web/src/components/blockchain/BlockchainStatusBadge.tsx +++ b/apps/web/src/components/blockchain/BlockchainStatusBadge.tsx @@ -2,7 +2,7 @@ import { Badge } from '@/components/ui/badge'; import { AlertTriangle, CheckCircle, RefreshCw, Shield, XCircle } from 'lucide-react'; -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import { type PropertyBlockchainStatus, getPropertyBlockchainStatus, @@ -30,7 +30,7 @@ export function BlockchainStatusBadge({ return null; } - const loadStatus = async () => { + const loadStatus = useCallback(async () => { setIsLoading(true); try { const blockchainStatus = await getPropertyBlockchainStatus(propertyId); @@ -44,13 +44,13 @@ export function BlockchainStatusBadge({ } finally { setIsLoading(false); } - }; + }, [propertyId]); useEffect(() => { if (propertyId) { loadStatus(); } - }, [propertyId]); + }, [propertyId, loadStatus]); if (isLoading) { return ( diff --git a/apps/web/src/components/booking/BookingForm.tsx b/apps/web/src/components/booking/BookingForm.tsx index ea039386..9e7fe8a2 100644 --- a/apps/web/src/components/booking/BookingForm.tsx +++ b/apps/web/src/components/booking/BookingForm.tsx @@ -28,7 +28,7 @@ interface BookingFormProps { } export function BookingForm({ onSubmit, propertyId }: BookingFormProps) { - const { isConnected, publicKey } = useWallet(); + const { isConnected: _isConnected, publicKey: _publicKey } = useWallet(); const [selectedDates, setSelectedDates] = useState({ from: undefined, to: undefined, diff --git a/apps/web/src/components/dashboard/Analytics.tsx b/apps/web/src/components/dashboard/Analytics.tsx index d7ccfcdd..66823b8e 100644 --- a/apps/web/src/components/dashboard/Analytics.tsx +++ b/apps/web/src/components/dashboard/Analytics.tsx @@ -4,18 +4,12 @@ import { Activity, ArrowDownRight, ArrowUpRight, - BarChart3, Calendar, DollarSign, Download, - Eye, - Filter, Home, - PieChart, RefreshCw, Star, - TrendingDown, - TrendingUp, Users, } from 'lucide-react'; import { useMemo, useState } from 'react'; diff --git a/apps/web/src/components/dashboard/BookingHistory.tsx b/apps/web/src/components/dashboard/BookingHistory.tsx index 40b3dd46..8086c368 100644 --- a/apps/web/src/components/dashboard/BookingHistory.tsx +++ b/apps/web/src/components/dashboard/BookingHistory.tsx @@ -5,16 +5,10 @@ import { Calendar, CheckCircle, Clock, - DollarSign, Download, - Edit, - ExternalLink, Eye, - Filter, MapPin, MessageSquare, - MoreHorizontal, - RefreshCw, Search, Star, Trash2, diff --git a/apps/web/src/components/dashboard/NotificationSystem.tsx b/apps/web/src/components/dashboard/NotificationSystem.tsx index 4464ff18..e3d4124b 100644 --- a/apps/web/src/components/dashboard/NotificationSystem.tsx +++ b/apps/web/src/components/dashboard/NotificationSystem.tsx @@ -1,22 +1,15 @@ 'use client'; import { - AlertCircle, Bell, - Calendar, - Check, - CheckCircle, Clock, - CreditCard, DollarSign, - Eye, Home, Info, MessageSquare, Settings, Star, Trash2, - User, X, } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; diff --git a/apps/web/src/components/dashboard/ProfileManagement.tsx b/apps/web/src/components/dashboard/ProfileManagement.tsx index beb5a681..9b6cd7d0 100644 --- a/apps/web/src/components/dashboard/ProfileManagement.tsx +++ b/apps/web/src/components/dashboard/ProfileManagement.tsx @@ -4,8 +4,6 @@ import { AlertCircle, Bell, Camera, - CheckCircle, - CreditCard, Edit, Eye, EyeOff, @@ -19,7 +17,6 @@ import { Trash2, Upload, User, - X, } from 'lucide-react'; import Image from 'next/image'; import { useCallback, useRef, useState } from 'react'; diff --git a/apps/web/src/components/dashboard/PropertyCalendar.tsx b/apps/web/src/components/dashboard/PropertyCalendar.tsx index 6abe4d9d..3a05a891 100644 --- a/apps/web/src/components/dashboard/PropertyCalendar.tsx +++ b/apps/web/src/components/dashboard/PropertyCalendar.tsx @@ -8,10 +8,7 @@ import { Clock, Download, Edit, - Eye, - Filter, Plus, - Settings, Trash2, X, } from 'lucide-react'; diff --git a/apps/web/src/components/dashboard/PropertyManagement.tsx b/apps/web/src/components/dashboard/PropertyManagement.tsx index 853cf95c..90384819 100644 --- a/apps/web/src/components/dashboard/PropertyManagement.tsx +++ b/apps/web/src/components/dashboard/PropertyManagement.tsx @@ -1,29 +1,22 @@ 'use client'; import { - Activity, AlertCircle, BarChart3, Bath, Bed, Calendar, - Check, CheckCircle, - ChevronDown, - ChevronRight, Clock, DollarSign, Edit3, Eye, - Filter, Home, MapPin, PieChart, Plus, Search, - Settings, Star, - Trash2, TrendingUp, Upload, Users, diff --git a/apps/web/src/components/features/properties/PropertyDetail.tsx b/apps/web/src/components/features/properties/PropertyDetail.tsx index 6ee8e397..0e043bc6 100644 --- a/apps/web/src/components/features/properties/PropertyDetail.tsx +++ b/apps/web/src/components/features/properties/PropertyDetail.tsx @@ -31,7 +31,6 @@ import { getPropertyById } from '@/lib/data/properties'; import type { PropertyDetailProps } from '@/lib/types/property'; import { Bath, - Calendar, Car, ChevronDown, ChevronUp, @@ -49,7 +48,6 @@ import { Wifi, Wind, } from 'lucide-react'; -import Image from 'next/image'; import Link from 'next/link'; import type React from 'react'; import { useState } from 'react'; diff --git a/apps/web/src/components/features/properties/PropertyImageGallery.tsx b/apps/web/src/components/features/properties/PropertyImageGallery.tsx index ee0b7135..1d2ae9ee 100644 --- a/apps/web/src/components/features/properties/PropertyImageGallery.tsx +++ b/apps/web/src/components/features/properties/PropertyImageGallery.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'; import type { PropertyImageGalleryProps } from '@/lib/types/property'; -import { ChevronLeft, ChevronRight, X, ZoomIn } from 'lucide-react'; +import { ChevronLeft, ChevronRight, ZoomIn } from 'lucide-react'; import Image from 'next/image'; import { useCallback, useEffect, useState } from 'react'; diff --git a/apps/web/src/components/guards/RoleGuard.tsx b/apps/web/src/components/guards/RoleGuard.tsx index ce34d7f4..c625beae 100644 --- a/apps/web/src/components/guards/RoleGuard.tsx +++ b/apps/web/src/components/guards/RoleGuard.tsx @@ -1,11 +1,7 @@ 'use client'; import { useRouter } from 'next/navigation'; -<<<<<<< HEAD import { useEffect, useState } from 'react'; -======= -import { useEffect } from 'react'; ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup) import { useUserRole } from '~/hooks/useUserRole'; import type { UserRole } from '~/types/roles'; @@ -20,7 +16,6 @@ export function RoleGuard({ requiredRole, fallbackPath = '/become-host', }: RoleGuardProps) { -<<<<<<< HEAD const roleInfo = useUserRole(); const { canAccessHostDashboard, isLoading } = roleInfo; const router = useRouter(); @@ -45,16 +40,12 @@ export function RoleGuard({

Verifying access...

-======= - const { canAccessHostDashboard } = useUserRole(); - const router = useRouter(); - - useEffect(() => { - if (requiredRole === 'host' && !canAccessHostDashboard) { - router.push(fallbackPath); - } - }, [requiredRole, canAccessHostDashboard, router, fallbackPath]); +
+
+ ); + } + // Show unauthorized UI if user doesn't have required access if (requiredRole === 'host' && !canAccessHostDashboard) { return (
@@ -68,19 +59,11 @@ export function RoleGuard({ > Become a Host ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup)
); } -<<<<<<< HEAD - // Return null during redirect to prevent flash of unauthorized content - if (requiredRole === 'host' && !canAccessHostDashboard) { - return null; - } - -======= ->>>>>>> 60310ea (feat: add stellar contract dependencies and integration setup) + // User has access, render children return <>{children}; } diff --git a/apps/web/src/components/search/FilterSidebar.tsx b/apps/web/src/components/search/FilterSidebar.tsx index e1483cdd..7f997acf 100644 --- a/apps/web/src/components/search/FilterSidebar.tsx +++ b/apps/web/src/components/search/FilterSidebar.tsx @@ -64,7 +64,7 @@ export default function FilterSidebar({ useEffect(() => { onFiltersChange({ price, amenities, rating }); - }, [price, amenities, rating]); + }, [price, amenities, rating, onFiltersChange]); return (