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
2 changes: 1 addition & 1 deletion modules/relay/src/main/ui/RelayFormUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, tourUi: RelayTourUi):
private def page(title: String, menu: Either[String, FormNavigation])(using Context) =
Page(title)
.css("bits.relay.form")
.js(esmInitBit("relayForm"))
.js(Esm("bits.relayTourForm"))
.wrap: body =>
main(cls := "page page-menu")(
menu.fold(tourUi.pageMenu(_), navigationMenu),
Expand Down
23 changes: 23 additions & 0 deletions ui/bits/src/bits.relayTourForm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { wireCropDialog } from './crop';

site.load.then(() => {
$('.form3[action="/broadcast/new"] #form3-info_timeZone').each(function (this: HTMLSelectElement) {
if (!$('.is-invalid').length) this.value = Intl.DateTimeFormat().resolvedOptions().timeZone;
Comment on lines +4 to +5
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the best way I found to prevent changes if there is an error or if it's in the edit form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is specific to the 4 best players, i don't understand an assumption they would all be in the same time zone and i don't understand why we would want to default it to the timezone of the person filling this form.

but if this is what you want to do, lgtm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(that's a declaration of my ignorance, not a review objection)

});

wireCropDialog({
aspectRatio: 2 / 1,
post: { url: $('.relay-image-edit').attr('data-post-url')!, field: 'image' },
selectClicks: $('.select-image, .drop-target'),
selectDrags: $('.drop-target'),
});

const $source = $('#form3-syncSource'),
showSource = () =>
$('.relay-form__sync').each(function (this: HTMLElement) {
this.classList.toggle('none', !this.classList.contains(`relay-form__sync-${$source.val()}`));
});

$source.on('change', showSource);
showSource();
});
20 changes: 0 additions & 20 deletions ui/bits/src/bits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export function initModule(args: { fn: string } & any): void {
return importer();
case 'pmAll':
return pmAll();
case 'relayForm':
return relayForm();
case 'setAssetInfo':
return setAssetInfo();
case 'streamerSubscribe':
Expand Down Expand Up @@ -186,24 +184,6 @@ function pmAll() {
});
}

function relayForm() {
wireCropDialog({
aspectRatio: 2 / 1,
post: { url: $('.relay-image-edit').attr('data-post-url')!, field: 'image' },
selectClicks: $('.select-image, .drop-target'),
selectDrags: $('.drop-target'),
});

const $source = $('#form3-syncSource'),
showSource = () =>
$('.relay-form__sync').each(function (this: HTMLElement) {
this.classList.toggle('none', !this.classList.contains(`relay-form__sync-${$source.val()}`));
});

$source.on('change', showSource);
showSource();
}

function setAssetInfo() {
$('#asset-version-date').text(site.info.date);
$('#asset-version-commit')
Expand Down
Loading