feat(libra/record): always show Add Income — drop stub-era env-var gate

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-17 19:05:54 +02:00
commit c5d943a991

View file

@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useTimeAgo } from '@vueuse/core' import { useTimeAgo } from '@vueuse/core'
import { DollarSign, TrendingUp, Info, FileText, Trash2, Image as ImageIcon } from 'lucide-vue-next' import { DollarSign, TrendingUp, FileText, Trash2, Image as ImageIcon } from 'lucide-vue-next'
import { Badge } from '@/components/ui/badge' import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator' import { Separator } from '@/components/ui/separator'
@ -16,8 +16,6 @@ const { drafts, hasDrafts, deleteDraft } = useExpenseDrafts()
const showAddExpense = ref(false) const showAddExpense = ref(false)
const showAddIncome = ref(false) const showAddIncome = ref(false)
const incomeEnabled = computed(() => import.meta.env.VITE_LIBRA_INCOME_ENABLED === 'true')
function handleExpenseSubmitted() { function handleExpenseSubmitted() {
// Could refresh balance or show notification // Could refresh balance or show notification
} }
@ -67,34 +65,19 @@ function draftTimeAgo(isoDate: string) {
<!-- Add Income Card --> <!-- Add Income Card -->
<button <button
class="flex items-start gap-4 p-5 rounded-xl border bg-card text-left transition-colors" class="flex items-start gap-4 p-5 rounded-xl border bg-card text-left transition-colors hover:bg-accent/50 active:bg-accent/70"
:class="incomeEnabled @click="showAddIncome = true"
? 'hover:bg-accent/50 active:bg-accent/70'
: 'opacity-60 cursor-not-allowed'"
:disabled="!incomeEnabled"
@click="incomeEnabled && (showAddIncome = true)"
> >
<div class="flex items-center justify-center w-12 h-12 rounded-full bg-green-100 dark:bg-green-900/20 shrink-0"> <div class="flex items-center justify-center w-12 h-12 rounded-full bg-green-100 dark:bg-green-900/20 shrink-0">
<TrendingUp class="w-6 h-6 text-green-600 dark:text-green-400" /> <TrendingUp class="w-6 h-6 text-green-600 dark:text-green-400" />
</div> </div>
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<div class="flex items-center gap-2">
<h2 class="text-lg font-semibold text-foreground">{{ t('libra.record.addIncome') }}</h2> <h2 class="text-lg font-semibold text-foreground">{{ t('libra.record.addIncome') }}</h2>
<Badge v-if="!incomeEnabled" variant="secondary" class="text-xs">
{{ t('libra.record.comingSoon') }}
</Badge>
</div>
<p class="text-sm text-muted-foreground mt-0.5">{{ t('libra.record.addIncomeDescription') }}</p> <p class="text-sm text-muted-foreground mt-0.5">{{ t('libra.record.addIncomeDescription') }}</p>
</div> </div>
</button> </button>
</div> </div>
<!-- Info hint when income is disabled -->
<div v-if="!incomeEnabled" class="mt-4 flex items-start gap-2 p-3 rounded-lg bg-muted/50">
<Info class="w-4 h-4 text-muted-foreground mt-0.5 shrink-0" />
<p class="text-xs text-muted-foreground">{{ t('libra.income.notAvailable') }}</p>
</div>
<!-- Drafts Section --> <!-- Drafts Section -->
<template v-if="hasDrafts"> <template v-if="hasDrafts">
<Separator class="my-6" /> <Separator class="my-6" />