Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/frontend/app/contexts/ToastProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React, { useState, useCallback } from 'react';
import ToastContext, { Toast, ToastType } from './ToastContext';
import ToastContainer from '@/component/ui/ToastContainer';
import ToastContainer from '@/components/ui/ToastContainer';

export function ToastProvider({ children }: { children: React.ReactNode }) {
const [toasts, setToasts] = useState<Toast[]>([]);
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { useState } from 'react';
import StatusTabs from '@/component/dashboard/StatusTabs';
import EscrowList from '@/component/dashboard/EscrowList';
import EscrowFilters from '@/component/dashboard/EscrowFilters';
import StatusTabs from '@/components/dashboard/StatusTabs';
import EscrowList from '@/components/dashboard/EscrowList';
import EscrowFilters from '@/components/dashboard/EscrowFilters';
import { useEscrows } from '../../hooks/useEscrows';
import { IEscrow } from '@/types/escrow';
import ActivityFeed from '@/components/common/ActivityFeed';
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/app/escrow/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CreateEscrowWizard from '@/component/escrow/CreateEscrowWizard';
import CreateEscrowWizard from '@/components/escrow/CreateEscrowWizard';

export default function CreateEscrowPage() {
return (
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import Providers from "@/component/Providers";
import Navbar from "@/component/layout/Navbar";
import Providers from '@/components/layout/Providers';
import Navbar from "@/components/layout/Navbar";
import FileDisputeModal from "@/components/escrow/detail/file-dispute-modal";

const geistSans = Geist({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
import React from 'react';
// Temporarily define the interface here until types are properly configured
interface IEscrow {
id: string;
title: string;
description: string;
amount: string;
asset: string;
creatorAddress: string;
counterpartyAddress: string;
deadline: string;
status: 'created' | 'funded' | 'confirmed' | 'released' | 'completed' | 'cancelled' | 'disputed';
createdAt: string;
updatedAt: string;
milestones?: Array<{
id: string;
title: string;
amount: string;
status: 'pending' | 'released';
}>;
}
import { IEscrow } from '@/types/escrow';

interface EscrowCardProps {
escrow: IEscrow;
Expand Down Expand Up @@ -75,13 +56,13 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {

const getQuickActions = () => {
const actions = [];

// Based on status, show appropriate actions
switch (escrow.status) {
case 'created':
case 'funded':
actions.push(
<a
<a
key="view-details"
href={`/escrow/${escrow.id}`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
Expand All @@ -92,14 +73,14 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
break;
case 'confirmed':
actions.push(
<a
<a
key="confirm-delivery"
href={`/escrow/${escrow.id}/confirm`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
>
Confirm Delivery
</a>,
<a
<a
key="dispute"
href={`/escrow/${escrow.id}/dispute`}
className="text-red-600 hover:text-red-900 text-sm font-medium ml-4"
Expand All @@ -110,7 +91,7 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
break;
case 'released':
actions.push(
<a
<a
key="view-details"
href={`/escrow/${escrow.id}`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
Expand All @@ -121,7 +102,7 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
break;
case 'completed':
actions.push(
<a
<a
key="view-details"
href={`/escrow/${escrow.id}`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
Expand All @@ -132,7 +113,7 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
break;
case 'disputed':
actions.push(
<a
<a
key="view-details"
href={`/escrow/${escrow.id}`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
Expand All @@ -143,7 +124,7 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
break;
default:
actions.push(
<a
<a
key="view-details"
href={`/escrow/${escrow.id}`}
className="text-blue-600 hover:text-blue-900 text-sm font-medium"
Expand All @@ -152,7 +133,7 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
</a>
);
}

return actions;
};

Expand All @@ -168,30 +149,30 @@ const EscrowCard: React.FC<EscrowCardProps> = ({ escrow }) => {
</span>
</div>
<p className="mt-1 text-sm text-gray-500 line-clamp-2">{escrow.description}</p>

<div className="mt-4 grid grid-cols-2 md:grid-cols-4 gap-4">
<div>
<p className="text-sm font-medium text-gray-500">Amount</p>
<p className="text-sm text-gray-900">{escrow.amount} {escrow.asset}</p>
</div>

<div>
<p className="text-sm font-medium text-gray-500">Counterparty</p>
<p className="text-sm text-gray-900 truncate">{escrow.counterpartyAddress.substring(0, 10)}...</p>
</div>

<div>
<p className="text-sm font-medium text-gray-500">Created</p>
<p className="text-sm text-gray-900">{formatDate(escrow.createdAt)}</p>
</div>

<div>
<p className="text-sm font-medium text-gray-500">Deadline</p>
<p className="text-sm text-gray-900">{formatDate(escrow.deadline)}</p>
</div>
</div>
</div>

<div className="ml-4 flex-shrink-0 flex flex-col items-end space-y-3">
<div className="flex space-x-3">
{getQuickActions()}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import Input from '@/component/ui/Input';
import Input from '@/components/ui/Input';

interface EscrowFiltersProps {
searchQuery: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,7 @@ import Link from 'next/link';
import EscrowCard from './EscrowCard';
import { EscrowCardSkeleton } from '@/components/ui/EscrowCardSkeleton';

// Define the interface here since we can't import from types yet
interface IEscrow {
id: string;
title: string;
description: string;
amount: string;
asset: string;
creatorAddress: string;
counterpartyAddress: string;
deadline: string;
status: 'created' | 'funded' | 'confirmed' | 'released' | 'completed' | 'cancelled' | 'disputed';
createdAt: string;
updatedAt: string;
milestones?: Array<{
id: string;
title: string;
amount: string;
status: 'pending' | 'released';
}>;
}
import { IEscrow } from '@/types/escrow';

interface EscrowListProps {
escrows: IEscrow[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React, { useState } from 'react';
import FulfillConditionModal from './FulfillConditionModal';

interface Condition {
id: string;
description: string;
fulfilled: boolean;
confirmed: boolean;
}
import { Condition } from '@/types/escrow';

interface Props {
condition: Condition;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import React from 'react';
import ConditionItem from './ConditionItem';

interface Condition {
id: string;
description: string;
fulfilled: boolean;
confirmed: boolean;
}
import { Condition } from '@/types/escrow';

interface Props {
conditions: Condition[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { useFormContext } from 'react-hook-form';
import { CreateEscrowFormData } from '@/lib/escrow-schema';
import Input from '../../ui/Input';
import TextArea from '../../ui/TextArea';
import Select from '../../ui/Select';
import Input from '@/components/ui/Input';
import TextArea from '@/components/ui/TextArea';
import Select from '@/components/ui/BasicSelect';

export default function BasicInfoStep() {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useFormContext } from 'react-hook-form';
import { CreateEscrowFormData } from '@/lib/escrow-schema';
import Input from '../../ui/Input';
import Input from '@/components/ui/Input';

export default function PartiesStep() {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { useFormContext } from 'react-hook-form';
import { CreateEscrowFormData } from '@/lib/escrow-schema';
import Input from '../../ui/Input';
import Select from '../../ui/Select';
import Input from '@/components/ui/Input';
import Select from '@/components/ui/BasicSelect';

export default function TermsStep() {
const {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/components/escrow/detail/file-dispute-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useState } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Textarea } from "@/components/ui/textarea";
import { Input } from "@/components/ui/input";
import TextArea from "@/components/ui/TextArea";
import Input from "@/components/ui/Input";
import { Loader2 } from "lucide-react";
import axios from "axios";

Expand Down Expand Up @@ -107,7 +107,7 @@ export default function FileDisputeModal({
{/* Description */}
<div className="mt-4">
<label className="text-sm font-medium">Description *</label>
<Textarea
<TextArea
placeholder="Provide detailed explanation..."
value={description}
onChange={(e) => setDescription(e.target.value)}
Expand Down
21 changes: 0 additions & 21 deletions apps/frontend/components/ui/input.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions apps/frontend/components/ui/textarea.tsx

This file was deleted.

32 changes: 32 additions & 0 deletions apps/frontend/fix_edge_cases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const fs = require('fs');
const path = require('path');

function walk(dir, callback) {
const files = fs.readdirSync(dir);
for (const file of files) {
if (file === 'node_modules' || file === '.next' || file.startsWith('.')) continue;
const filepath = path.join(dir, file);
if (fs.statSync(filepath).isDirectory()) {
walk(filepath, callback);
} else if (file.endsWith('.ts') || file.endsWith('.tsx')) {
callback(filepath);
}
}
}

let modified = 0;
walk('./', (filepath) => {
let content = fs.readFileSync(filepath, 'utf8');
let original = content;

content = content.replace(/['"]([./]+)ui\/Select['"]/g, "'$1ui/BasicSelect'");
content = content.replace(/['"]@\/components\/Providers['"]/g, "'@/components/layout/Providers'");
content = content.replace(/['"]@\/components\/ui\/Select['"]/g, "'@/components/ui/BasicSelect'");

if (content !== original) {
fs.writeFileSync(filepath, content, 'utf8');
modified++;
console.log(`Fixed in: ${filepath}`);
}
});
console.log(`Done. Modified ${modified} files.`);
14 changes: 12 additions & 2 deletions apps/frontend/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import type { NextConfig } from "next";
import path from 'path';
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
/* config options here */
turbopack: {
root: __dirname,
},
webpack(config) {
config.resolve ||= {};
config.resolve.alias ||= {};
config.resolve.alias['@/components/ui'] = path.resolve(__dirname, 'components/ui');
config.resolve.alias['@/components'] = path.resolve(__dirname, 'components');
return config;
},
};

export default nextConfig;
Loading