Skip to content

Commit

Permalink
broadcast share links
Browse files Browse the repository at this point in the history
including the public PGN source for other websites to relay the moves
  • Loading branch information
ornicar committed Jun 24, 2024
1 parent 5774f7d commit 8f667bc
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
2 changes: 0 additions & 2 deletions modules/coreI18n/src/main/key.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1671,8 +1671,6 @@ object I18nKey:
val `startDate`: I18nKey = "broadcast:startDate"
val `startDateHelp`: I18nKey = "broadcast:startDateHelp"
val `credits`: I18nKey = "broadcast:credits"
val `broadcastUrl`: I18nKey = "broadcast:broadcastUrl"
val `currentRoundUrl`: I18nKey = "broadcast:currentRoundUrl"
val `currentGameUrl`: I18nKey = "broadcast:currentGameUrl"
val `downloadAllRounds`: I18nKey = "broadcast:downloadAllRounds"
val `resetRound`: I18nKey = "broadcast:resetRound"
Expand Down
2 changes: 0 additions & 2 deletions modules/relay/src/main/ui/RelayUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ final class RelayUi(helpers: Helpers)(
import trans.broadcast as trb
List(
trb.addRound,
trb.broadcastUrl,
trb.currentRoundUrl,
trb.currentGameUrl,
trb.downloadAllRounds,
trb.editRoundStudy
Expand Down
2 changes: 0 additions & 2 deletions translation/source/broadcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<string name="startDate">Start date in your own timezone</string>
<string name="startDateHelp">Optional, if you know when the event starts</string>
<string name="credits">Credit the source</string>
<string name="broadcastUrl">Broadcast URL</string>
<string name="currentRoundUrl">Current round URL</string>
<string name="currentGameUrl">Current game URL</string>
<string name="downloadAllRounds">Download all rounds</string>
<string name="resetRound">Reset this round</string>
Expand Down
9 changes: 9 additions & 0 deletions ui/analyse/css/study/relay/_tour.scss
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ $hover-bg: $m-primary_bg--mix-30;
@include rendered-markdown(2em, 50vh);
margin: 3em var(---box-padding);
}
&__share {
@extend %box-neat;
background: $c-bg-zebra;
margin: 3em var(---box-padding);
padding: 3em var(---box-padding) 1em var(---box-padding);
h2 {
margin-bottom: 3rem;
}
}

&__leaderboard {
width: auto;
Expand Down
28 changes: 28 additions & 0 deletions ui/analyse/src/study/relay/relayTourView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { renderStreamerMenu, renderPinnedImage } from './relayView';
import { renderVideoPlayer } from './videoPlayerView';
import { leaderboardView } from './relayLeaderboard';
import { gameLinksListener } from '../studyChapters';
import { copyMeInput } from 'common/copyMe';
import { baseUrl } from '../../view/util';

export function renderRelayTour(ctx: RelayViewContext): VNode | undefined {
const tab = ctx.relay.tab();
Expand Down Expand Up @@ -105,6 +107,32 @@ const overview = (ctx: RelayViewContext) => [
hook: innerHTML(ctx.relay.data.tour.markup, () => ctx.relay.data.tour.markup!),
})
: h('div.relay-tour__markup', ctx.relay.data.tour.description),
h('div.relay-tour__share', [
h('h2.text', { attrs: dataIcon(licon.Heart) }, 'Sharing is caring'),
...[
[ctx.relay.data.tour.name, ctx.relay.tourPath()],
[ctx.study.data.name, ctx.relay.roundPath()],
[
`${ctx.study.data.name} PGN`,
`${ctx.relay.roundPath()}.pgn`,
h('div.form-help', [
'A public, real-time PGN source for this round. We also offer a ',
h(
'a',
{ attrs: { href: 'https://lichess.org/api#tag/Broadcasts/operation/broadcastStreamRoundPgn' } },
'streaming API',
),
' for faster and more efficient synchronisation.',
]),
],
].map(([i18n, path, help]: [string, string, VNode]) =>
h('div.form-group', [
h('label.form-label', ctx.ctrl.trans.noarg(i18n)),
copyMeInput(`${baseUrl()}${path}`),
help,
]),
),
]),
];

const groupSelect = (relay: RelayCtrl, group: RelayGroup) => {
Expand Down
4 changes: 2 additions & 2 deletions ui/analyse/src/study/studyShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export function view(ctrl: StudyShare): VNode {
h('form.form3', [
...(ctrl.relay
? [
['broadcastUrl', ctrl.relay.tourPath()],
['currentRoundUrl', ctrl.relay.roundPath()],
[ctrl.relay.data.tour.name, ctrl.relay.tourPath()],
[ctrl.data.name, ctrl.relay.roundPath()],
['currentGameUrl', addPly(`${ctrl.relay.roundPath()}/${chapter.id}`), true],
]
: [
Expand Down

0 comments on commit 8f667bc

Please sign in to comment.