Merge pull request #1 from Arrelin/feature/sidebar
fix error after changing back to /api + feature/limits
This commit is contained in:
@@ -199,6 +199,14 @@ export default function FamilyView() {
|
||||
return Math.max(0, Math.min(100, (remaining / limit) * 100));
|
||||
};
|
||||
|
||||
const getTotalLimit = () => {
|
||||
return categories.reduce((sum, cat) => sum + parseFloat(cat.limit_amount.toString()), 0);
|
||||
};
|
||||
|
||||
const getTotalRemaining = () => {
|
||||
return Array.from(remainingLimits.values()).reduce((sum, val) => sum + val, 0);
|
||||
};
|
||||
|
||||
const formatDate = (dateString: string) => {
|
||||
let dateStr = dateString;
|
||||
if (!dateStr.endsWith('Z') && !dateStr.includes('+')) {
|
||||
@@ -229,12 +237,25 @@ export default function FamilyView() {
|
||||
<div className="inline-flex p-4 bg-white/20 backdrop-blur-md rounded-2xl mb-4">
|
||||
<Wallet className="w-12 h-12 text-white" />
|
||||
</div>
|
||||
<h1 className="text-4xl sm:text-5xl font-bold text-white mb-2">
|
||||
<h1 className="text-4xl sm:text-5xl font-bold text-white mb-6">
|
||||
{selectedFamily?.name || 'Семья'}
|
||||
</h1>
|
||||
<p className="text-purple-100 text-base sm:text-lg">
|
||||
Управление категориями и расходами
|
||||
</p>
|
||||
<div className="max-w-2xl mx-auto glass-effect rounded-2xl shadow-lg p-5">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="text-center">
|
||||
<p className="text-gray-600 font-medium text-sm mb-2">Общий лимит</p>
|
||||
<p className="text-2xl sm:text-3xl font-bold text-gray-900">
|
||||
{getTotalLimit().toFixed(2)} ₽
|
||||
</p>
|
||||
</div>
|
||||
<div className="text-center border-l-2 border-gray-300">
|
||||
<p className="text-gray-600 font-medium text-sm mb-2">Общий остаток</p>
|
||||
<p className="text-2xl sm:text-3xl font-bold text-gray-900">
|
||||
{getTotalRemaining().toFixed(2)} ₽
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,15 +6,7 @@ export default defineConfig({
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
'/families': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/login': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/logout': {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080',
|
||||
changeOrigin: true,
|
||||
}
|
||||
|
||||
49
setup-ssl.ps1
Normal file
49
setup-ssl.ps1
Normal file
@@ -0,0 +1,49 @@
|
||||
# Setup SSL Certificate for Family Budget
|
||||
# Run this script in PowerShell as Administrator
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$DOMAIN = "family-budget.duckdns.org"
|
||||
$EMAIL = "your@email.com" # CHANGE THIS!
|
||||
|
||||
Write-Host "=== Setting up SSL for $DOMAIN ===" -ForegroundColor Green
|
||||
|
||||
# Change to project directory
|
||||
Set-Location C:\deploy\family_budget
|
||||
|
||||
Write-Host "`n1. Stopping certbot..." -ForegroundColor Yellow
|
||||
docker compose -f docker-compose.prod.yml stop certbot
|
||||
|
||||
Write-Host "`n2. Creating self-signed certificate..." -ForegroundColor Yellow
|
||||
docker compose -f docker-compose.prod.yml run --rm --entrypoint sh certbot -c @"
|
||||
mkdir -p /etc/letsencrypt/live/$DOMAIN && \
|
||||
openssl req -x509 -nodes -newkey rsa:2048 -days 365 \
|
||||
-keyout /etc/letsencrypt/live/$DOMAIN/privkey.pem \
|
||||
-out /etc/letsencrypt/live/$DOMAIN/fullchain.pem \
|
||||
-subj '/CN=$DOMAIN'
|
||||
"@
|
||||
|
||||
Write-Host "`n3. Updating nginx configuration..." -ForegroundColor Yellow
|
||||
$sslConfig = Get-Content nginx\conf.d\app-ssl.conf.template -Raw
|
||||
$sslConfig = $sslConfig -replace '\$\{DOMAIN\}', $DOMAIN
|
||||
$sslConfig | Out-File -FilePath nginx\conf.d\app-ssl.conf -Encoding UTF8
|
||||
|
||||
# Remove HTTP config
|
||||
Remove-Item nginx\conf.d\app.conf -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host "`n4. Restarting nginx..." -ForegroundColor Yellow
|
||||
docker compose -f docker-compose.prod.yml restart nginx
|
||||
|
||||
Write-Host "`n5. Checking nginx status..." -ForegroundColor Yellow
|
||||
docker compose -f docker-compose.prod.yml ps nginx
|
||||
|
||||
Write-Host "`n=== HTTPS Setup Complete! ===" -ForegroundColor Green
|
||||
Write-Host "`nYour site is now available at: https://$DOMAIN" -ForegroundColor Cyan
|
||||
Write-Host "`nNote: This is a self-signed certificate. Browser will show a warning." -ForegroundColor Yellow
|
||||
Write-Host "You can click 'Advanced' -> 'Proceed to site' to access." -ForegroundColor Yellow
|
||||
|
||||
Write-Host "`n=== To get a real Let's Encrypt certificate later: ===" -ForegroundColor Magenta
|
||||
Write-Host "Run in Git Bash:" -ForegroundColor White
|
||||
Write-Host " export DOMAIN=$DOMAIN" -ForegroundColor Gray
|
||||
Write-Host " export EMAIL=$EMAIL" -ForegroundColor Gray
|
||||
Write-Host " bash init-letsencrypt.sh" -ForegroundColor Gray
|
||||
Reference in New Issue
Block a user