a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[frontend/pages] Add button to skip pinned notes

authored by

pancakes and committed by
Iceshrimp development
83d5fceb 8c60a431

+42 -4
+27 -3
Iceshrimp.Frontend/Pages/ProfileView.razor
··· 161 161 </div> 162 162 @if (UserPinned.Count > 0) 163 163 { 164 - <LabeledRuler Label="@Loc["Pinned notes"]"/> 164 + <div class="pins-label"> 165 + <LabeledRuler Label="@Loc["Pinned notes"]" LeftRule="false"/> 166 + @if (UserPinned.Count > 4) 167 + { 168 + <button class="button" @onclick="SkipPinnedNotes">@Loc["Skip"]</button> 169 + } 170 + </div> 165 171 <div class="notes"> 166 172 @foreach (var note in UserPinned) 167 173 { ··· 170 176 </div> 171 177 } 172 178 </div> 173 - <span class="pinned-end"> 179 + <span @ref="EndPinnedRef" class="pinned-end"> 174 180 <ScrollEnd IntersectionChange="AddPinnedNotes" ManualLoad="AddPinnedNotes" Class="end"/> 175 181 </span> 176 - <LabeledRuler Label="@Loc["Latest notes"]"/> 182 + <div class="pins-label"> 183 + <LabeledRuler Label="@Loc["Latest notes"]" LeftRule="false"/> 184 + </div> 177 185 } 178 186 @if (UserNotes.Count > 0) 179 187 { ··· 211 219 @code { 212 220 [Parameter] public string? User { get; set; } 213 221 [Parameter] public string? Host { get; set; } 222 + private IJSObjectReference Module { get; set; } = null!; 223 + private ElementReference EndPinnedRef { get; set; } 214 224 private UserResponse UserResponse { get; set; } = null!; 215 225 private UserProfileResponse? Profile { get; set; } 216 226 private string? PinnedMinId { get; set; } ··· 271 281 await GetNotes(MinId); 272 282 _fetchLock = false; 273 283 } 284 + } 285 + 286 + private async Task SkipPinnedNotes() 287 + { 288 + await Module.InvokeVoidAsync("ScrollIntoView", EndPinnedRef); 274 289 } 275 290 276 291 private async Task LoadProfile() ··· 510 525 catch (ApiException e) 511 526 { 512 527 await GlobalComponentSvc.NoticeDialog?.Display(e.Response.Message ?? Loc["An unknown error occurred"], NoticeDialog.NoticeType.Error)!; 528 + } 529 + } 530 + 531 + protected override async Task OnAfterRenderAsync(bool firstRender) 532 + { 533 + if (firstRender) 534 + { 535 + Module = await Js.InvokeAsync<IJSObjectReference>("import", 536 + "./Pages/ProfileView.razor.js"); 513 537 } 514 538 } 515 539 }
+12 -1
Iceshrimp.Frontend/Pages/ProfileView.razor.css
··· 105 105 overflow: clip; 106 106 } 107 107 108 - ::deep .labeled-ruler { 108 + .pins-label { 109 + display: flex; 110 + flex-direction: row; 111 + gap: 0.5rem; 109 112 margin-top: 1rem; 110 113 margin-left: auto; 111 114 margin-right: auto; 112 115 max-width: 45rem; 116 + } 117 + 118 + .pins-label button { 119 + margin: 0; 120 + } 121 + 122 + ::deep .pins-label .labeled-ruler { 123 + width: 100%; 113 124 } 114 125 115 126 ::deep .end {
+3
Iceshrimp.Frontend/Pages/ProfileView.razor.js
··· 1 + export function ScrollIntoView(ref) { 2 + ref.scrollIntoView({ behavior: "smooth", block: "start"}) 3 + }