feat: add initial application structure with configuration, UI components, and state management
This commit is contained in:
parent
fadf94002c
commit
0af6b17792
56 changed files with 6137 additions and 129 deletions
27
composables/useRunway.ts
Normal file
27
composables/useRunway.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Computes months of runway from cash, reserves, and burn rate
|
||||
* Formula: (cash + savings) ÷ average monthly burn in scenario
|
||||
*/
|
||||
export const useRunway = () => {
|
||||
const calculateRunway = (cash: number, savings: number, monthlyBurn: number): number => {
|
||||
if (monthlyBurn <= 0) return Infinity
|
||||
return (cash + savings) / monthlyBurn
|
||||
}
|
||||
|
||||
const getRunwayStatus = (months: number): 'green' | 'yellow' | 'red' => {
|
||||
if (months >= 3) return 'green'
|
||||
if (months >= 2) return 'yellow'
|
||||
return 'red'
|
||||
}
|
||||
|
||||
const formatRunway = (months: number): string => {
|
||||
if (months === Infinity) return '∞ months'
|
||||
return `${months.toFixed(1)} months`
|
||||
}
|
||||
|
||||
return {
|
||||
calculateRunway,
|
||||
getRunwayStatus,
|
||||
formatRunway
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue