CODEX - Added Warning sign if Archetype is missing
This commit is contained in:
@@ -249,6 +249,7 @@ export default function MelodyDetail() {
|
||||
const speedBpm = formatBpm(speedMs);
|
||||
const minBpm = formatBpm(info.minSpeed);
|
||||
const maxBpm = formatBpm(info.maxSpeed);
|
||||
const missingArchetype = Boolean(melody.pid) && !builtMelody?.id;
|
||||
const languages = melodySettings?.available_languages || ["en"];
|
||||
const displayName = getLocalizedValue(info.name, displayLang, "Untitled Melody");
|
||||
|
||||
@@ -556,10 +557,6 @@ export default function MelodyDetail() {
|
||||
|
||||
const handleDownload = async (e) => {
|
||||
e.preventDefault();
|
||||
if (binaryUrl.startsWith("http")) {
|
||||
window.open(binaryUrl, "_blank", "noopener,noreferrer");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const token = localStorage.getItem("access_token");
|
||||
let res = null;
|
||||
@@ -586,7 +583,13 @@ export default function MelodyDetail() {
|
||||
a.click();
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
} catch (err) {
|
||||
window.open(binaryUrl, "_blank", "noopener,noreferrer");
|
||||
const a = document.createElement("a");
|
||||
a.href = binaryUrl;
|
||||
a.download = downloadName;
|
||||
a.rel = "noopener noreferrer";
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -600,6 +603,15 @@ export default function MelodyDetail() {
|
||||
{downloadName}
|
||||
</span>
|
||||
)}
|
||||
{missingArchetype && (
|
||||
<span
|
||||
className="text-xs cursor-help"
|
||||
style={{ color: "#f59e0b" }}
|
||||
title="This binary does not exist in the Archetypes"
|
||||
>
|
||||
⚠
|
||||
</span>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleDownload}
|
||||
|
||||
Reference in New Issue
Block a user