|
|
|
@@ -81,13 +81,16 @@ internal class DeskReport(val newlyReleased: Int, val newToLibrary: Int, val sca
|
|
|
|
|
/** Recent major films whose evidence is still to be read before they can be judged. */
|
|
|
|
|
val premiereQueued: Int = 0,
|
|
|
|
|
/** Premiere debuts you've approved, waiting for the booking workflow. */
|
|
|
|
|
val premiereApproved: List<String> = emptyList()) {
|
|
|
|
|
val premiereApproved: List<String> = emptyList(),
|
|
|
|
|
/** What the Chair has learned from your decisions, in plain words, and whether it's allowed to use it. */
|
|
|
|
|
val learnedSummary: String = "", val lessons: List<String> = emptyList(), val learningOn: Boolean = false) {
|
|
|
|
|
fun toJson(): JSONObject = JSONObject().put("newlyReleased", newlyReleased).put("newToLibrary", newToLibrary).put("scanned", scanned).put("unread", unread)
|
|
|
|
|
.put("strong", strong).put("strongByChannel", JSONArray(strongByChannel.map { JSONObject().put("c", it.first).put("n", it.second) }))
|
|
|
|
|
.put("picks", JSONArray(picks.map { JSONObject().put("t", it.title).put("c", it.channel).put("g", it.tag).put("l", it.line).item(it.id, it.type, it.year, it.options, it.firstRun) }))
|
|
|
|
|
.put("asks", JSONArray(asks.map { JSONObject().put("t", it.title).put("a", it.first).put("b", it.second).put("l", it.line).item(it.id, it.type, it.year, it.options, it.firstRun) }))
|
|
|
|
|
.put("collections", collections).put("franchises", franchises).put("catalogueComplete", catalogueComplete).put("computedMs", computedMs).put("tookMs", tookMs)
|
|
|
|
|
.put("decided", decided).put("premieres", JSONArray(premieres.map { it.toJson() })).put("premiereQueued", premiereQueued).put("premiereApproved", JSONArray(premiereApproved))
|
|
|
|
|
.put("learnedSummary", learnedSummary).put("lessons", JSONArray(lessons)).put("learningOn", learningOn)
|
|
|
|
|
companion object {
|
|
|
|
|
fun of(o: JSONObject): DeskReport {
|
|
|
|
|
fun list(key: String) = o.optJSONArray(key)?.let { a -> (0 until a.length()).map { a.getJSONObject(it) } }.orEmpty()
|
|
|
|
@@ -97,7 +100,8 @@ internal class DeskReport(val newlyReleased: Int, val newToLibrary: Int, val sca
|
|
|
|
|
list("asks").map { DeskAsk(it.optString("t"), it.optString("a"), it.optString("b"), it.optString("i"), it.optString("k"), it.year(), it.options(), it.optString("l"), it.firstRun()) },
|
|
|
|
|
o.optInt("collections"), o.optBoolean("catalogueComplete"), o.optInt("franchises"), o.optLong("computedMs"), o.optLong("tookMs"), o.optInt("decided"),
|
|
|
|
|
list("premieres").map(DeskPremiere::of), o.optInt("premiereQueued"),
|
|
|
|
|
o.optJSONArray("premiereApproved")?.let { a -> (0 until a.length()).map { a.getString(it) } }.orEmpty())
|
|
|
|
|
o.optJSONArray("premiereApproved")?.let { a -> (0 until a.length()).map { a.getString(it) } }.orEmpty(),
|
|
|
|
|
o.optString("learnedSummary"), o.optJSONArray("lessons")?.let { a -> (0 until a.length()).map { a.getString(it) } }.orEmpty(), o.optBoolean("learningOn"))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -140,6 +144,22 @@ internal fun homeOf(p: Placement): Placement {
|
|
|
|
|
/** Where a placed title can go: the scored channels, best first, three at most, never one the scoring ruled out. */
|
|
|
|
|
private fun optionsOf(p: Placement, max: Int = 3): List<DeskOption> = p.ranked.take(max).map { (b, _, why) -> DeskOption(b.number, b.name, reasonLine(why)) }
|
|
|
|
|
|
|
|
|
|
/** Hard limits a drop-down never crosses: the wrong kind (a series on a film channel), a children's channel for an adult rating, or animation and live action swapped. */
|
|
|
|
|
private fun neverOffered(why: List<String>) = why.firstOrNull()?.let { it == "wrong kind" || it.startsWith("rated ") || it.endsWith("not for this channel") && ("animation" in it || "live action" in it) } == true
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Every channel a title could be placed on, for the pop-up's drop-down: the scored fits best first, then the rest of its kind,
|
|
|
|
|
* each with the reason it's outside its usual brief. Premiere is never a home.
|
|
|
|
|
*/
|
|
|
|
|
internal fun channelChoices(p: Placement, text: ChannelText, links: FranchiseLinks): List<DeskOption> {
|
|
|
|
|
val fits = p.ranked.filter { it.first.number != PREMIERE_NUMBER }.map { (b, _, why) -> DeskOption(b.number, b.name, reasonLine(why)) }
|
|
|
|
|
val rest = Briefs.filter { b -> b.number != PREMIERE_NUMBER && fits.none { it.number == b.number } }.mapNotNull { b ->
|
|
|
|
|
val why = channelScore(p.evidence, b, text, links).second
|
|
|
|
|
if (neverOffered(why)) null else DeskOption(b.number, b.name, "outside its usual brief: " + (why.firstOrNull() ?: "no fit"))
|
|
|
|
|
}
|
|
|
|
|
return fits + rest
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Paul's standing editorial calls so far, shown so the director's reasoning is visible. */
|
|
|
|
|
internal val DirectorRules = listOf("Made-for-TV romances: not for Orbit", "Tales from the Crypt: After Dark strand", "Black Mirror: Paradox from 21:00")
|
|
|
|
|
|
|
|
|
@@ -174,8 +194,8 @@ internal fun franchiseLinks(file: File, pools: Map<Int, List<String>>): Triple<F
|
|
|
|
|
*/
|
|
|
|
|
internal fun buildDeskReport(evidenceFile: File, collectionsFile: File, pools: Map<Int, List<String>>, released: List<Arrival>, carriedWorks: Set<String>,
|
|
|
|
|
originals: Map<String, String>, newToLibrary: Int, catalogueComplete: Boolean, mode: DirectorMode, nowMs: Long, zone: ZoneId = ZoneId.systemDefault(),
|
|
|
|
|
decided: Set<String> = emptySet(), premiere: PremiereInputs = PremiereInputs()): DeskReport =
|
|
|
|
|
buildDeskReports(evidenceFile, collectionsFile, pools, released, carriedWorks, originals, newToLibrary, catalogueComplete, nowMs, zone, decided, premiere).getValue(mode)
|
|
|
|
|
decided: Set<String> = emptySet(), premiere: PremiereInputs = PremiereInputs(), history: List<ChairDecision> = emptyList(), learning: Boolean = false): DeskReport =
|
|
|
|
|
buildDeskReports(evidenceFile, collectionsFile, pools, released, carriedWorks, originals, newToLibrary, catalogueComplete, nowMs, zone, decided, premiere, history, learning).getValue(mode)
|
|
|
|
|
|
|
|
|
|
/** What Orbit Premiere's proposals are judged from: the catalogue's recent films, each film's Orbit status and this week's premiere decisions. */
|
|
|
|
|
internal class PremiereInputs(val films: List<PremiereFacts> = emptyList(), val status: (String) -> OrbitStatus = { OrbitStatus.Never }, val decidedThisWeek: Int = 0)
|
|
|
|
@@ -189,7 +209,9 @@ internal fun listMembers(file: File, names: Set<String>): Set<String> = if (!fil
|
|
|
|
|
internal fun buildDeskReports(evidenceFile: File, collectionsFile: File, pools: Map<Int, List<String>>, released: List<Arrival>, carriedWorks: Set<String>,
|
|
|
|
|
originals: Map<String, String>, newToLibrary: Int, catalogueComplete: Boolean, nowMs: Long, zone: ZoneId = ZoneId.systemDefault(),
|
|
|
|
|
/** Titles you've placed or dropped on the Chair: never shown again, so the next ones take their place. */
|
|
|
|
|
decided: Set<String> = emptySet(), premiere: PremiereInputs = PremiereInputs()): Map<DirectorMode, DeskReport> {
|
|
|
|
|
decided: Set<String> = emptySet(), premiere: PremiereInputs = PremiereInputs(),
|
|
|
|
|
/** Your decisions, for what the Chair has learned ([chairLessons]); [learning] is your switch for letting it change suggestions. */
|
|
|
|
|
history: List<ChairDecision> = emptyList(), learning: Boolean = false): Map<DirectorMode, DeskReport> {
|
|
|
|
|
val started = System.nanoTime()
|
|
|
|
|
val evidence = if (evidenceFile.exists()) evidenceFile.readLines().mapNotNull { runCatching { JSONObject(it) }.getOrNull() }
|
|
|
|
|
.associate { it.optString("id") to TitleEvidence.of(it, originals[it.optString("id")]) } else emptyMap()
|
|
|
|
@@ -221,20 +243,30 @@ internal fun buildDeskReports(evidenceFile: File, collectionsFile: File, pools:
|
|
|
|
|
val byChannel = strong.groupingBy { it.top.name }.eachCount().entries.sortedByDescending { it.value }.map { it.key to it.value }
|
|
|
|
|
val premiered = released.associate { it.id to it.premiere }
|
|
|
|
|
fun recent(id: String) = premiered[id]?.takeIf { it.length == 10 }?.let { runCatching { LocalDate.parse(it) }.getOrNull() }?.let { !it.isBefore(today.minusDays(14)) } == true
|
|
|
|
|
val undecided = placed.filter { it.evidence.id !in decided && it.evidence.id !in proposed }
|
|
|
|
|
val lessons = chairLessons(history, evidence)
|
|
|
|
|
// Learning on: titles like ones you keep dropping are held back, and a redirect you keep making becomes the suggestion.
|
|
|
|
|
val heldBack = if (learning) placed.filter { lessons.holdBackFor(it.top.number, it.evidence.genreSet) != null }.map { it.evidence.id }.toSet() else emptySet()
|
|
|
|
|
fun learned(p: Placement): ChairLesson? = if (learning) lessons.redirectFor(p.top.number, p.evidence.genreSet) else null
|
|
|
|
|
fun choicesFor(p: Placement): List<DeskOption> {
|
|
|
|
|
val all = channelChoices(p, text, links)
|
|
|
|
|
val lesson = learned(p) ?: return all
|
|
|
|
|
val to = all.firstOrNull { it.number == lesson.to } ?: return all
|
|
|
|
|
return listOf(DeskOption(to.number, to.name, "learned from you: " + lesson.text())) + all.filter { it.number != to.number }
|
|
|
|
|
}
|
|
|
|
|
val undecided = placed.filter { it.evidence.id !in decided && it.evidence.id !in proposed && it.evidence.id !in heldBack }
|
|
|
|
|
val asks = undecided.filter { it.tier == FitTier.NeedsEye }.sortedByDescending { it.s1 }.take(3).map {
|
|
|
|
|
DeskAsk(it.evidence.name, it.top.name, it.second.name, it.evidence.id, it.evidence.type, it.evidence.year, optionsOf(it, 2), it.evidence.overview?.let { o -> sentence(o) } ?: "No description in the library yet") }
|
|
|
|
|
DeskAsk(it.evidence.name, it.top.name, it.second.name, it.evidence.id, it.evidence.type, it.evidence.year, choicesFor(it), it.evidence.overview?.let { o -> sentence(o) } ?: "No description in the library yet") }
|
|
|
|
|
val tookMs = (System.nanoTime() - started) / 1_000_000
|
|
|
|
|
return DirectorMode.values().associateWith { mode ->
|
|
|
|
|
// Discoveries: the strongest strong matches, one per channel; Surprise Me reaches into the possibles for channels the strong list missed.
|
|
|
|
|
val pool = undecided.filter { it.tier == FitTier.Strong }.sortedByDescending { it.s1 }.distinctBy { it.top.number }.toMutableList()
|
|
|
|
|
if (mode == DirectorMode.Surprise) pool += undecided.filter { it.tier == FitTier.Possible && pool.none { p -> p.top.number == it.top.number } }.sortedByDescending { it.s1 }.take(2)
|
|
|
|
|
val picks = pool.take(mode.picks).map { p ->
|
|
|
|
|
DeskPick(p.evidence.name, p.top.name, when { p.tier == FitTier.Possible -> "SOMETHING DIFFERENT"; recent(p.evidence.id) -> "JUST RELEASED"; else -> "STRONG MATCH" },
|
|
|
|
|
p.evidence.overview?.let { sentence(it) } ?: "No description in the library yet", p.evidence.id, p.evidence.type, p.evidence.year, optionsOf(p))
|
|
|
|
|
DeskPick(p.evidence.name, learned(p)?.to?.let { n -> Briefs.firstOrNull { it.number == n }?.name } ?: p.top.name, when { learned(p) != null -> "LEARNED FROM YOU"; p.tier == FitTier.Possible -> "SOMETHING DIFFERENT"; recent(p.evidence.id) -> "JUST RELEASED"; else -> "STRONG MATCH" },
|
|
|
|
|
p.evidence.overview?.let { sentence(it) } ?: "No description in the library yet", p.evidence.id, p.evidence.type, p.evidence.year, choicesFor(p))
|
|
|
|
|
}
|
|
|
|
|
DeskReport(candidates.size, newToLibrary, read.size, candidates.size - read.size, byChannel, strong.size, picks, asks, collections, catalogueComplete, franchises, nowMs, tookMs, placed.count { it.evidence.id in decided }, premieres, premiereQueued,
|
|
|
|
|
PremiereCalls.filter { it.premiere }.map { it.title })
|
|
|
|
|
PremiereCalls.filter { it.premiere }.map { it.title }, lessons.summary(), lessons.lessons.map { it.text() }, learning)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -247,7 +279,8 @@ private val DirectorLock = Any()
|
|
|
|
|
*/
|
|
|
|
|
internal fun directorReports(store: ScheduleStore, catalogue: CatalogueStore, userId: String, nowMs: Long = System.currentTimeMillis()): Map<DirectorMode, DeskReport>? = synchronized(DirectorLock) {
|
|
|
|
|
val evidence = store.evidenceFile(); val collections = store.collectionsFile(); val cache = store.directorFile(); val decisions = store.decisionsFile()
|
|
|
|
|
val key = listOf(evidence.lastModified(), collections.lastModified(), store.poolsStamp(), catalogue.summary().total ?: 0L, decisions.lastModified()).joinToString(":")
|
|
|
|
|
val key = listOf(evidence.lastModified(), collections.lastModified(), store.poolsStamp(), catalogue.summary().total ?: 0L, decisions.lastModified(),
|
|
|
|
|
store.learningFile().lastModified()).joinToString(":")
|
|
|
|
|
runCatching { JSONObject(cache.readText()) }.getOrNull()?.takeIf { it.optString("key") == key && nowMs - it.optLong("savedMs") < 24 * 60 * 60_000L }?.let { saved ->
|
|
|
|
|
val reports = saved.optJSONObject("reports")
|
|
|
|
|
if (reports != null) return@synchronized DirectorMode.values().associateWith { DeskReport.of(reports.getJSONObject(it.name)) }
|
|
|
|
@@ -259,7 +292,8 @@ internal fun directorReports(store: ScheduleStore, catalogue: CatalogueStore, us
|
|
|
|
|
val (arrivals, _) = store.loadArrivals(userId)
|
|
|
|
|
val newToLibrary = arrivals.count { nowMs - it.firstSeenMs < NEW_TO_LIBRARY_DAYS * 24 * 60 * 60_000L }
|
|
|
|
|
val reports = buildDeskReports(evidence, collections, ids, released, carriedWorks, catalogue.originalTitles(released.map { it.id }), newToLibrary, catalogue.complete(), nowMs,
|
|
|
|
|
decided = loadDecisions(decisions).map { it.id }.toSet(), premiere = premiereInputs(store, catalogue, userId, nowMs))
|
|
|
|
|
decided = loadDecisions(decisions).map { it.id }.toSet(), premiere = premiereInputs(store, catalogue, userId, nowMs),
|
|
|
|
|
history = loadDecisions(decisions), learning = ChairLearning.on(store.learningFile()))
|
|
|
|
|
runCatching { cache.writeText(JSONObject().put("key", key).put("savedMs", nowMs).put("reports", JSONObject().apply { reports.forEach { (m, r) -> put(m.name, r.toJson()) } }).toString()) }
|
|
|
|
|
val b = reports.getValue(DirectorMode.Balanced)
|
|
|
|
|
android.util.Log.i("OrbitSchedule", "director newlyReleased=${b.newlyReleased} read=${b.scanned} strong=${b.strong} asks=${b.asks.size} collections=${b.collections} tookMs=${b.tookMs}")
|
|
|
|
@@ -316,7 +350,9 @@ private val ChairSky = Color(0xFF78BEFF)
|
|
|
|
|
internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequester, modifier: Modifier,
|
|
|
|
|
place: (ChairChoice, DeskOption) -> Unit = { _, _ -> }, drop: (ChairChoice) -> Unit = {},
|
|
|
|
|
/** Premiere first, then [DeskOption] as its home; returns what to tell you (the debut, or why there's none). */
|
|
|
|
|
premiere: suspend (ChairChoice, DeskOption) -> String = { _, _ -> "" }) {
|
|
|
|
|
premiere: suspend (ChairChoice, DeskOption) -> String = { _, _ -> "" },
|
|
|
|
|
/** Your learning switch: saved, then the report is worked out again. */
|
|
|
|
|
setLearning: suspend (Boolean) -> Unit = {}) {
|
|
|
|
|
var mode by remember { mutableStateOf(DirectorMode.Balanced) }
|
|
|
|
|
var version by remember { mutableIntStateOf(0) }
|
|
|
|
|
var report by remember { mutableStateOf<DeskReport?>(null) }
|
|
|
|
@@ -339,6 +375,13 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
|
|
|
|
|
}
|
|
|
|
|
Spacer(Modifier.width(8.dp))
|
|
|
|
|
Text("Auto-approval: OFF", color = ChairMint, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
|
|
|
|
|
Spacer(Modifier.width(8.dp))
|
|
|
|
|
val learningOn = report?.learningOn == true
|
|
|
|
|
var learnFocused by remember { mutableStateOf(false) }
|
|
|
|
|
Text("Learning: " + if (learningOn) "ON" else "OFF", Modifier.onFocusChanged { learnFocused = it.isFocused }
|
|
|
|
|
.clickable { scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } }
|
|
|
|
|
.background(if (learningOn) ChairMint else ChairPanel, RoundedCornerShape(12.dp)).border(if (learnFocused) 2.dp else 0.dp, Color.White, RoundedCornerShape(12.dp))
|
|
|
|
|
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (learningOn) ChairNavy else Color.White, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
|
|
|
|
|
}
|
|
|
|
|
val r = report
|
|
|
|
|
if (r == null) { Text("Working out this week's report. The first time takes a little while; after that the Chair opens straight away.", color = Muted, fontSize = 12.sp); return@Column }
|
|
|
|
@@ -384,6 +427,11 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
|
|
|
|
|
Spacer(Modifier.height(4.dp))
|
|
|
|
|
Text("RULES IN FORCE", color = Color.White, fontFamily = Anton, fontSize = 13.sp)
|
|
|
|
|
DirectorRules.forEach { Text("· $it", color = Muted, fontSize = 10.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) }
|
|
|
|
|
Spacer(Modifier.height(4.dp))
|
|
|
|
|
Text("WHAT IT'S LEARNED", color = Color.White, fontFamily = Anton, fontSize = 13.sp)
|
|
|
|
|
Text(r.learnedSummary.ifEmpty { "No decisions yet." }, color = Muted, fontSize = 10.sp)
|
|
|
|
|
if (r.lessons.isEmpty()) Text("Nothing to change yet: a pattern needs two decisions that go the same way.", color = Muted, fontSize = 10.sp)
|
|
|
|
|
r.lessons.take(3).forEach { Text("· $it", color = if (r.learningOn) ChairMint else Muted, fontSize = 10.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Text(said ?: "Press a title to place it or drop it. A placed title joins that channel's list at its next top-up; nothing already booked changes. Worked out in ${r.tookMs} ms.",
|
|
|
|
@@ -427,22 +475,28 @@ private fun ChairPopup(choice: ChairChoice, onPlace: (DeskOption) -> Unit, onDro
|
|
|
|
|
if (PREMIERE_BOOKING_ACTIVE && home != null) OrbitButton("Premiere, then ${home.name.removePrefix("Orbit ")}", Modifier.focusRequester(firstButton), onClick = { onPremiere(home) })
|
|
|
|
|
else Text("Premiere booking switches on once you approve it", color = ChairGold, fontSize = 10.sp)
|
|
|
|
|
}
|
|
|
|
|
// Asks show both channels from the start; a pick shows its suggestion, and the other fits on Change channel.
|
|
|
|
|
// A pick shows its suggestion, an ask the two channels it's torn between; every other channel is in the drop-down.
|
|
|
|
|
// A Premiere proposal is view-only while booking is off: no placing, no dropping, nothing written.
|
|
|
|
|
val viewOnly = choice.firstRun != null && !PREMIERE_BOOKING_ACTIVE
|
|
|
|
|
val shown = when { viewOnly -> emptyList(); choice.ask || others -> choice.options; else -> choice.options.take(1) }
|
|
|
|
|
shown.forEachIndexed { i, option ->
|
|
|
|
|
Row(Modifier.fillMaxWidth().background(ChairPanel, RoundedCornerShape(6.dp)).padding(10.dp), verticalAlignment = androidx.compose.ui.Alignment.CenterVertically,
|
|
|
|
|
val lead = if (viewOnly) 0 else if (choice.ask) 2 else 1
|
|
|
|
|
@Composable fun OptionRow(option: DeskOption, label: String, focusFirst: Boolean) =
|
|
|
|
|
Row(Modifier.fillMaxWidth().background(ChairPanel, RoundedCornerShape(6.dp)).padding(horizontal = 10.dp, vertical = 6.dp), verticalAlignment = androidx.compose.ui.Alignment.CenterVertically,
|
|
|
|
|
horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
|
|
|
|
Column(Modifier.weight(1f)) {
|
|
|
|
|
Text(option.name.uppercase(java.util.Locale.UK) + if (i == 0 && !choice.ask) " · SUGGESTED" else "", color = ChairSky, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
|
|
|
|
|
Text(option.name.uppercase(java.util.Locale.UK) + label, color = ChairSky, fontSize = 12.sp, fontWeight = FontWeight.SemiBold)
|
|
|
|
|
Text(option.reason, color = Muted, fontSize = 11.sp, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
|
|
|
|
}
|
|
|
|
|
OrbitButton("Place on ${option.name}", if (i == 0 && (choice.firstRun == null || !PREMIERE_BOOKING_ACTIVE)) Modifier.focusRequester(firstButton) else Modifier, onClick = { onPlace(option) })
|
|
|
|
|
OrbitButton("Place on ${option.name}", if (focusFirst) Modifier.focusRequester(firstButton) else Modifier, onClick = { onPlace(option) })
|
|
|
|
|
}
|
|
|
|
|
choice.options.take(lead).forEachIndexed { i, option ->
|
|
|
|
|
OptionRow(option, if (i == 0 && !choice.ask) " · SUGGESTED" else "", i == 0 && (choice.firstRun == null || !PREMIERE_BOOKING_ACTIVE) && !others)
|
|
|
|
|
}
|
|
|
|
|
val rest = choice.options.drop(lead)
|
|
|
|
|
if (others && rest.isNotEmpty()) Column(Modifier.fillMaxWidth().heightIn(max = 220.dp).verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(4.dp)) {
|
|
|
|
|
rest.forEachIndexed { i, option -> OptionRow(option, "", i == 0) }
|
|
|
|
|
}
|
|
|
|
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
|
|
|
|
if (!viewOnly && !choice.ask && !others && choice.options.size > 1) OrbitButton("Change channel", onClick = { others = true })
|
|
|
|
|
if (!viewOnly && rest.isNotEmpty()) OrbitButton(if (others) "Other channels ▴" else "Other channels ▾ (${rest.size})", onClick = { others = !others })
|
|
|
|
|
if (!viewOnly) OrbitButton("Drop", if (choice.options.isEmpty()) Modifier.focusRequester(firstButton) else Modifier, onClick = onDrop)
|
|
|
|
|
OrbitButton(if (viewOnly) "Close" else "Not now", if (viewOnly) Modifier.focusRequester(firstButton) else Modifier, onClick = onClose)
|
|
|
|
|
}
|
|
|
|
|