Skip to content

Commit

Permalink
last comment and ensure it builds
Browse files Browse the repository at this point in the history
Signed-off-by: Deggen <[email protected]>
  • Loading branch information
sirdeggen committed Feb 21, 2025
1 parent d9758d9 commit f5a13b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
14 changes: 0 additions & 14 deletions front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@
* - Real-time balance monitoring
*/

import { useState, useEffect } from 'react'
import Upload from './Upload'
import Download from './Download'
import './App.css'
import { QRCodeSVG } from 'qrcode.react'
import Funding from './Funding'

/** Base API URL with environment-specific configuration */
const API_URL = import.meta.env?.VITE_API_URL || 'http://localhost:3030'


/**
* Main application component
*
Expand All @@ -32,14 +26,6 @@ const API_URL = import.meta.env?.VITE_API_URL || 'http://localhost:3030'
* 2. Uploading files for blockchain timestamping
* 3. Downloading files with integrity proofs
*
* State Management:
* - Tracks treasury status (address, balance, tokens)
* - Manages token creation process
* - Handles loading states during API calls
*
* API Integration:
* - GET /checkTreasury - Fetch treasury status
* - POST /fund/:tokens - Create new write tokens
*
* @component
* @example
Expand Down
24 changes: 23 additions & 1 deletion front/src/Funding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@ interface FundingInfo {
tokens: number
}

/**
* Funding Component
*
* This component is responsible for displaying and managing the treasury information for funding.
*
* Functionality:
* - Displays the current Bitcoin address for funding the treasury as a QR code.
* - Shows the current balance in satoshis and the number of available write tokens.
* - Allows the user to create new write tokens by specifying the number of tokens and clicking a button.
*
* State Management:
* - `fundingInfo`: Tracks the treasury status including address, balance, and tokens.
* - `loading`: Manages the loading state during API calls.
* - `tokenNumber`: Stores the number of tokens to be created.
*
* API Integration:
* - `fetchFundingInfo`: Fetches the current treasury status from the API and updates the state.
* - `createFunds`: Creates new write tokens in the treasury by making a POST request to the API.
*
* Lifecycle:
* - On component mount, it initializes the treasury information by calling `fetchFundingInfo`.
*/
export default function Funding() {
// State for treasury information and UI control
const [fundingInfo, setFundingInfo] = useState<FundingInfo>({ address: '', balance: 0, tokens: 0 })
Expand All @@ -40,7 +62,7 @@ export default function Funding() {
setLoading(false)
}
}

/**
* Fetch current treasury status
* Updates the fundingInfo state with latest treasury information
Expand Down

0 comments on commit f5a13b5

Please sign in to comment.