Link adopted-by user name to profile page on node detail

Add profile_id to AdoptedByUser API schema and populate it from
the backend so the SPA can link the adopter's name to their
/profile/{id} page. Style the link with text-primary to stand out
from the surrounding opacity-70 text.
This commit is contained in:
Louis King
2026-05-02 19:06:50 +01:00
parent a358363c2f
commit db1a6aa3d5
4 changed files with 11 additions and 2 deletions
+1
View File
@@ -22,6 +22,7 @@ def _get_adopted_by(node: Node) -> Optional[AdoptedByUser]:
user_id=profile.user_id,
name=profile.name,
callsign=profile.callsign,
profile_id=profile.id,
)
return None
+1
View File
@@ -78,6 +78,7 @@ class AdoptedByUser(BaseModel):
user_id: str = Field(..., description="OIDC subject identifier")
name: Optional[str] = Field(default=None, description="User display name")
callsign: Optional[str] = Field(default=None, description="Amateur radio callsign")
profile_id: str = Field(..., description="User profile UUID for profile links")
class Config:
from_attributes = True
@@ -303,7 +303,10 @@ function renderAdoptionSection(node, config) {
return html`<div class="card bg-base-100 shadow-xl h-full">
<div class="card-body">
<h2 class="card-title">${t('nodes.ownership')}</h2>
<p class="text-sm opacity-70">${t('nodes.adopted_by', { name: ownerName })}</p>
<p class="text-sm opacity-70">
${t('nodes.adopted_by_prefix')}
<a href="/profile/${node.adopted_by.profile_id}" class="link link-hover text-primary">${ownerName}</a>
</p>
</div>
</div>`;
}
@@ -323,7 +326,10 @@ function renderAdoptionSection(node, config) {
<div class="card-body">
<h2 class="card-title">${t('nodes.ownership')}</h2>
<div class="flex items-center justify-between">
<p class="text-sm opacity-70">${t('nodes.adopted_by', { name: ownerName })}</p>
<p class="text-sm opacity-70">
${t('nodes.adopted_by_prefix')}
<a href="/profile/${node.adopted_by.profile_id}" class="link link-hover text-primary">${ownerName}</a>
</p>
${releaseBtnHtml}
</div>
</div>
@@ -155,6 +155,7 @@
"adopt": "Adopt",
"release": "Release",
"adopted_by": "Adopted by {{name}}",
"adopted_by_prefix": "Adopted by",
"not_adopted": "This node has not been adopted by any operator.",
"adopt_success": "Node adopted successfully",
"release_success": "Node released successfully",