diff --git a/frontend/components/CommentInput.tsx b/frontend/components/CommentInput.tsx index 3dc199b0..79787542 100644 --- a/frontend/components/CommentInput.tsx +++ b/frontend/components/CommentInput.tsx @@ -13,7 +13,6 @@ interface CommentInputProps { } export function CommentInput({ - proposalId, onSubmit, isReply = false, onCancel, @@ -22,7 +21,6 @@ export function CommentInput({ const { userSession } = useConnect(); const [content, setContent] = useState(''); const [error, setError] = useState(null); - void proposalId; const handleSubmit = () => { if (!userSession) { diff --git a/frontend/components/Comments.tsx b/frontend/components/Comments.tsx index e6dc4626..508a37bc 100644 --- a/frontend/components/Comments.tsx +++ b/frontend/components/Comments.tsx @@ -17,7 +17,10 @@ interface CommentsProps { export default function Comments({ proposalId, userAddress }: CommentsProps) { const [comments, setComments] = useState(() => { - if (typeof window === 'undefined') return []; + if (typeof window === 'undefined') { + return []; + } + const stored = localStorage.getItem(`comments-${proposalId}`); return stored ? JSON.parse(stored) : []; }); diff --git a/frontend/components/MilestoneTracker.tsx b/frontend/components/MilestoneTracker.tsx index df501c3f..6c1d643f 100644 --- a/frontend/components/MilestoneTracker.tsx +++ b/frontend/components/MilestoneTracker.tsx @@ -26,53 +26,99 @@ interface MilestoneTrackerProps { } export default function MilestoneTracker({ proposalId, totalFunding }: MilestoneTrackerProps) { - const defaultMilestones: Milestone[] = [ - { - id: 1, - name: 'Project Kickoff', - description: 'Initial setup and planning phase', - percentage: 25, - fundAmount: totalFunding * 0.25, - status: 'completed', - verifications: [], - deliverables: ['Project plan', 'Technical specification'] - }, - { - id: 2, - name: 'Development Phase 1', - description: 'Core functionality implementation', - percentage: 50, - fundAmount: totalFunding * 0.25, - status: 'in-progress', - verifications: [], - deliverables: ['Working prototype', 'Test coverage'] - }, - { - id: 3, - name: 'Development Phase 2', - description: 'Advanced features and integration', - percentage: 75, - fundAmount: totalFunding * 0.25, - status: 'pending', - verifications: [], - deliverables: ['Feature complete', 'Integration tests'] - }, - { - id: 4, - name: 'Launch & Delivery', - description: 'Final testing and deployment', - percentage: 100, - fundAmount: totalFunding * 0.25, - status: 'pending', - verifications: [], - deliverables: ['Production deployment', 'Documentation'] + const [milestones, setMilestones] = useState(() => { + if (typeof window === 'undefined') { + return [ + { + id: 1, + name: 'Project Kickoff', + description: 'Initial setup and planning phase', + percentage: 25, + fundAmount: totalFunding * 0.25, + status: 'completed', + verifications: [], + deliverables: ['Project plan', 'Technical specification'] + }, + { + id: 2, + name: 'Development Phase 1', + description: 'Core functionality implementation', + percentage: 50, + fundAmount: totalFunding * 0.25, + status: 'in-progress', + verifications: [], + deliverables: ['Working prototype', 'Test coverage'] + }, + { + id: 3, + name: 'Development Phase 2', + description: 'Advanced features and integration', + percentage: 75, + fundAmount: totalFunding * 0.25, + status: 'pending', + verifications: [], + deliverables: ['Feature complete', 'Integration tests'] + }, + { + id: 4, + name: 'Launch & Delivery', + description: 'Final testing and deployment', + percentage: 100, + fundAmount: totalFunding * 0.25, + status: 'pending', + verifications: [], + deliverables: ['Production deployment', 'Documentation'] + } + ]; } - ]; - const [milestones, setMilestones] = useState(() => { - if (typeof window === 'undefined') return defaultMilestones; const stored = localStorage.getItem(`proposal-${proposalId}-milestones`); - return stored ? JSON.parse(stored) : defaultMilestones; + if (stored) { + return JSON.parse(stored); + } + + return [ + { + id: 1, + name: 'Project Kickoff', + description: 'Initial setup and planning phase', + percentage: 25, + fundAmount: totalFunding * 0.25, + status: 'completed', + verifications: [], + deliverables: ['Project plan', 'Technical specification'] + }, + { + id: 2, + name: 'Development Phase 1', + description: 'Core functionality implementation', + percentage: 50, + fundAmount: totalFunding * 0.25, + status: 'in-progress', + verifications: [], + deliverables: ['Working prototype', 'Test coverage'] + }, + { + id: 3, + name: 'Development Phase 2', + description: 'Advanced features and integration', + percentage: 75, + fundAmount: totalFunding * 0.25, + status: 'pending', + verifications: [], + deliverables: ['Feature complete', 'Integration tests'] + }, + { + id: 4, + name: 'Launch & Delivery', + description: 'Final testing and deployment', + percentage: 100, + fundAmount: totalFunding * 0.25, + status: 'pending', + verifications: [], + deliverables: ['Production deployment', 'Documentation'] + } + ]; }); const [selectedMilestone, setSelectedMilestone] = useState(null); diff --git a/frontend/components/MultiSigTreasury.tsx b/frontend/components/MultiSigTreasury.tsx index ae35c4ff..912ffc80 100644 --- a/frontend/components/MultiSigTreasury.tsx +++ b/frontend/components/MultiSigTreasury.tsx @@ -34,7 +34,9 @@ interface MultiSigConfig { } export default function MultiSigTreasury() { - const now = Date.parse(new Date().toISOString()); + const [currentTime] = useState(() => Date.now()); + const baseTime = currentTime; + const [config, setConfig] = useState({ totalSigners: 5, requiredSignatures: 3, @@ -43,7 +45,7 @@ export default function MultiSigTreasury() { timelock: 48 }); - const [transactions, setTransactions] = useState([ + const [transactions, setTransactions] = useState(() => [ { id: 1, type: 'withdrawal', @@ -54,16 +56,16 @@ export default function MultiSigTreasury() { requiredSignatures: 3, currentSignatures: 2, signers: [ - { address: 'SP9XYZ...123', name: 'Alice (Treasury Manager)', signed: true, timestamp: now - 2 * 60 * 60 * 1000 }, - { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: now - 1 * 60 * 60 * 1000 }, + { address: 'SP9XYZ...123', name: 'Alice (Treasury Manager)', signed: true, timestamp: baseTime - 2 * 60 * 60 * 1000 }, + { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: baseTime - 1 * 60 * 60 * 1000 }, { address: 'SP7DEF...789', name: 'Carol (Admin)', signed: false }, { address: 'SP6GHI...012', name: 'Dave (Auditor)', signed: false }, { address: 'SP5JKL...345', name: 'Eve (Advisor)', signed: false } ], status: 'pending', - createdAt: now - 3 * 60 * 60 * 1000, + createdAt: baseTime - 3 * 60 * 60 * 1000, threshold: 75000, - deadline: now + 45 * 60 * 60 * 1000 + deadline: baseTime + 45 * 60 * 60 * 1000 }, { id: 2, @@ -75,15 +77,15 @@ export default function MultiSigTreasury() { currentSignatures: 1, signers: [ { address: 'SP9XYZ...123', name: 'Alice (Treasury Manager)', signed: false }, - { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: now - 12 * 60 * 60 * 1000 }, + { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: baseTime - 12 * 60 * 60 * 1000 }, { address: 'SP7DEF...789', name: 'Carol (Admin)', signed: false }, { address: 'SP6GHI...012', name: 'Dave (Auditor)', signed: false }, { address: 'SP5JKL...345', name: 'Eve (Advisor)', signed: false } ], status: 'pending', - createdAt: now - 24 * 60 * 60 * 1000, + createdAt: baseTime - 24 * 60 * 60 * 1000, threshold: 50000, - deadline: now + 24 * 60 * 60 * 1000 + deadline: baseTime + 24 * 60 * 60 * 1000 }, { id: 3, @@ -95,20 +97,21 @@ export default function MultiSigTreasury() { requiredSignatures: 3, currentSignatures: 3, signers: [ - { address: 'SP9XYZ...123', name: 'Alice (Treasury Manager)', signed: true, timestamp: now - 48 * 60 * 60 * 1000 }, - { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: now - 46 * 60 * 60 * 1000 }, - { address: 'SP7DEF...789', name: 'Carol (Admin)', signed: true, timestamp: now - 45 * 60 * 60 * 1000 }, + { address: 'SP9XYZ...123', name: 'Alice (Treasury Manager)', signed: true, timestamp: baseTime - 48 * 60 * 60 * 1000 }, + { address: 'SP8ABC...456', name: 'Bob (Finance Lead)', signed: true, timestamp: baseTime - 46 * 60 * 60 * 1000 }, + { address: 'SP7DEF...789', name: 'Carol (Admin)', signed: true, timestamp: baseTime - 45 * 60 * 60 * 1000 }, { address: 'SP6GHI...012', name: 'Dave (Auditor)', signed: false }, { address: 'SP5JKL...345', name: 'Eve (Advisor)', signed: false } ], status: 'executed', - createdAt: now - 72 * 60 * 60 * 1000, + createdAt: baseTime - 72 * 60 * 60 * 1000, threshold: 50000, - deadline: now - 24 * 60 * 60 * 1000 + deadline: baseTime - 24 * 60 * 60 * 1000 } ]); - const [showConfigModal, setShowConfigModal] = useState(false); + const [, setShowNewTxModal] = useState(false); + const [, setShowConfigModal] = useState(false); const [isPaused, setIsPaused] = useState(false); const [filterStatus, setFilterStatus] = useState<'all' | Transaction['status']>('all'); @@ -180,7 +183,7 @@ export default function MultiSigTreasury() { }; const formatTimeRemaining = (deadline: number) => { - const diff = deadline - now; + const diff = deadline - currentTime; const hours = Math.floor(diff / (1000 * 60 * 60)); const days = Math.floor(hours / 24); @@ -221,6 +224,7 @@ export default function MultiSigTreasury() { )}