Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KarmaKamikaze committed Mar 6, 2025
1 parent f49222d commit bd5a4d4
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 101 deletions.
181 changes: 92 additions & 89 deletions ChatRPG/Pages/UserCampaignOverview.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
</div>
<!-- Campaign type selection -->
<div class="text-center my-3">
<RadzenSelectBar Size="ButtonSize.Small" @bind-Value="IsOpenWorld" TValue="bool" Change="OnCampaignTypeChange" class="rz-shadow-6 prompt-selector">
<RadzenSelectBar Size="ButtonSize.Small" @bind-Value="IsOpenWorld" TValue="bool"
Change="OnCampaignTypeChange" class="rz-shadow-6 prompt-selector">
<Items>
<RadzenSelectBarItem Text="Open World" Value="true" class="rz-ripple" id="open-world-mode"/>
<RadzenSelectBarItem Text="Predefined" Value="false" class="rz-ripple" id="predefined-mode"/>
Expand All @@ -21,99 +22,100 @@
@if (IsOpenWorld)
{
<div class="row gap-3">
<div class="col rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Your Campaigns</h3>
<div class="vstack overflow-auto form-text-black mb-1 scrollbar" style="max-height: 500px;"
id="your-campaigns">
@foreach (CampaignModel campaign in Campaigns)
{
<button class="campaign-button card card-dim mb-2"
@onclick='() => LaunchCampaign(campaign.Id)'>
<div class="card-body col-12">
<h5 class="card-title">@campaign.Title</h5>
<h6 class="card-subtitle mb-2 text-muted"
style="font-size: 14px;">@campaign.Player.Name</h6>
<hr/>
<p class="card-text line-clamp text-start">@(campaign.StartScenario ?? "No scenario")</p>
<p class="card-text" style="font-size: 14px;">
Started @campaign.StartedOn.ToShortDateString() @campaign.StartedOn.ToShortTimeString()</p>
</div>
<button class="delete-campaign-button rounded"
@onclick='() => ShowCampaignDeleteModal(campaign)' @onclick:stopPropagation>
<i class="bi bi-trash3 text-danger"></i>
</button>
</button>
}
</div>
<p class="text-muted" id="campaigns-count">
Found @(Campaigns.Count) campaign@(Campaigns.Count == 1 ? "" : "s").</p>
</div>
</div>
<div class="col rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Starting Scenarios</h3>
<div class="vstack overflow-auto form-text-black mb-1 scrollbar" style="max-height: 500px;"
id="start-scenarios">
@foreach (StartScenario scenario in StartScenarios)
{
<Scenario ApplyScenario="ApplyStartingScenario" Title="@scenario.Title"
Body="@scenario.Body"/>
}
</div>
<p class="text-muted" id="scenarios-count">
Found @(StartScenarios.Count) scenario@(StartScenarios.Count == 1 ? "" : "s").</p>
</div>
</div>
<div class="col-5 rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Create an Open World Campaign</h3>
<div class="form">
<div class="mb-3">
<label for="inputCampaignTitle" class="form-label">Campaign Title<span
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CampaignTitle" @oninput="UpdateCampaignTitleOnKeyPress"
class="form-control" id="inputCampaignTitle" data-toggle="tooltip"
data-placement="top" title="Campaign title is required.">
@if (string.IsNullOrWhiteSpace(CampaignTitle) && TestFields)
<div class="col rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Your Campaigns</h3>
<div class="vstack overflow-auto form-text-black mb-1 scrollbar" style="max-height: 500px;"
id="your-campaigns">
@foreach (CampaignModel campaign in Campaigns)
{
<div class="alert-sm alert-danger alert-inside-input mt-1 p-2 rounded" role="alert"
id="campaign-title-alert">
Campaign title is required.
</div>
<button class="campaign-button card card-dim mb-2"
@onclick='() => LaunchCampaign(campaign.Id)'>
<div class="card-body col-12">
<h5 class="card-title">@campaign.Title</h5>
<h6 class="card-subtitle mb-2 text-muted"
style="font-size: 14px;">@campaign.Player.Name</h6>
<hr/>
<p class="card-text line-clamp text-start">@(campaign.StartScenario ?? "No scenario")</p>
<p class="card-text" style="font-size: 14px;">
Started @campaign.StartedOn.ToShortDateString() @campaign.StartedOn.ToShortTimeString()</p>
</div>
<button class="delete-campaign-button rounded"
@onclick='() => ShowCampaignDeleteModal(campaign)' @onclick:stopPropagation>
<i class="bi bi-trash3 text-danger"></i>
</button>
</button>
}
</div>
<div class="mb-3">
<label for="inputCharacterName" class="form-label">Character Name<span
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CharacterName" @oninput="UpdateCharacterNameOnKeyPress"
class="form-control" id="inputCharacterName" data-toggle="tooltip"
data-placement="top" title="Character name is required."/>
@if (string.IsNullOrWhiteSpace(CharacterName) && TestFields)
<p class="text-muted" id="campaigns-count">
Found @(Campaigns.Count) campaign@(Campaigns.Count == 1 ? "" : "s").</p>
</div>
</div>
<div class="col rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Starting Scenarios</h3>
<div class="vstack overflow-auto form-text-black mb-1 scrollbar" style="max-height: 500px;"
id="start-scenarios">
@foreach (StartScenario scenario in StartScenarios)
{
<div class="alert-sm alert-danger alert-inside-input mt-1 p-2 rounded" role="alert"
id="character-name-alert">
Character name is required.
</div>
<Scenario ApplyScenario="ApplyStartingScenario" Title="@scenario.Title"
Body="@scenario.Body"/>
}
</div>
<div class="mb-3">
<label for="inputCharacterDescription" class="form-label">Character Description</label>
<textarea class="form-control scrollbar" style="resize: none;" @bind="CharacterDescription"
id="inputCharacterDescription" rows="2"></textarea>
</div>
<div class="mb-3">
<label for="inputCustomStartScenario" class="form-label">Custom Start Scenario</label>
<textarea class="form-control scrollbar" style="resize: none;" @bind="StartScenario"
id="inputCustomStartScenario" rows="@TextAreaRows"></textarea>
<p class="text-muted" id="scenarios-count">
Found @(StartScenarios.Count) scenario@(StartScenarios.Count == 1 ? "" : "s").</p>
</div>
</div>
<div class="col-5 rounded custom-gray-container">
<div class="m-3">
<h3 class="text-center mb-4">Create an Open World Campaign</h3>
<div class="form">
<div class="mb-3">
<label for="inputCampaignTitle" class="form-label">Campaign Title<span
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CampaignTitle" @oninput="UpdateCampaignTitleOnKeyPress"
class="form-control" id="inputCampaignTitle" data-toggle="tooltip"
data-placement="top" title="Campaign title is required.">
@if (string.IsNullOrWhiteSpace(CampaignTitle) && TestFields)
{
<div class="alert-sm alert-danger alert-inside-input mt-1 p-2 rounded" role="alert"
id="campaign-title-alert">
Campaign title is required.
</div>
}
</div>
<div class="mb-3">
<label for="inputCharacterName" class="form-label">Character Name<span
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CharacterName" @oninput="UpdateCharacterNameOnKeyPress"
class="form-control" id="inputCharacterName" data-toggle="tooltip"
data-placement="top" title="Character name is required."/>
@if (string.IsNullOrWhiteSpace(CharacterName) && TestFields)
{
<div class="alert-sm alert-danger alert-inside-input mt-1 p-2 rounded" role="alert"
id="character-name-alert">
Character name is required.
</div>
}
</div>
<div class="mb-3">
<label for="inputCharacterDescription" class="form-label">Character Description</label>
<textarea class="form-control scrollbar" style="resize: none;"
@bind="CharacterDescription"
id="inputCharacterDescription" rows="2"></textarea>
</div>
<div class="mb-3">
<label for="inputCustomStartScenario" class="form-label">Custom Start Scenario</label>
<textarea class="form-control scrollbar" style="resize: none;" @bind="StartScenario"
id="inputCustomStartScenario" rows="@TextAreaRows"></textarea>
</div>
<button class="btn btn-primary" style="width: 100%" @onclick="CreateAndStartCampaign"
id="create-campaign-button">Create Campaign
</button>
</div>
<button class="btn btn-primary" style="width: 100%" @onclick="CreateAndStartCampaign"
id="create-campaign-button">Create Campaign
</button>
</div>
</div>
</div>
</div>
}
else
{
Expand All @@ -124,7 +126,7 @@
<div class="form">
<div class="mb-3">
<label for="inputCampaignTitle" class="form-label">Campaign Title<span
class="required-keyword">(Required)</span></label>
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CampaignTitle" @oninput="UpdateCampaignTitleOnKeyPress"
class="form-control" id="inputCampaignTitle" data-toggle="tooltip"
data-placement="top" title="Campaign title is required.">
Expand All @@ -138,7 +140,7 @@
</div>
<div class="mb-3">
<label for="inputCharacterName" class="form-label">Character Name<span
class="required-keyword">(Required)</span></label>
class="required-keyword">(Required)</span></label>
<input type="text" @bind="CharacterName" @oninput="UpdateCharacterNameOnKeyPress"
class="form-control" id="inputCharacterName" data-toggle="tooltip"
data-placement="top" title="Character name is required."/>
Expand All @@ -152,12 +154,13 @@
</div>
<div class="mb-3">
<label for="inputCharacterDescription" class="form-label">Character Description</label>
<textarea class="form-control scrollbar" style="resize: none;" @bind="CharacterDescription"
id="inputCharacterDescription" rows="2"></textarea>
<textarea class="form-control scrollbar" style="resize: none;"
@bind="CharacterDescription"
id="inputCharacterDescription" rows="2"></textarea>
</div>
<div class="mb-3">
<label for="inputScenarioPDF" class="form-label">Upload Scenario PDF</label>
<InputFile class="form-control" OnChange="HandleScenarioFileUpload" />
<InputFile class="form-control" OnChange="HandleScenarioFileUpload"/>
@if (!string.IsNullOrEmpty(FileUploadError))
{
<div class="text-danger mt-2">@FileUploadError</div>
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dotnet build --configuration Release

4. Navigate to the build folder and run the program

**Important**: Please read the *Setting up Entity Framework* section before running the game.
**Important**: Please read the _Setting up Entity Framework_ section before running the game.

```shell
cd bin/Release/net8.0/
Expand Down Expand Up @@ -128,6 +128,7 @@ dotnet ef database update
The database used in the connection string should now be up-to-date and ready for use.

#### Installing pgvector Extension

To use our vector-based search features, you must install the `pgvector` extension in your PostgreSQL database.

Follow the instructions on the official [pgvector GitHub page](https://github.com/pgvector/pgvector) to install the extension.
Expand All @@ -145,12 +146,12 @@ To make changes to the data model, follow these steps:
2. Make the required changes, e.g. by changing the database context (`/ChatRPG/Data/ApplicationDbContext.cs`), or by
adding/altering models in `/ChatRPG/Data/Models/`.
3. Run the following command, which will generate a migration named `[DATE_AND_TIME]_[NAME_OF_MIGRATION].cs`:
```shell
dotnet ef migrations add [NAME_OF_MIGRATION]
```
```shell
dotnet ef migrations add [NAME_OF_MIGRATION]
```
4. To apply this migration, run the command:
```shell
dotnet ef database update
```shell
dotnet ef database update
```

The local data model should then be up-to-date.
Expand All @@ -163,20 +164,20 @@ and the captivating world that awaits. Dive in, make choices, and let the magic
#### Landing Page

![Landing Page](.github/images/landing-page.png)
*Welcome to ChatRPG! The journey begins at our inviting landing page,
setting the stage for the immersive adventures that await.*
_Welcome to ChatRPG! The journey begins at our inviting landing page,
setting the stage for the immersive adventures that await._

#### Dashboard

![Dashboard](.github/images/dashboard.png)
*Your control center for epic storytelling! The Dashboard lets users configure new campaigns,
track progress, and seamlessly continue previous adventures.*
_Your control center for epic storytelling! The Dashboard lets users configure new campaigns,
track progress, and seamlessly continue previous adventures._

#### Campaign Gameplay

![Campaign Gameplay](.github/images/campaign.png)
*Step into the heart of the action! The Campaign Gameplay screen is where fantasy comes to life,
with dynamic storytelling and AI-powered encounters.*
_Step into the heart of the action! The Campaign Gameplay screen is where fantasy comes to life,
with dynamic storytelling and AI-powered encounters._

## Contribute

Expand Down

0 comments on commit bd5a4d4

Please sign in to comment.