|
6 | 6 |
|
7 | 7 | <PageTitle Title="@_localizer["customize"]" /> |
8 | 8 |
|
9 | | -<h1 class="section-title">@_localizer["customize"]</h1> |
| 9 | +<h1 class="section-title">@_localizer["customization"]</h1> |
10 | 10 | <div class="section-content"> |
11 | | - @if (CurrentTheme != null) |
12 | | - { |
13 | | - <div class="customize-info d-flex"> |
14 | | - <div class="customize-info-cover"> |
15 | | - <img src="@CurrentTheme.Cover" class="customize-info-img" alt="@CurrentTheme.Title"> |
16 | | - </div> |
17 | | - <div class="customize-info-details"> |
18 | | - <div class="customize-info-title">@CurrentTheme.Title</div> |
19 | | - <p class="customize-info-desc">This is a test description, one paragraph long description for you, there should not be a break line in this description.</p> |
20 | | - <ul class="customize-info-list"> |
21 | | - <li>@_localizer["version"] 2.1</li> |
22 | | - <li>@_localizer["by"] John Doe</li> |
23 | | - <li><a href="#">Website</a></li> |
24 | | - <li><a href="#">GitHub</a></li> |
25 | | - <li><a href="#">Other Link</a></li> |
26 | | - </ul> |
27 | | - </div> |
28 | | - </div> |
29 | | - } |
| 11 | + <SettingsComponent @ref="ChildSettings" /> |
| 12 | + <button @onclick="()=> SaveSettings()" class="btn btn-blogifier px-5 mt-4">@_localizer["save"]</button> |
30 | 13 |
|
31 | | - <div class="customize-tab"> |
32 | | - <div class="customize-tab-nav nav nav-tabs flex-grow-1 mb-4" id="customize-tab" role="tablist"> |
33 | | - <button type="button" class="nav-link active" id="customize-settings-tab" data-bs-toggle="tab" data-bs-target="#customize-settings" role="tab" aria-controls="customize-settings" aria-selected="true">@_localizer["settings"]</button> |
34 | | - <button type="button" class="nav-link" id="customize-widgets-tab" data-bs-toggle="tab" data-bs-target="#customize-widgets" role="tab" aria-controls="customize-widgets" aria-selected="false">@_localizer["widgets"]</button> |
35 | | - <button type="button" class="nav-link" id="customize-menu-tab" data-bs-toggle="tab" data-bs-target="#customize-menu" role="tab" aria-controls="customize-menu" aria-selected="false">@_localizer["menus"]</button> |
36 | | - </div> |
37 | | - <div class="customize-tab-content tab-content" id="customize-tabContent"> |
38 | | - <div class="tab-pane fade show active" id="customize-settings" role="tabpanel" aria-labelledby="customize-settings-tab"> |
39 | | - <SettingsComponent @ref="ChildSettings" /> |
40 | | - <button @onclick="()=> SaveSettings()" class="btn btn-blogifier px-5 mt-4">@_localizer["save"]</button> |
41 | | - </div> |
42 | | - <div class="tab-pane fade" id="customize-widgets" role="tabpanel" aria-labelledby="customize-widgets-tab"> |
43 | | - <WidgetsComponent /> |
44 | | - <button @onclick="()=> SaveSettings()" class="btn btn-blogifier px-5 mt-4">@_localizer["save"]</button> |
45 | | - </div> |
46 | | - <div class="tab-pane fade" id="customize-menu" role="tabpanel" aria-labelledby="customize-menu-tab"> |
47 | | - <MenusComponent /> |
48 | | - <button @onclick="()=> SaveSettings()" class="btn btn-blogifier px-5 mt-4">@_localizer["save"]</button> |
49 | | - </div> |
50 | | - </div> |
51 | | - </div> |
52 | 14 | </div> |
53 | 15 |
|
54 | 16 | <ToasterComponent @ref="Toaster" /> |
55 | 17 |
|
56 | 18 | @code { |
57 | | - protected Blog Blog { get; set; } |
58 | | - protected ThemeItem CurrentTheme { get; set; } |
59 | 19 | protected ToasterComponent Toaster; |
60 | | - |
61 | 20 | SettingsComponent ChildSettings; |
62 | 21 |
|
63 | 22 | async Task SaveSettings() |
64 | 23 | { |
65 | 24 | Toaster.Toast(await ChildSettings.Save()); |
66 | 25 | } |
67 | | - |
68 | | - protected override async Task OnInitializedAsync() |
69 | | - { |
70 | | - await Load(); |
71 | | - } |
72 | | - |
73 | | - public async Task Load() |
74 | | - { |
75 | | - Blog = await _http.GetFromJsonAsync<Blog>("api/blog"); |
76 | | - var allThemes = await _http.GetFromJsonAsync<IList<string>>($"api/storage/themes"); |
77 | | - |
78 | | - foreach (var theme in allThemes) |
79 | | - { |
80 | | - if (theme.ToLower() == Blog.Theme.ToLower()) |
81 | | - { |
82 | | - CurrentTheme = new ThemeItem |
83 | | - { |
84 | | - Title = theme.Capitalize(), |
85 | | - IsCurrent = (Blog.Theme.ToLower() == theme.ToLower()), |
86 | | - Cover = await GetCover(theme) |
87 | | - }; |
88 | | - break; |
89 | | - } |
90 | | - } |
91 | | - } |
92 | | - |
93 | | - private async Task<string> GetCover(string theme) |
94 | | - { |
95 | | - string slash = System.IO.Path.DirectorySeparatorChar.ToString(); |
96 | | - string file = $"wwwroot{slash}themes{slash}{theme}{slash}screenshot.png"; |
97 | | - var result = await _http.PutAsJsonAsync<string>($"api/storage/exists", file); |
98 | | - |
99 | | - if (result.IsSuccessStatusCode) |
100 | | - return $"themes/{theme}/screenshot.png"; |
101 | | - else |
102 | | - return "img/img-placeholder.png"; |
103 | | - } |
104 | 26 | } |
0 commit comments