Skip to content

Commit

Permalink
🐛 Remove service worker, fix not starting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
russkyc committed May 27, 2024
1 parent 7e64e51 commit 8dfdd5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
13 changes: 12 additions & 1 deletion Timely/Components/TimeRecord.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,28 @@
</MudChip>
</MudChipSet>
</MudStack>
<MudButton OnClick="@Delete" StartIcon="@Icons.Material.Rounded.Delete" Color="Color.Primary" Variant="Variant.Text" DisableElevation="true">
<MudSpacer/>
<MudButton FullWidth="false" Size="Size.Small" Class="h-min w-4 m-auto" OnClick="@Delete" Color="Color.Primary" Variant="Variant.Filled" DisableElevation="true">
<MudIcon Class="2-8 h-8" Icon="@Icons.Material.Rounded.Delete"></MudIcon>
</MudButton>
</MudStack>
</MudPaper>

@inject IDialogService DialogService

@code {

[Parameter] public Shift Shift { get; set; }

Check warning on line 36 in Timely/Components/TimeRecord.razor

View workflow job for this annotation

GitHub Actions / deploy-to-github-pages

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

private async Task Delete()
{
var result = await DialogService.ShowMessageBox("Delete Time Record", "This action cannot be undone, continue?");

if (result is null || !result.Value)
{
return;
}

await using var db = new AppDbContext();
await db.Shifts.Where(shift => shift.Id == Shift.Id).ExecuteDeleteAsync();
await db.SaveToCacheAsync();
Expand Down
6 changes: 0 additions & 6 deletions Timely/Timely.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<GHPages>true</GHPages>
</PropertyGroup>

Expand All @@ -16,11 +15,6 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.17.0" />
<PackageReference Include="PublishSPAforGitHubPages.Build" Version="2.1.1" />
</ItemGroup>

<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

</Project>
12 changes: 0 additions & 12 deletions Timely/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@
</div>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<script src="_framework/blazor.webassembly.js"></script>
<script>
const registerServiceWorker = async () => {
if ("serviceWorker" in navigator) {
try {
await navigator.serviceWorker.register("service-worker.js");
} catch (error) {
console.error(`Registration failed with ${error}`);
}
}
}
registerServiceWorker();
</script>
</body>

</html>

0 comments on commit 8dfdd5b

Please sign in to comment.