Skip to content

Commit 198d1ac

Browse files
authored
Feat/implement funding related fn (boundlessfi#71)
* feat(project): implement funding and milestone management features - Add funding and milestone functionalities to the BoundlessContract. - Introduce helper functions to check if funding and voting periods have ended. - Implement methods for approving, rejecting, and releasing milestones. - Enhance project struct with new fields for milestone approvals and releases. - Update error handling for various project states including funding and milestone operations. - Add tests for funding operations, milestone approvals, and refunds to ensure functionality and correctness. * refactor: clean up comments and improve code readability in contract and test files - Remove unnecessary comments in the BoundlessContract implementation to enhance clarity. - Update test files to streamline initialization and project deadline checks. - Adjust comments in milestone funding tests for better understanding of test cases. * docs: add contract function documentation file * fix(tests): remove duplicate init_upgrade_test module import feat(contracts): add util.ts with default RPC URL and network passphrase * modifed deploy * feat: enhance project management with milestones and wallet connection features - Added milestone management capabilities, including creation, updates, and attachments. - Implemented wallet connection protection for project actions, ensuring users are prompted to connect their wallets when necessary. - Updated user profile handling to include new fields and improved error handling in API routes. - Refactored components for better organization and user experience, including profile display and edit forms. - Introduced new UI components for wallet connection and project forms, enhancing the overall user interface. - Updated dependencies and improved code readability across various files. * refactor: remove unused parameter from ProjectPage component - Updated ProjectPage component to eliminate the unused 'params' parameter, improving code clarity and adherence to linting rules. * refactor: remove unused parameter from ProjectPage component - Updated ProjectPage component to eliminate the unused 'params' parameter, improving code clarity and adherence to linting rules. * refactor: improve code readability and organization in contract and test files - Reordered imports and formatted code for better clarity in contract.rs. - Enhanced readability by restructuring conditional statements and method calls. - Cleaned up whitespace in test files to maintain consistency and improve overall code quality. * chore: remove contract pipeline workflow file - Deleted the contract-pipeline.yml file from GitHub workflows, streamlining the CI/CD configuration.
1 parent d71bd4a commit 198d1ac

55 files changed

Lines changed: 4150 additions & 1920 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/contract-pipeline.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ jobs:
3636
PUBLIC_STELLAR_RPC_URL: https://soroban-testnet.stellar.org/
3737
run: |
3838
npm ci
39+
STELLAR_NETWORK=$STELLAR_NETWORK \
40+
STELLAR_ACCOUNT=$STELLAR_ACCOUNT \
41+
STELLAR_SECRET_KEY=$STELLAR_SECRET_KEY \
42+
SOROBAN_SECRET_KEY=$SOROBAN_SECRET_KEY \
43+
PUBLIC_STELLAR_NETWORK_PASSPHRASE=$PUBLIC_STELLAR_NETWORK_PASSPHRASE \
44+
PUBLIC_STELLAR_RPC_URL=$PUBLIC_STELLAR_RPC_URL \
3945
npm run init
4046
4147
- name: Build Next.js app

app/(dashboard)/profile/page.tsx

Lines changed: 129 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,157 @@
22

33
import ProfileDisplay from "@/components/dashboard/profile/ProfileDisplay";
44
import ProfileEditForm from "@/components/dashboard/profile/ProfileEditForm";
5+
import { Card } from "@/components/ui/card";
6+
import { Skeleton } from "@/components/ui/skeleton";
7+
import type { UserProfile } from "@/types/user";
58
import axios from "axios";
69
import React, { useState, useEffect } from "react";
710

811
export default function ProfilePage() {
9-
const [userData, setUserData] = useState<{
10-
username: string;
11-
displayName: string;
12-
bio?: string;
13-
twitter?: string;
14-
linkedIn?: string;
15-
} | null>(null);
12+
const [userData, setUserData] = useState<UserProfile | null>(null);
1613
const [isEditing, setIsEditing] = useState(false);
14+
const [isLoading, setIsLoading] = useState(true);
15+
const [error, setError] = useState<string | null>(null);
1716

1817
useEffect(() => {
1918
async function fetchUserData() {
2019
try {
20+
setIsLoading(true);
21+
setError(null);
2122
const res = await axios.get("/api/user/profile");
2223
setUserData(res.data);
2324
} catch (error) {
2425
console.error("Error fetching user data:", error);
26+
setError("Failed to load profile data. Please try again later.");
27+
} finally {
28+
setIsLoading(false);
2529
}
2630
}
2731
fetchUserData();
2832
}, []);
2933

34+
if (isLoading) {
35+
return (
36+
<div className="container mx-auto max-w-4xl py-8 px-4">
37+
<Card className="p-6">
38+
<div className="space-y-6">
39+
<div className="flex items-center space-x-4">
40+
<Skeleton className="h-12 w-12 rounded-full" />
41+
<div className="space-y-2">
42+
<Skeleton className="h-4 w-[200px]" />
43+
<Skeleton className="h-4 w-[150px]" />
44+
</div>
45+
</div>
46+
<div className="space-y-2">
47+
<Skeleton className="h-4 w-full" />
48+
<Skeleton className="h-4 w-[80%]" />
49+
</div>
50+
<div className="space-y-2">
51+
<Skeleton className="h-4 w-[60%]" />
52+
<Skeleton className="h-4 w-[40%]" />
53+
</div>
54+
</div>
55+
</Card>
56+
</div>
57+
);
58+
}
59+
60+
if (error) {
61+
return (
62+
<div className="container mx-auto max-w-4xl py-8 px-4">
63+
<Card className="p-6">
64+
<div className="flex flex-col items-center justify-center space-y-4 text-center">
65+
<div className="rounded-full bg-red-100 p-3">
66+
<svg
67+
className="h-6 w-6 text-red-600"
68+
fill="none"
69+
stroke="currentColor"
70+
viewBox="0 0 24 24"
71+
>
72+
<title>Error Icon</title>
73+
<path
74+
strokeLinecap="round"
75+
strokeLinejoin="round"
76+
strokeWidth={2}
77+
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
78+
/>
79+
</svg>
80+
</div>
81+
<h2 className="text-xl font-semibold text-gray-900">
82+
Error Loading Profile
83+
</h2>
84+
<p className="text-gray-600">{error}</p>
85+
<button
86+
type="button"
87+
onClick={() => window.location.reload()}
88+
className="rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
89+
>
90+
Try Again
91+
</button>
92+
</div>
93+
</Card>
94+
</div>
95+
);
96+
}
97+
3098
if (!userData) {
31-
return <div>Loading...</div>;
99+
return (
100+
<div className="container mx-auto max-w-4xl py-8 px-4">
101+
<Card className="p-6">
102+
<div className="flex flex-col items-center justify-center space-y-4 text-center">
103+
<div className="rounded-full bg-gray-100 p-3">
104+
<svg
105+
className="h-6 w-6 text-gray-600"
106+
fill="none"
107+
stroke="currentColor"
108+
viewBox="0 0 24 24"
109+
>
110+
<title>Profile Icon</title>
111+
<path
112+
strokeLinecap="round"
113+
strokeLinejoin="round"
114+
strokeWidth={2}
115+
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
116+
/>
117+
</svg>
118+
</div>
119+
<h2 className="text-xl font-semibold text-gray-900">
120+
No Profile Found
121+
</h2>
122+
<p className="text-gray-600">
123+
We couldn&apos;t find your profile information.
124+
</p>
125+
</div>
126+
</Card>
127+
</div>
128+
);
32129
}
33130

34131
return (
35-
<div className="p-4">
36-
{isEditing ? (
37-
<ProfileEditForm
38-
initialData={userData}
39-
onSuccess={(updatedData) => {
40-
setUserData(updatedData);
41-
setIsEditing(false);
42-
}}
43-
onCancel={() => setIsEditing(false)}
44-
/>
45-
) : (
46-
<ProfileDisplay userData={userData} onEdit={() => setIsEditing(true)} />
47-
)}
132+
<div className="container mx-auto max-w-4xl py-8 px-4">
133+
<div className="mb-8">
134+
<h1 className="text-2xl font-bold text-gray-900">Profile</h1>
135+
<p className="mt-2 text-sm text-gray-600">
136+
Manage your profile information and preferences
137+
</p>
138+
</div>
139+
<Card className="overflow-hidden">
140+
{isEditing ? (
141+
<ProfileEditForm
142+
initialData={userData}
143+
onSuccess={(updatedData) => {
144+
setUserData(updatedData);
145+
setIsEditing(false);
146+
}}
147+
onCancel={() => setIsEditing(false)}
148+
/>
149+
) : (
150+
<ProfileDisplay
151+
userData={userData}
152+
onEdit={() => setIsEditing(true)}
153+
/>
154+
)}
155+
</Card>
48156
</div>
49157
);
50158
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { ProjectViewerPage } from "./viewer/project-viewer-page"
1+
import { ProjectViewerPage } from "./viewer/project-viewer-page";
22

3-
export default function ProjectPage({ params }: { params: { id: string } }) {
4-
return <ProjectViewerPage />
5-
}
3+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4+
export default function ProjectPage() {
5+
return <ProjectViewerPage />;
6+
}

0 commit comments

Comments
 (0)