diff --git a/apps/speakers/workspace.html b/apps/speakers/workspace.html index 8406bdcd2..db6b1ba32 100644 --- a/apps/speakers/workspace.html +++ b/apps/speakers/workspace.html @@ -398,10 +398,29 @@ } .spk-status-error { + display: flex; + align-items: center; + justify-content: space-between; background: #fee2e2; color: #991b1b; } +.spk-status-dismiss { + background: none; + border: none; + color: inherit; + font-size: 16px; + line-height: 1; + cursor: pointer; + padding: 0 0 0 8px; + opacity: 0.7; +} + +.spk-status-dismiss:hover, +.spk-status-dismiss:focus { + opacity: 1; +} + .spk-status-info { background: #e8f4fd; border: 1px solid #b3d9f2; @@ -709,7 +728,7 @@
ready to review
@@ -740,6 +759,26 @@ audio: '' }; + const ERROR_MAP = [ + { match: 'Embedding too similar to owner voice', message: "this voice sounds like yours — it can't be saved as a different speaker" }, + { match: 'Cannot confirm unattributed sentence', message: 'this sentence needs to be assigned to a speaker first' }, + { match: 'Can only confirm medium-confidence', message: 'this attribution is already confirmed' }, + { match: 'Sentence embedding not found', message: 'something went wrong — try again' }, + { match: 'No speaker labels found', message: 'something went wrong — try again' }, + { match: 'not found in labels', message: "this sentence wasn't found — try refreshing the page" }, + { match: 'Sentence already has a speaker', message: 'this sentence already has a speaker — use correct to change it' }, + { match: 'is blocked', message: "that speaker is blocked and can't be used" }, + { match: 'not found', message: "that speaker wasn't found — they may have been removed. Try refreshing the page" }, + ]; + + function friendlyError(backendMessage) { + if (!backendMessage) return 'something went wrong — try again'; + for (const entry of ERROR_MAP) { + if (backendMessage.includes(entry.match)) return entry.message; + } + return 'something went wrong — try again'; + } + function emptyStateHTML(icon, heading, desc) { return '