Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions modules/coreI18n/src/main/key.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ object I18nKey:
def apply(key: String): I18nKey = key
import scalatags.Text.RawFrag
extension (key: I18nKey)
def value: String = key
def value: String = key
def txt(args: Any*)(using trans: Translate): String =
trans.translator.txt.literal(key, args, trans.lang)
def pluralTxt(count: Count, args: Any*)(using trans: Translate): String =
trans.translator.txt.plural(key, count, args, trans.lang)
def pluralSameTxt(count: Long)(using trans: Translate): String = pluralTxt(count, count)
def apply(args: Matchable*)(using trans: Translate): RawFrag =
def apply(args: Matchable*)(using trans: Translate): RawFrag =
trans.translator.frag.literal(key, args, trans.lang)
def plural(count: Count, args: Matchable*)(using trans: Translate): RawFrag =
trans.translator.frag.plural(key, count, args, trans.lang)
Expand Down Expand Up @@ -207,6 +207,8 @@ object I18nKey:
val `backToLiveMove`: I18nKey = "broadcast:backToLiveMove"
val `sinceHideResults`: I18nKey = "broadcast:sinceHideResults"
val `liveboard`: I18nKey = "broadcast:liveboard"
val `communityBroadcast`: I18nKey = "broadcast:communityBroadcast"
val `createdAndManagedBy`: I18nKey = "broadcast:createdAndManagedBy"
val `nbBroadcasts`: I18nKey = "broadcast:nbBroadcasts"
val `nbViewers`: I18nKey = "broadcast:nbViewers"

Expand Down Expand Up @@ -1802,7 +1804,6 @@ object I18nKey:
val `points`: I18nKey = "points"
val `wins`: I18nKey = "wins"
val `losses`: I18nKey = "losses"
val `createdBy`: I18nKey = "createdBy"
val `startingIn`: I18nKey = "startingIn"
val `standByX`: I18nKey = "standByX"
val `pause`: I18nKey = "pause"
Expand Down
1 change: 1 addition & 0 deletions modules/relay/src/main/Env.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ final class Env(
notifyApi: lila.core.notify.NotifyApi,
picfitApi: lila.memo.PicfitApi,
picfitUrl: lila.memo.PicfitUrl,
lightUserSync: lila.core.LightUser.GetterSync,
langList: lila.core.i18n.LangList,
baker: lila.core.security.LilaCookie
)(using Executor, akka.stream.Materializer, play.api.Mode)(using scheduler: Scheduler):
Expand Down
4 changes: 3 additions & 1 deletion modules/relay/src/main/JsonView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import lila.relay.RelayTour.{ WithLastRound, WithRounds }
import lila.study.ChapterPreview
import lila.core.fide.FideTC
import lila.core.socket.SocketVersion
import lila.core.LightUser.GetterSync

final class JsonView(baseUrl: BaseUrl, markup: RelayMarkup, picfitUrl: PicfitUrl):
final class JsonView(baseUrl: BaseUrl, markup: RelayMarkup, picfitUrl: PicfitUrl, lightUserSync: GetterSync):

import JsonView.{ Config, given }

Expand Down Expand Up @@ -55,6 +56,7 @@ final class JsonView(baseUrl: BaseUrl, markup: RelayMarkup, picfitUrl: PicfitUrl
if config.html then markup(tour)(md).value
else md.value)
.add("teamTable" -> tour.teamTable)
.add("communityOwner" -> tour.communityOwner.map(lightUserSync))

def fullTourWithRounds(trs: WithRounds, group: Option[RelayGroup.WithTours])(using Config): JsObject =
Json
Expand Down
2 changes: 2 additions & 0 deletions modules/relay/src/main/RelayTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ case class RelayTour(

def isOwnedBy[U: UserIdOf](u: U): Boolean = ownerIds.toList.contains(u.id)

def communityOwner: Option[UserId] = tier.isEmpty.option(ownerIds.head)

def giveOfficialToBroadcasterIf(cond: Boolean) =
if !cond || official == isOwnedBy(UserId.broadcaster) then this
else
Expand Down
2 changes: 2 additions & 0 deletions translation/source/broadcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@
<string name="backToLiveMove">Back to live move</string>
<string name="sinceHideResults">Since you chose to hide the results, all the preview boards are empty to avoid spoilers.</string>
<string name="liveboard">Live board</string>
<string name="communityBroadcast">Community broadcast</string>
<string name="createdAndManagedBy">Created and managed by %s.</string>
</resources>
1 change: 0 additions & 1 deletion translation/source/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@
<string name="points">Points</string>
<string name="wins">Wins</string>
<string name="losses">Losses</string>
<string name="createdBy">Created by</string>
<string name="startingIn" comment="Displayed above a timer">Starting in</string>
<string name="standByX">Stand by %s, pairing players, get ready!</string>
<string name="pause">Pause</string>
Expand Down
6 changes: 4 additions & 2 deletions ui/@types/lichess/i18n.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ interface I18n {
broadcastCalendar: string;
/** Broadcasts */
broadcasts: string;
/** Community broadcast */
communityBroadcast: string;
/** Created and managed by %s. */
createdAndManagedBy: I18nFormat;
/** Current game URL */
currentGameUrl: string;
/** Definitively delete the round and all its games. */
Expand Down Expand Up @@ -3145,8 +3149,6 @@ interface I18n {
createANewTopic: string;
/** Create a new tournament */
createANewTournament: string;
/** Created by */
createdBy: string;
/** Newly created simuls */
createdSimuls: string;
/** Create the game */
Expand Down
1 change: 1 addition & 0 deletions ui/analyse/src/study/relay/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export interface RelayTour {
tier?: number;
dates?: RelayTourDates;
tc?: 'standard' | 'rapid' | 'blitz';
communityOwner?: LightUser;
}

export interface RelaySync {
Expand Down
9 changes: 9 additions & 0 deletions ui/analyse/src/study/relay/relayTourView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { renderChat } from 'lib/chat/renderChat';
import { displayColumns, isTouchDevice } from 'lib/device';
import { verticalResizeSeparator } from 'lib/view/verticalResize';
import { watchers } from 'lib/view/watchers';
import { userLink } from 'lib/view/userLink';

export function renderRelayTour(ctx: RelayViewContext): VNode | undefined {
const tab = ctx.relay.tab();
Expand Down Expand Up @@ -395,6 +396,14 @@ const header = (ctx: RelayViewContext) => {
broadcastImageOrStream(ctx),
]),
studyD && h('div.relay-tour__note.pinned', h('div', [h('div', { hook: richHTML(studyD, false) })])),
d.tour.communityOwner &&
h(
'div.relay-tour__note',
h('div', [
h('div', i18n.broadcast.communityBroadcast),
h('small', i18n.broadcast.createdAndManagedBy.asArray(userLink(d.tour.communityOwner))),
]),
),
d.note &&
h(
'div.relay-tour__note',
Expand Down
Loading