Skip to content

Commit 0aa0e6a

Browse files
committed
Hello
1 parent c58bbce commit 0aa0e6a

File tree

8 files changed

+96
-108
lines changed

8 files changed

+96
-108
lines changed

.github/workflows/dotnet.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@ on:
66

77
jobs:
88
build:
9-
109
runs-on: ubuntu-latest
1110

1211
steps:
13-
- uses: actions/checkout@v2
14-
- name: Setup .NET
15-
uses: actions/setup-dotnet@v2
16-
with:
17-
dotnet-version: 8.0.x
18-
19-
- name: Publish .NET Core Project
20-
run: dotnet publish TomAndJerry.csproj -c Release -o release --nologo
21-
22-
- name: Change
23-
run: sed -i 's/<base href="\/" \/>/<base href="\/TomAndJerry\/" \/>/g' release/wwwroot/index.html
24-
25-
- name: Copy index.html to 404.html
26-
run: cp release/wwwroot/index.html release/wwwroot/404.html
27-
28-
# (Allow files and folders starting with an underscore)
29-
- name: Add .nojekyll file
30-
run: touch release/wwwroot/.nojekyll
31-
32-
- name: Commit wwwroot to GitHub Pages
33-
uses: JamesIves/[email protected]
34-
with:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
BRANCH: gh-pages
37-
FOLDER: release/wwwroot
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v2
17+
with:
18+
dotnet-version: 8.0.x
19+
20+
- name: Publish Blazor WebAssembly project
21+
run: dotnet publish TomAndJerry.csproj -c Release -o release --nologo
22+
23+
- name: Update <base> href for GitHub Pages
24+
run: sed -i 's|<base href="/" />|<base href="/TomAndJerry/" />|' release/wwwroot/index.html
25+
26+
- name: Add 404.html (for GitHub Pages SPA fallback)
27+
run: cp release/wwwroot/index.html release/wwwroot/404.html
28+
29+
- name: Add .nojekyll file
30+
run: touch release/wwwroot/.nojekyll
31+
32+
- name: Deploy to GitHub Pages
33+
uses: JamesIves/[email protected]
34+
with:
35+
token: ${{ secrets.GITHUB_TOKEN }}
36+
branch: gh-pages
37+
folder: release/wwwroot

Component/AppBar.razor

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@inject Data Datas
2-
@inject NavigationManager Nav
3-
@inject IJSRuntime JsRuntime
2+
@inject NavigationManager nav
3+
@inject IJSRuntime JSRuntime
44
<MudAppBar
55
Color="Color.Secondary"
66
Fixed="true"
@@ -25,7 +25,7 @@
2525

2626
</label>
2727

28-
<button class="micButton" @onclick="GoToPage">
28+
<button class="micButton" @onclick="GoTOPage">
2929
<svg viewBox="0 0 512 512" class="searchIcon"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"></path></svg>
3030
</button>
3131
</div>
@@ -37,22 +37,22 @@
3737

3838
void GoToHomePage()
3939
{
40-
Nav.NavigateTo("");
40+
nav.NavigateTo("");
4141
}
4242

43-
public void GoToPage()
43+
public void GoTOPage()
4444
{
4545
Filter();
4646
if (!string.IsNullOrEmpty(FindData))
4747
{
48-
Nav.NavigateTo($"Search/{FindData}");
48+
nav.NavigateTo($"Search/{FindData}");
4949
}
5050
}
5151
protected override async Task OnAfterRenderAsync(bool firstRender)
5252
{
5353
if (firstRender)
5454
{
55-
await JsRuntime.InvokeVoidAsync("blazorKeyPressed", DotNetObjectReference.Create(this));
55+
await JSRuntime.InvokeVoidAsync("blazorKeyPressed", DotNetObjectReference.Create(this));
5656
}
5757
}
5858
[JSInvokable]
@@ -61,7 +61,7 @@
6161
Filter();
6262
if (key == "Enter" && !string.IsNullOrEmpty(FindData))
6363
{
64-
Nav.NavigateTo($"Search/{FindData}");
64+
nav.NavigateTo($"Search/{FindData}");
6565
}
6666

6767
StateHasChanged();

Pages/Home.razor

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/"
2-
@inject NavigationManager Nav
2+
@inject NavigationManager nav
33
@inject Data Datas
44
<PageTitle>Home</PageTitle>
55
<MudPaper Class="d-flex flex-wrap justify-center "
@@ -8,9 +8,29 @@
88
Width="100%">
99
@foreach (var item in Datas.VideosData)
1010
{
11-
<MudPaper @onclick="()=>GoToPage(item)" Style="background-color:transparent" Elevation="0">
11+
<MudPaper @onclick="()=>GoTOPage(item)" Style="background-color:transparent" Elevation="0">
1212
<Thumbnail VideoModel="@item" />
1313
</MudPaper>
1414
}
1515

