Skip to content

Commit

Permalink
Update profile view / thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Jan 30, 2025
1 parent 29a3206 commit 2b11d4b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 18 deletions.
1 change: 1 addition & 0 deletions playlet-lib/src/components/CirclePoster/CirclePoster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<field id="loadingBitmapUri" type="uri" alias="Poster.loadingBitmapUri" />
<field id="failedBitmapUri" type="uri" alias="Poster.failedBitmapUri" />
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
<field id="blendColor" type="color" alias="Poster.blendColor" />

<field id="maskUri" type="uri" value="pkg:/images/white-circle.png" alias="MaskGroup.maskuri" />
<field id="maskSize" type="vector2d" alias="MaskGroup.maskSize" />
Expand Down
25 changes: 20 additions & 5 deletions playlet-lib/src/components/NavBar/ProfileIcon.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions playlet-lib/src/components/NavBar/ProfileIcon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
height="40"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="36"
height="36"
Expand All @@ -27,7 +27,7 @@
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
</Poster>
</CirclePoster>
</Poster>
</children>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="152"
height="152"
Expand All @@ -67,7 +67,7 @@
height="60"
translation="[110,110]"
/>
</Poster>
</CirclePoster>
<Poster
id="CrownPoster"
width="60"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,41 @@ function OnContentSet() as void
return
end if

m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else

thumbnail = content.thumbnail
if not StringUtils.IsNullOrEmpty(thumbnail)
m.top.circlePosterInnerUri = thumbnail
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
else
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color

if not StringUtils.IsNullOrEmpty(username)
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
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="152"
height="152"
Expand All @@ -54,7 +54,7 @@
height="60"
translation="[110,110]"
/>
</Poster>
</CirclePoster>
<Poster
id="CrownPoster"
width="60"
Expand Down

0 comments on commit 2b11d4b

Please sign in to comment.