Skip to content

Commit

Permalink
Added custom styles.
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcanosantana committed Nov 26, 2023
1 parent 320b0e9 commit 7163a5d
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Model/AffiliateStyle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace CirsaHackaton.Model
namespace CirsaHackaton
{
public class AffiliateStyle
{
Expand All @@ -23,5 +23,9 @@ public AffiliateStyle(String affiliateUid, String title, String summary, string
//Getters
public String GetId() { return id; }
public String GetAffiliateUid() { return affiliateUid; }
public String GetTitle() { return title; }
public String GetSummary() { return summary; }
public String GetBackgroundUrl() { return backgroundUrl; }
public String GetAvatarUrl() { return avatarUrl; }
}
}
73 changes: 73 additions & 0 deletions Pages/CustomAffiliatePage.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@inject Services.UserService UserService
@inject NavigationManager NavigationManager
@page "/aff/{affiliateUid}"

<PageTitle>PLACEHOLDER TITLE | Cirsa</PageTitle>


<div class="container py-4 jumbotron-a">

<div class="container">
<div class="row">

<div class="col-12 col-md-6">

<!-- Description still loading -->
@if(customStyle == null)
{
<h1>Loading...</h1>
}
//Loaded description
else
{
<h1 class="display-5 fw-bold"> @customStyle.GetTitle() </h1>
<p>
Inicia sesión como afiliado para acceder al panel administrativo.
</p>
}

</div>

<div class="col-12 col-md-6">

<form class="user-form">

<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email</label>
<input @bind-value="clientMail" @bind-value:event="oninput" type="email" class="form-control" id="emailInput" required>
</div>
<button type="submit" @onclick="RegisterClient" class="btn button-gold-a">Continuar</button>

</form>

</div>

</div>
</div>

</div>


@code {
[Parameter]
public string affiliateUid { get; set; }

Check warning on line 53 in Pages/CustomAffiliatePage.razor

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Non-nullable property 'affiliateUid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

private AffiliateStyle? customStyle;
private String clientMail = "";


protected override async Task OnInitializedAsync()

Check warning on line 59 in Pages/CustomAffiliatePage.razor

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
SetCustomStyle();
}

private void SetCustomStyle()
{
customStyle = UserService.GetAffiliateStyle(affiliateUid);
}

private void RegisterClient()
{

}
}
10 changes: 10 additions & 0 deletions Pages/Dashboard.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
@page "/dashboard"
@inject Services.UserService UserService
@inject HttpClient Http

<PageTitle>Panel Administrativo | Cirsa</PageTitle>


@if (UserService.GetLoggedUser() == null)
{
<h1> Loading... </h1>
}
else
{
<h1> @UserService.GetLoggedUser().GetId() </h1>

Check warning on line 14 in Pages/Dashboard.razor

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

Dereference of a possibly null reference.
}

<h1>Weather</h1>

<p>This component demonstrates fetching data from the server.</p>
Expand Down
3 changes: 2 additions & 1 deletion Services/UserService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CirsaHackaton.Model;
using CirsaHackaton;
using Microsoft.AspNetCore.Components.Routing;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
Expand Down Expand Up @@ -49,6 +49,7 @@ public void InitializeDummyDB()
public User? GetLoggedUser() { return loggedUser; }
public User? GetUserById(String uid) { return dummyUsersDatabase.Find(user => user.GetId().Equals(uid)); }
public User? GetUserByMail(String mail) { return dummyUsersDatabase.Find(user => user.GetMail().Equals(mail)); }
public AffiliateStyle? GetAffiliateStyle(String affiliateUid) { return dummyStylesDatabase.Find(style => style.GetAffiliateUid().Equals(affiliateUid)); }


//Profile functions
Expand Down

0 comments on commit 7163a5d

Please sign in to comment.