|
35 | 35 | <MudGrid>
|
36 | 36 | @foreach (var student in students)
|
37 | 37 | {
|
38 |
| - <MudItem xs="12"> |
39 |
| - <MudPaper Class="p-3 mb-2" Elevation="2" Style="border-radius: 10px; cursor: pointer;" @onclick="() => ViewDetails(student.Id)"> |
40 |
| - <MudGrid> |
41 |
| - <MudItem xs="1" md="1" Class="d-flex justify-content-center align-items-center"> |
42 |
| - <MudAvatar Image="@GetProfileImageUrl(student.ProfileImageUrl)" Alt="Student Image" Size="Size.Large" Class="border border-primary" /> |
43 |
| - </MudItem> |
44 |
| - <MudItem xs="8" md="8"> |
45 |
| - <MudText Typo="Typo.h6" Class="mb-0" Style="font-weight: bold;">@($"{student.FirstName} {student.LastName}")</MudText> |
46 |
| - @if (student.LastWorkExperience != null) |
| 38 | + if (visibilityChecker.ShouldShowProfile(student)) |
| 39 | + { |
| 40 | + <MudItem xs="12"> |
| 41 | + <MudPaper Class="p-3 mb-2" Elevation="2" Style="border-radius: 10px; cursor: pointer;" @onclick="() => ViewDetails(student.Id)"> |
| 42 | + <MudGrid> |
| 43 | + <MudItem xs="1" md="1" Class="d-flex justify-content-center align-items-center"> |
| 44 | + <MudAvatar Image="@GetProfileImageUrl(student.ProfileImageUrl)" Alt="Student Image" Size="Size.Large" Class="border border-primary" /> |
| 45 | + </MudItem> |
| 46 | + <MudItem xs="8" md="8"> |
| 47 | + @if (visibilityChecker.ShouldShowName(student)) |
| 48 | + { |
| 49 | + <MudText Typo="Typo.h6" Class="mb-0" Style="font-weight: bold;">@($"{student.FirstName} {student.LastName}")</MudText> |
| 50 | + } |
| 51 | + |
| 52 | + @if (visibilityChecker.ShouldShowWorkPosition(student) && student.LastWorkExperience != null) |
47 | 53 | {
|
48 | 54 | <MudText Typo="Typo.subtitle2">
|
49 | 55 | @($"{student.LastWorkExperience.Position} in {student.LastWorkExperience.Company}")
|
|
53 | 59 | {
|
54 | 60 | <MudText Typo="Typo.subtitle2"> </MudText>
|
55 | 61 | }
|
56 |
| - </MudItem> |
57 |
| - <MudItem xs="2" md="2"> |
58 |
| - <MudButtonGroup> |
59 |
| - @if (student.Id != currentUserId && !(sentRequests?.Any(r => r.InviteeId == student.Id) ?? false) && !(allFriends?.Any(f => f.FriendId == student.Id) ?? false)) |
60 |
| - { |
61 |
| - <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(e => ConnectWithStudent(student.Id, e))"> |
62 |
| - <MudIcon Icon="@Icons.Material.Filled.PersonAdd" /> |
63 |
| - <span class="ml-2">Connect</span> |
64 |
| - </MudButton> |
65 |
| - } |
66 |
| - else if (allFriends?.Any(f => f.FriendId == student.Id) == true) |
67 |
| - { |
68 |
| - <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Success"> |
69 |
| - <MudIcon Icon="@Icons.Material.Filled.Check" /> |
70 |
| - <span class="ml-2">Connected</span> |
71 |
| - </MudButton> |
72 |
| - } |
73 |
| - else if (sentRequests?.Any(r => r.InviteeId == student.Id) == true) |
74 |
| - { |
75 |
| - <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Warning"> |
76 |
| - <MudIcon Icon="@Icons.Material.Filled.HourglassEmpty" /> |
77 |
| - <span class="ml-2">Pending</span> |
78 |
| - </MudButton> |
79 |
| - } |
80 |
| - else if (incomingRequests?.Any(r => r.InviterId == student.Id) == true) |
81 |
| - { |
82 |
| - <MudButton Variant="Variant.Outlined" Color="Color.Info"> |
83 |
| - <MudIcon Icon="@Icons.Material.Filled.QuestionAnswer" /> |
84 |
| - <span class="ml-2">Respond</span> |
85 |
| - </MudButton> |
86 |
| - } |
87 |
| - else if (student.Id == currentUserId) |
88 |
| - { |
89 |
| - <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Secondary"> |
90 |
| - <MudIcon Icon="@Icons.Material.Filled.Person" /> |
91 |
| - <span class="ml-2">It's You</span> |
92 |
| - </MudButton> |
93 |
| - } |
94 |
| - </MudButtonGroup> |
95 |
| - </MudItem> |
96 |
| - </MudGrid> |
97 |
| - </MudPaper> |
98 |
| - </MudItem> |
| 62 | + </MudItem> |
| 63 | + |
| 64 | + <MudItem xs="2" md="2"> |
| 65 | + <MudButtonGroup> |
| 66 | + @if (student.Id != currentUserId && !(sentRequests?.Any(r => r.InviteeId == student.Id) ?? false) && !(allFriends?.Any(f => f.FriendId == student.Id) ?? false)) |
| 67 | + { |
| 68 | + <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@(e => ConnectWithStudent(student.Id, e))"> |
| 69 | + <MudIcon Icon="@Icons.Material.Filled.PersonAdd" /> |
| 70 | + <span class="ml-2">Connect</span> |
| 71 | + </MudButton> |
| 72 | + } |
| 73 | + else if (allFriends?.Any(f => f.FriendId == student.Id) == true) |
| 74 | + { |
| 75 | + <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Success"> |
| 76 | + <MudIcon Icon="@Icons.Material.Filled.Check" /> |
| 77 | + <span class="ml-2">Connected</span> |
| 78 | + </MudButton> |
| 79 | + } |
| 80 | + else if (sentRequests?.Any(r => r.InviteeId == student.Id) == true) |
| 81 | + { |
| 82 | + <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Warning"> |
| 83 | + <MudIcon Icon="@Icons.Material.Filled.HourglassEmpty" /> |
| 84 | + <span class="ml-2">Pending</span> |
| 85 | + </MudButton> |
| 86 | + } |
| 87 | + else if (incomingRequests?.Any(r => r.InviterId == student.Id) == true) |
| 88 | + { |
| 89 | + <MudButton Variant="Variant.Outlined" Color="Color.Info"> |
| 90 | + <MudIcon Icon="@Icons.Material.Filled.QuestionAnswer" /> |
| 91 | + <span class="ml-2">Respond</span> |
| 92 | + </MudButton> |
| 93 | + } |
| 94 | + else if (student.Id == currentUserId) |
| 95 | + { |
| 96 | + <MudButton Disabled="true" Variant="Variant.Text" Color="Color.Secondary"> |
| 97 | + <MudIcon Icon="@Icons.Material.Filled.Person" /> |
| 98 | + <span class="ml-2">It's You</span> |
| 99 | + </MudButton> |
| 100 | + } |
| 101 | + </MudButtonGroup> |
| 102 | + </MudItem> |
| 103 | + </MudGrid> |
| 104 | + </MudPaper> |
| 105 | + </MudItem> |
| 106 | + } |
99 | 107 | }
|
100 | 108 | </MudGrid>
|
101 | 109 | }
|
|
225 | 233 | private int pageSize = 10;
|
226 | 234 | private int totalStudents;
|
227 | 235 | private Guid currentUserId;
|
| 236 | + private VisibilityChecker visibilityChecker; |
228 | 237 |
|
229 | 238 | private List<BreadcrumbItem> _items = new List<BreadcrumbItem>
|
230 | 239 | {
|
|
244 | 253 | currentUserId = await IdentityService.GetCurrentUserIdFromJwtAsync();
|
245 | 254 | await LoadFriendRequests();
|
246 | 255 | await LoadStudents();
|
| 256 | + |
| 257 | + visibilityChecker = new VisibilityChecker(currentUserId, allFriends); |
247 | 258 | }
|
248 | 259 | catch (Exception ex)
|
249 | 260 | {
|
|
0 commit comments