Changes to retirerich.scroll.pub

root
root
26 days ago
Initial commit
body.html
Changed around line 1
+
+
+

RetireRich

+

Stock Portfolio Retirement Calculator

+
+
+
+
+
+

Calculate Your Future Portfolio Value

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Your Portfolio at Retirement

+
+

Estimated Value: $0

+

Years until retirement: 0

+

Total Contributions: $0

+
+
+
+
+
+
+

Built with care by RetireRich

+
index.scroll
Changed around line 1
+ 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
readme.scroll
Changed around line 1
+ # retirerich.scroll.pub
+ Website generated by Claude from prompt: A website that calculate portfolio value of my stocks at retirement
script.js
Changed around line 1
+ 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;
+ });
+ });
style.css
Changed around line 1
+ :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;
+ }
+ }