-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The most significant changes involve the addition of a new
Alphabet
…
… component and the removal of the `WeatherForecastFunction` and `Weather.razor` files. The `Alphabet` component fetches data from an `alphabet.json` file and displays it in a table. The `alphabet.json` file, which contains a JSON array of alphabet words and corresponding picture URLs, has been added to both the `App_Data` and `wwwroot\sample-data` directories. The `WeatherForecastFunction` and `Weather.razor` files, which were likely related to a weather forecasting feature, have been completely removed. Here is a list of the changes: 1. The `Api.csproj` file was updated to include a new `ItemGroup` that removes and includes the `alphabet.json` file in the `App_Data` directory. This file is set to always copy to the output directory and is excluded from single file deployments. It is also set to preserve the newest version when publishing. 2. The `launchSettings.json` file was updated to change the `launchBrowser` setting from `false` to `true`. 3. The `WeatherForecastFunction.cs` file was completely removed. 4. The `Client.csproj` file was updated to include a new `ItemGroup` that updates the `alphabet.json` file in the `wwwroot\sample-data` directory. This file is set to always copy to the output directory. 5. The `Home.razor` file was updated to replace the `Hello, world!` message and welcome message with the `Alphabet` component. 6. The `Weather.razor` file was completely removed. 7. The `Program.cs` file was updated to change the `HttpClient` service registration. The base address of the `HttpClient` is now always the host environment's base address, regardless of the `API_Prefix` configuration setting. 8. The `weather.json` file was completely removed. 9. A new `TalonAlphabetFunction.cs` file was added. This file defines a new Azure Function that reads the `alphabet.json` file from the `App_Data` directory and returns its contents as a JSON response. 10. A new `alphabet.json` file was added in the `App_Data` directory. This file contains a JSON array of alphabet words and corresponding picture URLs. 11. A new `Alphabet.razor` file was added. This file defines a new `Alphabet` component that fetches the alphabet data from the `alphabet.json` file and displays it in a table. 12. A new `Alphabet.razor.cs` file was added. This file defines the code-behind for the `Alphabet` component. It fetches the alphabet data from the `alphabet.json` file and handles any exceptions that occur during the fetch operation. 13. A new `alphabet.json` file was added in the `wwwroot\sample-data` directory. This file contains a JSON array of alphabet words and corresponding picture URLs.
- Loading branch information
1 parent
e47d982
commit 8e28e41
Showing
13 changed files
with
360 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
[ | ||
{ | ||
"alphabetWord": "Act", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/act.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Bat", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/bat.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Cat", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/cat.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Drum", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/drum.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Echo", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/echo.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Fox", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/fox.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Golf", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/golf.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Hot", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/hot.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "sIt", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/sit.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Jury", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/jury.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Krunch", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/crunch.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Look", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/look.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Mike", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/mike.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Near", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/near.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Odd", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/odd.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Pit", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/pit.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Quench", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/quench.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Red", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/red.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Sun", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/sun.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Trap", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/trap.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Urge", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/urge.jpg" | ||
}, | ||
{ | ||
"alphabetWord": "Vest", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/vest.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Whale", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/whale.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "pleX", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/plex.webp" | ||
}, | ||
{ | ||
"alphabetWord": "Yank", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/yank.jpeg" | ||
}, | ||
{ | ||
"alphabetWord": "Zip", | ||
"pictureUrl": "https://voicelauncherblazor.azurewebsites.net/images/zip.jpeg" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Azure.Functions.Worker.Http; | ||
using Microsoft.Extensions.Logging; | ||
using System.Diagnostics; | ||
using System.Net; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace API { | ||
public class TalonAlphabetFunction { | ||
private readonly ILogger _logger; | ||
public TalonAlphabetFunction(ILoggerFactory loggerFactory) { | ||
_logger = loggerFactory.CreateLogger<TalonAlphabetFunction>(); | ||
} | ||
|
||
[Function("TalonAlphabet")] | ||
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req) { | ||
//var result= Http.GetFromJsonAsync<TalonAlphabet[]>("sample-data/alphabet.json"); | ||
string? basedDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule?.FileName); | ||
string jsonString = string.Empty; | ||
if (basedDirectory != null) { | ||
string filePath = Path.Combine(basedDirectory, "App_Data", "alphabet.json"); | ||
jsonString = File.ReadAllText(filePath); | ||
} | ||
TalonAlphabet? alphabetWords = JsonSerializer.Deserialize<TalonAlphabet>(jsonString); | ||
HttpResponseData response = req.CreateResponse(HttpStatusCode.OK); | ||
if (jsonString?.Length > 0) { | ||
} | ||
if (alphabetWords != null) { | ||
} | ||
response.WriteAsJsonAsync(alphabetWords); | ||
return response; | ||
} | ||
|
||
private string GetSummary(int temp) { | ||
var summary = "Mild"; | ||
if (temp >= 32) { | ||
summary = "Hot"; | ||
} else if (temp <= 16 && temp > 0) { | ||
summary = "Cold"; | ||
} else if (temp <= 0) { | ||
summary = "Freezing"; | ||
} | ||
return summary; | ||
} | ||
|
||
public class TalonAlphabet { | ||
[JsonPropertyName("alphabetWord")] | ||
public string AlphabetWord { get; set; } = "Act"; | ||
[JsonPropertyName("pictureUrl")] | ||
public string PictureUrl { get; set; } = "https://somedomain.com/images/act.png"; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@page "/alphabet" | ||
@inject HttpClient Http | ||
|
||
<PageTitle>Talon Alphabet</PageTitle> | ||
|
||
<h1>Talon Alphabet</h1> | ||
|
||
<p>Create and edit your own Talon Alphabet with pictures to remind you.</p> | ||
|
||
@if (alphabetItems == null) { | ||
<p><em>Loading...</em></p> | ||
} else { | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Word</th> | ||
<th>Picture</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var word in alphabetItems) { | ||
<tr> | ||
<td>@word.AlphabetWord</td> | ||
<td> | ||
<img src="@word.PictureUrl" alt="@word.AlphabetWord" width="400" /> | ||
</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Message)) { | ||
|
||
<div class="alert alert-warning alert-dismissible fade show" role="alert"> | ||
<strong>Warning!</strong> @Message | ||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Net.Http.Json; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Client.Pages { | ||
public partial class Alphabet { | ||
private TalonAlphabet[]? alphabetItems; | ||
public string? Message { get; set; } | ||
protected override async Task OnInitializedAsync() { | ||
try { | ||
alphabetItems = await Http.GetFromJsonAsync<TalonAlphabet[]>("sample-data/alphabet.json"); | ||
//alphabetItems= await Http.GetFromJsonAsync<TalonAlphabet[]>("/api/TalonAlphabet") ?? new TalonAlphabet[] { }; | ||
} catch (Exception exception) { | ||
Message = exception.Message; | ||
Console.WriteLine(exception.Message); | ||
} | ||
// try | ||
// { | ||
// forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("/api/WeatherForecast") ?? new WeatherForecast[] { }; | ||
// } | ||
// catch (Exception ex) | ||
// { | ||
// Console.WriteLine(ex.Message); | ||
// } | ||
} | ||
|
||
public class TalonAlphabet { | ||
[JsonPropertyName("alphabetWord")] | ||
public string AlphabetWord { get; set; } = "Act"; | ||
[JsonPropertyName("pictureUrl")] | ||
public string PictureUrl { get; set; } = "https://somedomain.com/images/act.png"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
<PageTitle>Home</PageTitle> | ||
|
||
<h1>Hello, world!</h1> | ||
|
||
Welcome to your new app. | ||
|
||
<Alphabet /> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.