using Microsoft.AspNetCore.Components;
namespace AIStudio.Components;
///
/// The title of a dialog about one file or web page: its name, and at the side, ways to copy its
/// path and to find it in the file manager, see FileActions.
///
///
/// The path is what the copy button copies, so that is where it shows, in the tooltip of that
/// button, instead of taking a line of its own. Every dialog about a file names it the same way,
/// which is why this lives here instead of in each of them. A file which is no longer at its place
/// gets a warning instead of the button of the file manager.
///
public partial class FileDialogTitle : MSGComponentBase
{
///
/// The title, usually the name of the file.
///
[Parameter]
public string Title { get; set; } = string.Empty;
///
/// The path of the file or the address of the web page, or nothing when there is neither to name.
///
[Parameter]
public string Path { get; set; } = string.Empty;
///
/// Whether a file which is no longer at its place gets a warning, see FileActions.WarnIfMissing.
///
[Parameter]
public bool WarnIfMissing { get; set; } = true;
///
/// Whether the path is the address of a web page, which this title then opens in the browser.
///
private bool OpensWebPages => FileActions.DetermineKind(this.Path) is FileActions.FileActionsKind.WEB_PAGE;
}