feat: integrate jump-hop shelf and asset flow

This commit is contained in:
kdletters
2026-05-24 19:00:21 +08:00
parent 2ba4691bc0
commit 42037860d5
25 changed files with 1018 additions and 149 deletions

View File

@@ -46,7 +46,7 @@ pub fn jump_hop_gallery_card_view(ctx: &AnonymousViewContext) -> Vec<JumpHopGall
jump_hop_gallery_view(ctx)
.into_iter()
.map(|row| JumpHopGalleryCardViewRow {
public_work_code: row.work_id.clone(),
public_work_code: build_jump_hop_public_work_code(&row.profile_id),
work_id: row.work_id,
profile_id: row.profile_id,
owner_user_id: row.owner_user_id,
@@ -658,6 +658,25 @@ fn build_gallery_view_row(row: &JumpHopWorkProfileRow) -> Result<JumpHopGalleryV
})
}
fn build_jump_hop_public_work_code(profile_id: &str) -> String {
let normalized = profile_id
.chars()
.filter(|character| character.is_ascii_alphanumeric())
.flat_map(|character| character.to_uppercase())
.collect::<String>();
let fallback = if normalized.is_empty() {
"00000000".to_string()
} else {
normalized
};
let suffix = if fallback.len() > 8 {
fallback[fallback.len() - 8..].to_string()
} else {
format!("{fallback:0>8}")
};
format!("JH-{suffix}")
}
fn build_session_snapshot(
row: &JumpHopAgentSessionRow,
) -> Result<JumpHopAgentSessionSnapshot, String> {