Disable the export button when no files loaded

This commit is contained in:
ds5678 2024-01-25 22:53:08 -05:00
parent 9ac7dc062f
commit 22fff845d7
3 changed files with 17 additions and 6 deletions

View File

@ -83,18 +83,25 @@ public abstract class DefaultPage : HtmlPage
WriteDropdownButton(writer, Localization.MenuExport);
using (new Ul(writer).WithClass("dropdown-menu").End())
{
using (new Li(writer).End())
{
WritePostLink(writer, "/Export", Localization.MenuExportAll, "dropdown-item");
}
if (GameFileLoader.IsLoaded)
{
using (new Li(writer).End())
{
WritePostLink(writer, "/Export", Localization.MenuExportAll, "dropdown-item");
}
string version = GameFileLoader.GameBundle.GetMaxUnityVersion().ToString();
using (new Li(writer).End())
{
new A(writer).WithClass("dropdown-item").WithNewTabAttributes().WithHref($"unityhub://{version}").Close(version);
}
}
else
{
using (new Li(writer).End())
{
new A(writer).WithClass("dropdown-item disabled").WithCustomAttribute("aria-diabled", "true").Close(Localization.MenuExportAll);
}
}
}
}
using (new Div(writer).WithClass("btn-group dropdown").End())

View File

@ -194,7 +194,10 @@ public sealed partial class SettingsPage : DefaultPage
for (int i = 0; i < items.Count; i++)
{
DropDownItem<T> item = items[i];
new P(writer).WithId(CreateUniqueID(id, i)).Close(item.Description);
new P(writer)
.WithClass("dropdown-description")//Used for CSS selecting
.WithId(CreateUniqueID(id, i))
.Close(item.Description);
}
static string CreateUniqueID(string selectID, int index)

View File

@ -34,6 +34,7 @@ footer {
margin-top: auto; /* Push the footer to the bottom of the container */
}
.disabled {
/* This lets the dropdown descriptions in the settings menu render correctly. */
.dropdown-description.disabled {
display: none; /* Hide disabled elements */
}