broadcast tournament/rounds WIP
parent
e37c218bf6
commit
26fa459654
|
@ -60,7 +60,7 @@ final class RelayTour(env: Env) extends LilaController(env) {
|
|||
err => BadRequest(html.relay.tourForm.edit(tour, err)).fuccess,
|
||||
setup =>
|
||||
env.relay.api.tourUpdate(tour, setup, me) inject
|
||||
Redirect(routes.RelayTour.edit(tour.id.value)).flashSuccess
|
||||
Redirect(routes.RelayTour.redirect(tour.slug, tour.id.value))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ object roundForm {
|
|||
def create(form: Form[Data], tour: RelayTour)(implicit ctx: Context) =
|
||||
layout(newBroadcast.txt())(
|
||||
h1(a(href := routes.RelayTour.redirect(tour.slug, tour.id.value))(tour.name), " • ", addRound()),
|
||||
standardFlash(),
|
||||
inner(form, routes.RelayRound.create(tour.id.value), tour)
|
||||
)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ object tour {
|
|||
h2(tr.tour.name),
|
||||
div(cls := "relay-widget__info")(
|
||||
p(tr.tour.description),
|
||||
p(
|
||||
p(cls := "relay-widget__info__meta")(
|
||||
strong(tr.round.name),
|
||||
br,
|
||||
if (tr.ongoing) trans.playingRightNow()
|
||||
|
@ -60,7 +60,7 @@ object tour {
|
|||
h2(rt.tour.name),
|
||||
div(cls := "relay-widget__info")(
|
||||
p(rt.tour.description),
|
||||
rt.tour.syncedAt.map(momentFromNow(_))
|
||||
rt.tour.syncedAt.map(momentFromNow(_)(cls := "relay-widget__info__meta"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -81,7 +81,9 @@ final private class RelayFetch(
|
|||
.withTimeout(7 seconds, SyncResult.Timeout)
|
||||
.mon(_.relay.syncTime(rt.tour.official, rt.round.slug))
|
||||
.map { res =>
|
||||
res -> rt.round.withSync(_ addLog SyncLog.event(res.moves, none))
|
||||
res -> rt.round
|
||||
.withSync(_ addLog SyncLog.event(res.moves, none))
|
||||
.copy(finished = games.forall(_.end.isDefined))
|
||||
}
|
||||
}
|
||||
.recover { case e: Exception =>
|
||||
|
|
|
@ -29,16 +29,20 @@ final class RelayPush(sync: RelaySync, api: RelayApi)(implicit
|
|||
private def pushNow(rt: RelayRound.WithTour, pgn: String): Funit =
|
||||
RelayFetch
|
||||
.multiPgnToGames(MultiPgn.split(pgn, RelayFetch.maxChapters(rt.tour)))
|
||||
.flatMap {
|
||||
sync(rt, _)
|
||||
}
|
||||
.map { res =>
|
||||
SyncLog.event(res.moves, none)
|
||||
}
|
||||
.recover { case e: Exception =>
|
||||
SyncLog.event(0, e.some)
|
||||
}
|
||||
.flatMap { event =>
|
||||
api.update(rt.round)(_.withSync(_ addLog event)).void
|
||||
.flatMap { games =>
|
||||
sync(rt, games)
|
||||
.map { res =>
|
||||
SyncLog.event(res.moves, none)
|
||||
}
|
||||
.recover { case e: Exception =>
|
||||
SyncLog.event(0, e.some)
|
||||
}
|
||||
.flatMap { event =>
|
||||
api
|
||||
.update(rt.round)(
|
||||
_.withSync(_ addLog event).copy(finished = games.forall(_.end.isDefined))
|
||||
)
|
||||
.void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import AnalyseCtrl from '../../ctrl';
|
||||
import { h, VNode } from 'snabbdom';
|
||||
import { dataIcon, iconTag, innerHTML } from '../../util';
|
||||
import { dataIcon, innerHTML } from '../../util';
|
||||
import { view as multiBoardView } from '../multiBoard';
|
||||
import { StudyCtrl } from '../interfaces';
|
||||
|
||||
export default function (ctrl: AnalyseCtrl): VNode | undefined {
|
||||
const study = ctrl.study;
|
||||
const relay = study && study.relay;
|
||||
const relay = study?.relay;
|
||||
if (study && relay?.tourShow.active)
|
||||
return h('div.relay-tour', [
|
||||
h('div.relay-tour__text', [
|
||||
h('h1', study.data.name),
|
||||
h('h1', relay.data.tour.name),
|
||||
relay.data.tour.markup
|
||||
? h('div', {
|
||||
hook: innerHTML(relay.data.tour.markup, () => relay.data.tour.markup!),
|
||||
|
|
|
@ -187,7 +187,7 @@ export function side(ctrl: StudyCtrl): VNode {
|
|||
const tourTab =
|
||||
tourShow &&
|
||||
h(
|
||||
'span.relay-tour',
|
||||
'span.relay-tour.text',
|
||||
{
|
||||
class: { active: tourShow.active },
|
||||
hook: bind(
|
||||
|
@ -197,8 +197,11 @@ export function side(ctrl: StudyCtrl): VNode {
|
|||
},
|
||||
ctrl.redraw
|
||||
),
|
||||
attrs: {
|
||||
'data-icon': '',
|
||||
},
|
||||
},
|
||||
[iconTag(''), ' Broadcast']
|
||||
'Broadcast'
|
||||
);
|
||||
|
||||
const tabs = h('div.tabs-horiz', [
|
||||
|
|
|
@ -43,9 +43,15 @@
|
|||
|
||||
p {
|
||||
margin: 0.5em 0 0 0;
|
||||
&:first-child {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&__info {
|
||||
@extend %flex-between;
|
||||
@extend %flex-between-nowrap;
|
||||
&__meta {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue