From 2b11d4b71cda4c0c35ac89c4bc0e653cb7c2cc0b Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Wed, 29 Jan 2025 20:28:12 -0500 Subject: [PATCH] Update profile view / thumbnail --- .../components/CirclePoster/CirclePoster.xml | 1 + .../src/components/NavBar/ProfileIcon.bs | 25 ++++++++++++---- .../src/components/NavBar/ProfileIcon.xml | 4 +-- .../ProfileRowList/ProfileRowListCell.bs | 6 +++- .../ProfileRowList/ProfileRowListCell.xml | 4 +-- .../ProfileScreen/ProfileView/ProfileView.bs | 29 +++++++++++++++---- .../ProfileScreen/ProfileView/ProfileView.xml | 4 +-- 7 files changed, 55 insertions(+), 18 deletions(-) diff --git a/playlet-lib/src/components/CirclePoster/CirclePoster.xml b/playlet-lib/src/components/CirclePoster/CirclePoster.xml index e6454b5d..056e4438 100644 --- a/playlet-lib/src/components/CirclePoster/CirclePoster.xml +++ b/playlet-lib/src/components/CirclePoster/CirclePoster.xml @@ -9,6 +9,7 @@ + diff --git a/playlet-lib/src/components/NavBar/ProfileIcon.bs b/playlet-lib/src/components/NavBar/ProfileIcon.bs index 11e6e688..6b250c8a 100644 --- a/playlet-lib/src/components/NavBar/ProfileIcon.bs +++ b/playlet-lib/src/components/NavBar/ProfileIcon.bs @@ -23,13 +23,28 @@ function OnCurrentProfile() as void return end if - username = currentProfile.username - if not StringUtils.IsNullOrEmpty(username) - m.letterLabel.text = UCase(username.Left(1)) - else + thumbnail = currentProfile.thumbnail + if not StringUtils.IsNullOrEmpty(thumbnail) + m.circlePosterInner.uri = thumbnail + ' bs:disable-next-line LINT3023 + m.circlePosterInner.blendColor = "#FFFFFFFF" m.letterLabel.text = "" + else + m.circlePosterInner.uri = "pkg:/images/white-circle.png" + m.circlePosterInner.blendColor = currentProfile.color + + username = currentProfile.username + + if not StringUtils.IsNullOrEmpty(username) + letter = username.Left(1) + if letter = "@" and Len(username) > 1 + letter = username.Mid(1, 1) + end if + m.letterLabel.text = UCase(letter) + else + m.letterLabel.text = "" + end if end if - m.circlePosterInner.blendColor = currentProfile.color m.circlePoster.visible = true m.buttonIcon.visible = false diff --git a/playlet-lib/src/components/NavBar/ProfileIcon.xml b/playlet-lib/src/components/NavBar/ProfileIcon.xml index 168647d5..d95f3bf2 100644 --- a/playlet-lib/src/components/NavBar/ProfileIcon.xml +++ b/playlet-lib/src/components/NavBar/ProfileIcon.xml @@ -12,7 +12,7 @@ height="40" blendColor="#DDDDDDFF" uri="pkg:/images/white-circle.png"> - - + \ No newline at end of file diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.bs b/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.bs index 386fbc4e..19fafba8 100644 --- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.bs +++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.bs @@ -38,7 +38,11 @@ function OnContentSet() as void m.top.circlePosterInnerBlendColor = content.color if not StringUtils.IsNullOrEmpty(username) - m.top.letter = UCase(username.Left(1)) + letter = username.Left(1) + if letter = "@" and Len(username) > 1 + letter = username.Mid(1, 1) + end if + m.top.letter = UCase(letter) else m.top.letter = "" end if diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.xml b/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.xml index a94476cf..ce519d69 100644 --- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.xml +++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileRowList/ProfileRowListCell.xml @@ -46,7 +46,7 @@ translation="[20,20]" blendColor="#DDDDDDFF" uri="pkg:/images/white-circle.png"> - - + 1 + letter = username.Mid(1, 1) + end if + m.top.letter = UCase(letter) + else + m.top.letter = "" + end if end if - m.top.serverUrl = content.serverUrl + m.top.crownVisible = content.isSelected backendType = content.type if backendType = "invidious" + m.top.serverUrl = content.serverUrl m.top.backendTypePosterUri = "pkg:/images/invidious-logo.png" else if backendType = "youtube" + m.top.serverUrl = "YouTube" m.top.backendTypePosterUri = "pkg:/images/youtube-logo.png" else + m.top.serverUrl = "" m.top.backendTypePosterUri = "" end if diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml index be4b9ea2..e6585f85 100644 --- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml +++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml @@ -33,7 +33,7 @@ translation="[20,20]" blendColor="#DDDDDDFF" uri="pkg:/images/white-circle.png"> - - +