feat: goals — "watch N movies in YEAR" with progress bar
Domain: Goal entity, UserSettings (federation toggle), RemoteGoalEntry.
Ports: GoalRepository, UserSettingsRepository, RemoteGoalRepository.
Adapters: sqlite + postgres repos, migrations, AP content query extensions.
Application: CRUD use cases (create/update/delete/get/list), settings use cases.
API: 7 endpoints (/goals CRUD, /users/{id}/goals, /settings) with utoipa docs.
Federation: GoalObject (Note + goal discriminator), outbound broadcast with
per-user toggle, inbound GoalObjectHandler in CompositeObjectHandler.
SPA: API client + hooks, GoalCard (shadcn Card+Progress+DropdownMenu),
GoalSheet (Drawer), profile integration (editable own, read-only others),
federation toggle in settings (Switch).
Classic HTML: glassmorphic goal card on profile, Frutiger Aero styling.
Progress computed from existing reviews — backwards compatible.
This commit is contained in:
@@ -209,6 +209,15 @@ pub struct ProfileTemplate<'a> {
|
||||
pub pending_followers: Vec<RemoteActorData>,
|
||||
pub sort_by: String,
|
||||
pub search: String,
|
||||
pub goals: Vec<GoalViewData>,
|
||||
}
|
||||
|
||||
pub struct GoalViewData {
|
||||
pub year: u16,
|
||||
pub target_count: u32,
|
||||
pub current_count: u32,
|
||||
pub percentage: f64,
|
||||
pub is_complete: bool,
|
||||
}
|
||||
|
||||
impl<'a> ProfileTemplate<'a> {
|
||||
|
||||
@@ -24,6 +24,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if !goals.is_empty() %}
|
||||
<div class="goals-section">
|
||||
{% for g in goals %}
|
||||
<div class="goal-card">
|
||||
<div class="goal-header">
|
||||
<span class="goal-label">{{ g.year }} Goal</span>
|
||||
<span class="goal-count">{{ g.current_count }} / {{ g.target_count }} movies</span>
|
||||
</div>
|
||||
<div class="progress-track">
|
||||
<div class="progress-fill" style="width: {{ g.percentage }}%"></div>
|
||||
</div>
|
||||
{% if g.is_complete %}
|
||||
<span class="goal-complete">✦ Goal reached!</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if is_own_profile %}
|
||||
<section class="follow-section">
|
||||
<h3>Follow remote user</h3>
|
||||
|
||||
Reference in New Issue
Block a user