16-
</MudPaper>
16+
</MudPaper>
17+
18+
19+
@code
20+
{
21+
22+
public void GoTOPage(Video video)
23+
{
24+
nav.NavigateTo($"playmedia/{video.Id}");
25+
}
26+
protected override async Task OnInitializedAsync()
27+
{
28+
Datas.OnChange += StateHasChanged;
29+
//await Datas.InitializeAsync();
30+
}
31+
32+
public void Dispose()
33+
{
34+
Datas.OnChange -= StateHasChanged;
35+
}
36+
}

Pages/Home.razor.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Pages/PlayMedia.razor

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@page "/playmedia/{videId}"
2-
@inject NavigationManager Nav
2+
@inject NavigationManager nav
33
@inject Data Datas
4-
@inject IJSRuntime Js
4+
@inject IJSRuntime JS
55

66
<PageTitle>@Datas.GetVideo(VideId).CommentName.Substring(6)</PageTitle>
77
<MudPaper
@@ -26,7 +26,7 @@
2626
</MudText>
2727
</MudListItem>
2828
<MudListItem>
29-
@if(_show)
29+
@if(show)
3030
{
3131
<MudButton
3232
OnClick="ShowComment"
@@ -58,7 +58,7 @@
5858
Width="100%">
5959
@foreach (var item in Datas.GetRandomVideo())
6060
{
61-
<MudPaper @onclick="()=>GoToPage(item)" Style="background-color:transparent" Elevation="0">
61+
<MudPaper @onclick="()=>GoTOPage(item)" Style="background-color:transparent" Elevation="0">
6262
<Thumbnail VideoModel="@item" />
6363
</MudPaper>
6464
}
@@ -67,6 +67,35 @@
6767
</MudGrid>
6868
</MudPaper>
6969

70+
@code
71+
{
72+
bool show = true;
73+
[Parameter] public string VideId { get; set; } = string.Empty;
74+
public async Task GoTOPage(Video video)
75+
{
76+
await LoadGiscud(video.CommentName);
77+
nav.NavigateTo($"playmedia/{video.Id}");
78+
}
79+
async Task LoadGiscud(string id)
80+
{
81+
await JS.InvokeVoidAsync("loadDisqus", nav.Uri, id);
82+
}
83+
void ShowComment()
84+
{
85+
show = false;
86+
StateHasChanged();
87+
}
88+
protected override async Task OnInitializedAsync()
89+
{
90+
Datas.OnChange += StateHasChanged;
91+
//await Datas.InitializeAsync();
92+
}
93+
94+
public void Dispose()
95+
{
96+
Datas.OnChange -= StateHasChanged;
97+
}
98+
}
7099
<style>
71100
.video-container {
72101
position: relative;

Pages/PlayMedia.razor.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

Pages/Search.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/Search/{searchterm}"
2-
@inject NavigationManager Nav
2+
@inject NavigationManager nav
33
@inject Data Datas
44

55
<PageTitle>Search</PageTitle>
@@ -9,7 +9,7 @@
99
Width="100%" >
1010
@foreach (var item in Datas.FilteredData)
1111
{
12-
<MudPaper @onclick="()=>GoToPage(item)" Style="background-color:transparent" Elevation="0">
12+
<MudPaper @onclick="()=>GoTOPage(item)" Style="background-color:transparent" Elevation="0">
1313
<Thumbnail VideoModel="@item" />
1414
</MudPaper>
1515
}
@@ -19,7 +19,7 @@
1919

2020
@code
2121
{
22-
[Parameter] public string Searchterm { get; set; } = string.Empty;
22+
[Parameter] public string searchterm { get; set; } = string.Empty;
2323

2424
protected override async Task OnInitializedAsync()
2525
{
@@ -33,8 +33,8 @@
3333
{
3434
Datas.OnChange -= StateHasChanged;
3535
}
36-
public void GoToPage(Video video)
36+
public void GoTOPage(Video video)
3737
{
38-
Nav.NavigateTo($"playmedia/{video.Id}");
38+
nav.NavigateTo($"playmedia/{video.Id}");
3939
}
4040
}

wwwroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="utf-8"/>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
77
<title>Tom And Jerry</title>
8-
<base href="/TomAndJerry/"/>
8+
<base href="/"/>
99
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet"/>
1010
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
1111
<link rel="icon" type="image/png" href="favicon-32x32.png"/>

0 commit comments

Comments
 (0)