mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Improved library selection flow
This commit is contained in:
1 parent
a081a7a44d
commit
8d11acd783
17 files changed
+609
-71
No files matched your search
@@ -6,7 +6,7 @@
|
||||
* staying genuinely specific — the pre-save warning is a real, per-platform
|
||||
* hazard and must not be watered down into something vague.
|
||||
*/
|
||||
import type { Capabilities, SaveCapabilities } from '../api'
|
||||
import type { Capabilities, PlatformOption, SaveCapabilities } from '../api'
|
||||
|
||||
export function saveLabel(save: SaveCapabilities): string {
|
||||
return `Save to ${save.app_name}`
|
||||
@@ -64,3 +64,28 @@ export function readOnlyShort(caps: Capabilities): string | null {
|
||||
if (caps.writable) return null
|
||||
return caps.readonly_cause === 'cloud_synced' ? 'Read-only · cloud-synced' : 'Read-only'
|
||||
}
|
||||
|
||||
// ---- picker: choosing a platform, before any library is open ----------------
|
||||
//
|
||||
// These take a PlatformOption rather than Capabilities: the picker runs before
|
||||
// an adapter exists, so there are no capabilities to read yet.
|
||||
|
||||
/**
|
||||
* What this platform has to offer right now.
|
||||
*
|
||||
* "Nothing found" means two genuinely different things, and which one it is
|
||||
* decides what the user should do about it: a fixed-location platform is not
|
||||
* installed, or keeps its library somewhere unusual, and wants browsing —
|
||||
* whereas a removable one simply has nothing plugged in, and wants a USB port.
|
||||
* Someone told "not found" about OneLibrary would go hunting for a missing app.
|
||||
*/
|
||||
export function platformAvailability(p: PlatformOption): string {
|
||||
if (p.found > 1) return p.removable ? `${p.found} drives connected` : `${p.found} found`
|
||||
if (p.found === 1) return p.removable ? '1 drive connected' : `${p.library_label} found`
|
||||
return p.removable ? 'No drive connected' : `No ${p.library_label} in the usual place`
|
||||
}
|
||||
|
||||
/** What the manual browser is asking the user to pick out. */
|
||||
export function browsePrompt(p: PlatformOption): string {
|
||||
return p.selects === 'directory' ? 'Find the drive to open.' : `Choose a ${p.library_label} to open.`
|
||||
}
|
||||
Reference in new issue
Block a user