Skip to content

Commit

Permalink
Merge pull request #72 from Gigentic/payment_page_fix
Browse files Browse the repository at this point in the history
write reviews on chain
  • Loading branch information
csmarc authored Dec 16, 2024
2 parents 6d24c37 + d4785a8 commit 065247e
Show file tree
Hide file tree
Showing 84 changed files with 4,665 additions and 8,126 deletions.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions notes/diagrams/backup/hooks/hooks1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```mermaid
graph TD
A[EscrowManagement] --> B[useEscrowAccounts]
A --> C[useSelectedFreelancer]
A --> D[useServiceTitles]
A --> E[useEscrowTransactions]
A --> F[useEscrowStatus]
B --> G[Fetch Escrow Accounts]
C --> H[Fetch Freelancer Data]
D --> I[Fetch Service Titles]
E --> J[Handle Transactions]
F --> K[Check Escrow Status]
G -->|Data| A
H -->|Data| A
I -->|Titles| A
J -->|Transaction Handlers| A
K -->|Status| A
```
69 changes: 69 additions & 0 deletions notes/diagrams/backup/hooks/hooks2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
```mermaid
graph TD
subgraph "Component Layer"
EM[EscrowManagement]
EL[EscrowList]
EC[EscrowCard]
end
subgraph "Hook Layer"
EA[useEscrowAccounts]
ST[useServiceTitles]
ES[useEscrowStatus]
ET[useEscrowTransactions]
SF[useSelectedFreelancer]
end
subgraph "State Management"
RQ[React Query Cache]
TS[Title States]
ESt[Escrow States]
subgraph "Memoized Values"
ME[Memoized Escrows]
MSA[Memoized Service Account]
end
end
subgraph "Blockchain Queries"
EAQ[program.account.escrow.all]
SRQ[serviceRegistry.fetch]
SAQ[service.fetch]
end
%% Component Relationships
EM --> EL
EL --> EC
%% Hook Dependencies
EA -->|accounts| EM
ST -->|serviceTitles| EM
ES -->|isServiceInEscrow| EM
ET -->|handlers| EM
SF -->|freelancer| EM
%% State Flow
EA -->|escrows| RQ
RQ -->|cached escrows| ME
ME -->|filtered| ST
SF -->|data| MSA
%% Blockchain Query Flow
EA -->|fetch| EAQ
ST -->|fetch| SRQ
ST -->|fetch| SAQ
%% Update Cycles
ME -->|deps| ST
ST -->|update| TS
TS -->|render| EL
classDef component fill:#a8e6cf,stroke:#3b6978,stroke-width:2px;
classDef hook fill:#dcedc1,stroke:#3b6978,stroke-width:2px;
classDef state fill:#ffd3b6,stroke:#3b6978,stroke-width:2px;
classDef query fill:#ffaaa5,stroke:#3b6978,stroke-width:2px;
class EM,EL,EC component;
class EA,ST,ES,ET,SF hook;
class RQ,TS,ESt,ME,MSA state;
class EAQ,SRQ,SAQ query;
```
40 changes: 40 additions & 0 deletions notes/diagrams/backup/hooks/hooks3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
```mermaid
stateDiagram-v2
[*] --> InitialState
state "Component States" as ComponentStates {
InitialState --> LoadingState: Mount EscrowManagement
LoadingState --> DisplayingEscrows: Accounts Loaded
LoadingState --> NoEscrows: No Data
state "Payment Flow" as PaymentFlow {
DisplayingEscrows --> ProcessingPayment: handlePayIntoEscrow
ProcessingPayment --> TransactionPending: Send Transaction
TransactionPending --> TransactionConfirmed: Success
TransactionConfirmed --> RefetchingEscrows: Clear Cache
RefetchingEscrows --> DisplayingEscrows: Update UI
}
state "Release Flow" as ReleaseFlow {
DisplayingEscrows --> ProcessingRelease: handleReleaseEscrow
ProcessingRelease --> FindingServiceIndex: Find Service
FindingServiceIndex --> ReleasingFunds: Submit Transaction
ReleasingFunds --> RefetchingEscrows: Success
}
}
state "Hook Dependencies" as HookStates {
state "Primary Hooks" as PrimaryHooks {
useEscrowAccounts --> useGigenticProgram
useServiceTitles --> useGigenticProgram
useEscrowStatus --> useGigenticProgram
useEscrowTransactions --> useGigenticProgram
}
state "Cache Management" as CacheStates {
ReactQuery --> EscrowCache: Store Accounts
EscrowCache --> MemoizedEscrows: Filter User Escrows
ServiceTitlesCache --> DisplayData: Update UI
}
}
```
27 changes: 27 additions & 0 deletions notes/diagrams/backup/hooks/hooks4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```mermaid
graph TD
subgraph "Current Cache Flow"
direction LR
RQ1[React Query Cache]
EA1[useEscrowAccounts]
ST1[useServiceTitles]
EM1[EscrowManagement]
RQ1 -->|"Separate Queries"| EA1
RQ1 -->|"Separate Queries"| ST1
EA1 -->|"Filter & Transform"| EM1
ST1 -->|"Debounced Updates"| EM1
end
subgraph "Optimized Cache Flow"
direction LR
RQ2[React Query Cache]
QK[Query Keys]
TC[Transform Layer]
EM2[EscrowManagement]
RQ2 -->|"Combined Query"| QK
QK -->|"Structured Data"| TC
TC -->|"Memoized State"| EM2
end
```
66 changes: 66 additions & 0 deletions notes/diagrams/backup/hooks/hooks5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
```mermaid
graph TD
subgraph "Component Layer"
EM[EscrowManagement]
EL[EscrowList]
EC[EscrowCard]
end
subgraph "Custom Hooks"
UED[useEscrowData]
UET[useEscrowTransactions]
UES[useEscrowStatus]
USF[useSelectedFreelancer]
end
subgraph "Cache Layer"
RQC[React Query Cache]
subgraph "Cached States"
ES[Escrow States]
TS[Title States]
FS[Freelancer State]
end
end
subgraph "Blockchain Queries"
EA[program.account.escrow.all]
SF[program.account.service.fetch]
TH[Transaction Handlers]
end
%% Component Dependencies
EM --> EL
EL --> EC
%% Hook Flow
UED -->|Escrows & Titles| EM
UET -->|Transaction Handlers| EM
UES -->|Escrow Status| EM
USF -->|Selected Freelancer| EM
%% Cache Management
EA -->|Fetch| RQC
SF -->|Fetch| RQC
RQC -->|Cache| ES
RQC -->|Cache| TS
RQC -->|Cache| FS
%% Data Flow
ES -->|Filter| UED
TS -->|Map| UED
FS -->|Transform| USF
%% Transaction Flow
TH -->|Pay/Release| UET
UET -->|Invalidate| RQC
classDef component fill:#e1f5fe,stroke:#01579b,stroke-width:2px;
classDef hook fill:#fff3e0,stroke:#ff6f00,stroke-width:2px;
classDef cache fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px;
classDef query fill:#ffebee,stroke:#c62828,stroke-width:2px;
class EM,EL,EC component;
class UED,UET,UES,USF hook;
class RQC,ES,TS,FS cache;
class EA,SF,TH query;
```
23 changes: 23 additions & 0 deletions notes/diagrams/backup/hooks/hooks6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```mermaid
graph TD
subgraph "Data Flow"
EA[Escrow Account]
SP[Service Provider PubKey]
SA[Service Account]
ST[Service Title]
ED[Escrow Display]
end
subgraph "Cache Layer"
RQC[React Query Cache]
TM[Title Mapping]
end
EA -->|Contains| SP
SP -->|Fetch| SA
SA -->|Extract| ST
ST -->|Store in| TM
TM -->|Display in| ED
RQC -.->|Cache| TM
```
68 changes: 68 additions & 0 deletions notes/diagrams/backup/review-interfaces-v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
```mermaid
classDiagram
class ReviewFormProps {
+string escrowId
+string serviceTitle
+string providerName
+string amount
+function onSubmitReview
}
class ReviewTabProps {
+Review[] completedReviews
+Review[] pendingReviews
+function onReviewSubmit
}
class Review {
+string serviceTitle
+string status [ pending | completed ]
+string role [ customer | provider ]
}
class ChainReview {
+PublicKey publicKey
+ReviewAccount account
}
class ReviewAccount {
+string reviewId
+number providerToCustomerRating
+number customerToProviderRating
+PublicKey customer
+PublicKey serviceProvider
+string providerToCustomerReview
+string customerToProviderReview
}
class ReviewSubmitData {
+string reviewId
+number rating
+string review
+string role [ customer | provider ]
}
class ReviewCardProps {
+Review review
+string type [ given | received]
}
class UnreviewedServiceCardProps {
+function onReviewSubmit: ReviewSubmitData => Promise<>
}
ChainReview *-- ReviewAccount
Review --|> ChainReview
UnreviewedServiceCardProps --|> ReviewCardProps
ReviewTabProps o-- Review
ReviewTabProps o-- ReviewSubmitData
ReviewCardProps o-- Review
UnreviewedServiceCardProps o-- ReviewSubmitData
note for Review "Extends ChainReview with UI-specific fields"
note for ReviewSubmitData "Used when submitting a new review"
note for ReviewTabProps "Props passed to both GivenReviews and ReceivedReviews tabs"
note for UnreviewedServiceCardProps "Extends ReviewCardProps with submit functionality"
```
Loading

0 comments on commit 065247e

Please sign in to comment.