Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional button for non-participating members (e.g. Scrum Masters) #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY . .
WORKDIR "/src/PlanningPoker.Web"
RUN dotnet publish "PlanningPoker.Web.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "PlanningPoker.Web.dll"]
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY . .
WORKDIR "/src/PlanningPoker.Web"
RUN dotnet publish "PlanningPoker.Web.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "PlanningPoker.Web.dll"]
6 changes: 6 additions & 0 deletions PlanningPoker.Web/Game/GameInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ internal void Join(Player player)
this.RaiseChanged();
}

internal void AllowVote(Player player, bool canVote = true)
{
player.HasCards = canVote;
this.RaiseChanged();
}

private void RaiseChanged()
{
this.Changed?.Invoke(this, EventArgs.Empty);
Expand Down
2 changes: 2 additions & 0 deletions PlanningPoker.Web/Game/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class Player : IEquatable<Player>
public string Name { get; set; }
public Guid Secret { get; set; }

public bool HasCards { get; set; } = true;

public bool Equals([AllowNull] Player other)
{
if (other is null)
Expand Down
69 changes: 44 additions & 25 deletions PlanningPoker.Web/Pages/Game.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
<div class="col-auto">
<a class="btn btn-info" target="_blank" href="https://t.me/share/url?url=https://planningpoker.party/@this.Hash&text=Planning%20Poker">🔗 Share via Telegram</a>
</div>
@if (this.Player != null)
{
<div class="col-auto">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="customSwitch1" checked="@this.Player.HasCards" @onchange="this.HasCardsChanged">
<label class="custom-control-label" for="customSwitch1">Do I participate?</label>
</div>
</div>
}
</div>
}

Expand All @@ -42,22 +51,29 @@
</div>

<div class="player-card">
@if (this.Game.CurrentRound.Cards.ContainsKey(player) == true)
@if (player.HasCards == true)
{
if (this.Game.CurrentRound.IsRevealed == true)
if (this.Game.CurrentRound.Cards.ContainsKey(player) == true)
{
<div class="player-card-revealed">
@this.Game.CurrentRound.Cards[player]
</div>
if (this.Game.CurrentRound.IsRevealed == true)
{
<div class="player-card-revealed">
@this.Game.CurrentRound.Cards[player]
</div>
}
else
{
@:🃏
}
}
else
{
@:🃏
@:
}
}
else
{
@:
@:👑
}
</div>
</div>
Expand All @@ -66,26 +82,29 @@
</div>
}

<div class="row mt-3">
<div class="col">
@if (this.Game != null && this.Game.CurrentRound != null && this.Game.CurrentRound.IsRevealed == false && this.Player != null)
{
@foreach (var card in this.Game.CardDeck)
@if (this.Player != null && this.Player.HasCards == true)
{
<div class="row mt-3">
<div class="col">
@if (this.Game != null && this.Game.CurrentRound != null && this.Game.CurrentRound.IsRevealed == false && this.Player != null)
{
<button class="btn btn-outline-secondary mr-2" @onclick="(() => this.VoteCard(card))">
@if (card == this.CardChoosenInCurrentRound)
{
<strong style="color: white;">
@foreach (var card in this.Game.CardDeck)
{
<button class="btn btn-outline-secondary mr-2" @onclick="(() => this.VoteCard(card))">
@if (card == this.CardChoosenInCurrentRound)
{
<strong style="color: white;">
@card
</strong>
}
else
{
@card
</strong>
}
else
{
@card
}
</button>
}
</button>
}
}
}
</div>
</div>
</div>
}
</div>
2 changes: 1 addition & 1 deletion PlanningPoker.Web/PlanningPoker.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions PlanningPoker.Web/ViewModels/GameViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ protected async Task NameChanged(ChangeEventArgs e)
await this.LocalStorage.SetItemAsync(nameof(this.Player), this.Player);
}

protected void HasCardsChanged(ChangeEventArgs e)
{
this.Game.AllowVote(this.Player, (bool)e.Value);
}

private void Game_Changed(object sender, EventArgs e)
{
_ = this.InvokeAsync(() => this.StateHasChanged());
Expand Down