feat: add UsageBadge to action buttons (Phase 3)
- Weight page: badge on "Eintrag hinzufügen" heading - Settings: badges on export buttons (ZIP/JSON) - Analysis: badges on pipeline and individual analysis titles - Shows real-time usage status (e.g., "7/5" with red color) Phase 3: Frontend Display complete Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
405abc1973
commit
c59c71a1c7
3 files changed
+47
-6
No files matched your search
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from 'react'
|
||||
import { Pencil, Trash2, Check, X } from 'lucide-react'
|
||||
import { api } from '../utils/api'
|
||||
import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid, ReferenceLine } from 'recharts'
|
||||
import UsageBadge from '../components/UsageBadge'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/de'
|
||||
dayjs.locale('de')
|
||||
@@ -21,9 +22,18 @@ export default function WeightScreen() {
|
||||
const [newNote, setNewNote] = useState('')
|
||||
const [saving, setSaving] = useState(false)
|
||||
const [saved, setSaved] = useState(false)
|
||||
const [weightUsage, setWeightUsage] = useState(null) // Phase 3: Usage badge
|
||||
|
||||
const load = () => api.listWeight(365).then(data => setEntries(data))
|
||||
useEffect(()=>{ load() },[])
|
||||
|
||||
useEffect(()=>{
|
||||
load()
|
||||
// Load feature usage for badge
|
||||
api.getFeatureUsage().then(features => {
|
||||
const weightFeature = features.find(f => f.feature_id === 'weight_entries')
|
||||
setWeightUsage(weightFeature)
|
||||
}).catch(err => console.error('Failed to load usage:', err))
|
||||
},[])
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!newWeight) return
|
||||
@@ -59,7 +69,10 @@ export default function WeightScreen() {
|
||||
|
||||
{/* Eingabe */}
|
||||
<div className="card section-gap">
|
||||
<div className="card-title">Eintrag hinzufügen</div>
|
||||
<div className="card-title">
|
||||
Eintrag hinzufügen
|
||||
{weightUsage && <UsageBadge {...weightUsage} />}
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Datum</label>
|
||||
<input type="date" className="form-input" style={{width:140}}
|
||||
|
||||
Reference in new issue
Block a user