commit ed05f44afb20805c0e441079104f8c85a8ef141f
Author: root <root@hub.scroll.pub>
Date: 2024-12-27 07:57:10 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..48313c7
--- /dev/null
+++ b/body.html
@@ -0,0 +1,54 @@
+<header>
+ <nav>
+ <h1>RetireRich</h1>
+ <p>Stock Portfolio Retirement Calculator</p>
+ </nav>
+</header>
+
+<main>
+ <section class="calculator">
+ <h2>Calculate Your Future Portfolio Value</h2>
+
+ <form id="portfolioForm">
+ <div class="input-group">
+ <label for="currentAge">Current Age</label>
+ <input type="number" id="currentAge" required min="18" max="100">
+ </div>
+
+ <div class="input-group">
+ <label for="retirementAge">Retirement Age</label>
+ <input type="number" id="retirementAge" required min="18" max="100">
+ </div>
+
+ <div class="input-group">
+ <label for="currentPortfolio">Current Portfolio Value ($)</label>
+ <input type="number" id="currentPortfolio" required min="0">
+ </div>
+
+ <div class="input-group">
+ <label for="monthlyContribution">Monthly Contribution ($)</label>
+ <input type="number" id="monthlyContribution" required min="0">
+ </div>
+
+ <div class="input-group">
+ <label for="expectedReturn">Expected Annual Return (%)</label>
+ <input type="number" id="expectedReturn" required min="0" max="30" step="0.1">
+ </div>
+
+ <button type="submit">Calculate</button>
+ </form>
+
+ <div id="results" class="hidden">
+ <h3>Your Portfolio at Retirement</h3>
+ <div class="result-card">
+ <p>Estimated Value: <span id="futureValue">$0</span></p>
+ <p>Years until retirement: <span id="yearsToRetirement">0</span></p>
+ <p>Total Contributions: <span id="totalContributions">$0</span></p>
+ </div>
+ </div>
+ </section>
+</main>
+
+<footer>
+ <p>Built with care by RetireRich</p>
+</footer>
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..2e56163
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,10 @@
+buildHtml
+baseUrl https://retirerich.scroll.pub
+metaTags
+ description "Calculate your stock portfolio's future value at retirement"
+ keywords "retirement calculator, stock portfolio, investment planning"
+editButton /edit.html
+title RetireRich - Retirement Portfolio Calculator
+style.css
+body.html
+script.js
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..d1f082d
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# retirerich.scroll.pub
+Website generated by Claude from prompt: A website that calculate portfolio value of my stocks at retirement
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..efcc2e8
--- /dev/null
+++ b/script.js
@@ -0,0 +1,51 @@
+document.getElementById('portfolioForm').addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ // Get input values
+ const currentAge = parseInt(document.getElementById('currentAge').value);
+ const retirementAge = parseInt(document.getElementById('retirementAge').value);
+ const currentPortfolio = parseFloat(document.getElementById('currentPortfolio').value);
+ const monthlyContribution = parseFloat(document.getElementById('monthlyContribution').value);
+ const expectedReturn = parseFloat(document.getElementById('expectedReturn').value) / 100;
+
+ // Validate inputs
+ if (retirementAge <= currentAge) {
+ alert('Retirement age must be greater than current age');
+ return;
+ }
+
+ // Calculate years until retirement
+ const yearsToRetirement = retirementAge - currentAge;
+
+ // Calculate future value
+ const monthlyRate = expectedReturn / 12;
+ const numberOfContributions = yearsToRetirement * 12;
+
+ // Future value calculation using compound interest formula
+ const futureValue = currentPortfolio * Math.pow(1 + expectedReturn, yearsToRetirement) +
+ monthlyContribution * (Math.pow(1 + monthlyRate, numberOfContributions) - 1) / monthlyRate;
+
+ // Calculate total contributions
+ const totalContributions = currentPortfolio + (monthlyContribution * numberOfContributions);
+
+ // Display results
+ document.getElementById('results').classList.remove('hidden');
+ document.getElementById('futureValue').textContent = formatCurrency(futureValue);
+ document.getElementById('yearsToRetirement').textContent = yearsToRetirement;
+ document.getElementById('totalContributions').textContent = formatCurrency(totalContributions);
+});
+
+function formatCurrency(value) {
+ return new Intl.NumberFormat('en-US', {
+ style: 'currency',
+ currency: 'USD',
+ maximumFractionDigits: 0
+ }).format(value);
+}
+
+// Input validation
+document.querySelectorAll('input[type="number"]').forEach(input => {
+ input.addEventListener('input', function() {
+ if (this.value < 0) this.value = 0;
+ });
+});
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..73d099f
--- /dev/null
+++ b/style.css
@@ -0,0 +1,124 @@
+:root {
+ --primary-color: #2c3e50;
+ --accent-color: #3498db;
+ --bg-color: #f9fafb;
+ --text-color: #2c3e50;
+ --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+}
+
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+}
+
+body {
+ font-family: 'Segoe UI', system-ui, sans-serif;
+ line-height: 1.6;
+ color: var(--text-color);
+ background: var(--bg-color);
+}
+
+header {
+ background: var(--primary-color);
+ color: white;
+ padding: 2rem;
+ text-align: center;
+}
+
+h1 {
+ font-size: 2.5rem;
+ margin-bottom: 0.5rem;
+}
+
+main {
+ max-width: 800px;
+ margin: 2rem auto;
+ padding: 0 1rem;
+}
+
+.calculator {
+ background: white;
+ padding: 2rem;
+ border-radius: 10px;
+ box-shadow: var(--card-shadow);
+}
+
+h2 {
+ color: var(--primary-color);
+ margin-bottom: 2rem;
+ text-align: center;
+}
+
+.input-group {
+ margin-bottom: 1.5rem;
+}
+
+label {
+ display: block;
+ margin-bottom: 0.5rem;
+ font-weight: 500;
+}
+
+input {
+ width: 100%;
+ padding: 0.75rem;
+ border: 2px solid #e2e8f0;
+ border-radius: 5px;
+ font-size: 1rem;
+ transition: border-color 0.3s ease;
+}
+
+input:focus {
+ outline: none;
+ border-color: var(--accent-color);
+}
+
+button {
+ width: 100%;
+ padding: 1rem;
+ background: var(--accent-color);
+ color: white;
+ border: none;
+ border-radius: 5px;
+ font-size: 1.1rem;
+ cursor: pointer;
+ transition: background-color 0.3s ease;
+}
+
+button:hover {
+ background: #2980b9;
+}
+
+.result-card {
+ background: #f8fafc;
+ padding: 1.5rem;
+ border-radius: 5px;
+ margin-top: 1rem;
+}
+
+.hidden {
+ display: none;
+}
+
+footer {
+ text-align: center;
+ padding: 2rem;
+ background: var(--primary-color);
+ color: white;
+ margin-top: 3rem;
+}
+
+@media (max-width: 600px) {
+ header {
+ padding: 1rem;
+ }
+
+ h1 {
+ font-size: 2rem;
+ }
+
+ .calculator {
+ padding: 1rem;
+ }
+}