X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=94a7bbad1d9f59f3288c5d0c775a393d68699384;hp=5217c34de312a0b4bc4eddc3f05c6b494fab2a2d;hb=bae751bc6bc548791772c3ff5883a03deeb77264;hpb=cafe016679ee9c14bf7bf0a37104ade7f74aff89 diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 5217c34d..94a7bbad 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -12,9 +12,13 @@ main div#acceptDiv(role="dialog") .card p.text-center - span.variantName {{ curChallToAccept.vname }} + span.variantName + | {{ curChallToAccept.vname }} + | {{ curChallToAccept.options.abridged || '' }} span {{ curChallToAccept.cadence }} span {{ st.tr["with"] + " " + curChallToAccept.from.name }} + p.text-center(v-if="!!curChallToAccept.color") + | {{ st.tr["Your color:"] + " " + invColor(curChallToAccept.color) }} .diagram( v-if="!!curChallToAccept.fen" v-html="tchallDiag" @@ -34,7 +38,7 @@ main ) .card label#closeNewgame.modal-close(for="modalNewgame") - div(@keyup.enter="newChallenge()") + div(@keyup.enter="issueNewChallenge()") fieldset label(for="selectVariant") {{ st.tr["Variant"] }} * select#selectVariant( @@ -46,7 +50,24 @@ main :value="v.id" :selected="newchallenge.vid==v.id" ) - | {{ v.name }} + | {{ v.display }} + // Variant-specific options (often at least randomness) + fieldset(v-if="!!newchallenge.V && newchallenge.V.Options") + div(v-for="select of newchallenge.V.Options.select || []") + label(:for="select.variable + '_opt'") {{ st.tr[select.label] }} * + select(:id="select.variable + '_opt'") + option( + v-for="o of select.options" + :value="o.value" + :selected="o.value == select.defaut" + ) + | {{ st.tr[o.label] }} + div(v-for="check of newchallenge.V.Options.check || []") + label(:for="check.variable + '_opt'") {{ st.tr[check.label] }} * + input( + :id="check.variable + '_opt'" + type="checkbox" + :checked="check.defaut") fieldset label(for="cadence") {{ st.tr["Cadence"] }} * div#predefinedCadences @@ -60,18 +81,35 @@ main placeholder="5+0, 1h+30s, 5d ..." ) fieldset - label(for="selectRandomLevel") {{ st.tr["Randomness"] }} * - select#selectRandomLevel(v-model="newchallenge.randomness") - option(value="0") {{ st.tr["Deterministic"] }} - option(value="1") {{ st.tr["Symmetric random"] }} - option(value="2") {{ st.tr["Asymmetric random"] }} + label(for="memorizeChall") {{ st.tr["Memorize"] }} + input#memorizeChall( + type="checkbox" + v-model="newchallenge.memorize" + ) fieldset(v-if="st.user.id > 0") - label(for="selectPlayers") {{ st.tr["Play with?"] }} + label(for="selectPlayers") {{ st.tr["Play with"] }} + select#selectPlayersInList( + v-model="newchallenge.to" + @change="changeChallTarget()" + ) + option(value="") + option( + v-for="p in Object.values(people)" + v-if="!!p.name" + :value="p.name" + ) + | {{ p.name }} input#selectPlayers( type="text" v-model="newchallenge.to" ) - fieldset(v-if="st.user.id > 0 && newchallenge.to.length > 0") + fieldset(v-show="st.user.id > 0 && newchallenge.to.length > 0") + label(for="selectColor") {{ st.tr["Color"] }} + select#selectColor(v-model="newchallenge.color") + option(value='') + option(value='w') {{ st.tr["White"] }} + option(value='b') {{ st.tr["Black"] }} + br input#inputFen( placeholder="FEN" @input="trySetNewchallDiag()" @@ -79,10 +117,10 @@ main v-model="newchallenge.fen" ) .diagram(v-html="newchallenge.diag") - button(@click="newChallenge()") {{ st.tr["Send challenge"] }} + button(@click="issueNewChallenge()") {{ st.tr["Send challenge"] }} input#modalPeople.modal( type="checkbox" - @click="resetSocialColor()" + @click="toggleSocialColor()" ) div#peopleWrap( role="dialog" @@ -96,21 +134,22 @@ main v-for="sid in Object.keys(people)" v-if="!!people[sid].name" ) - span {{ people[sid].name }} + UserBio.user-bio(:uid="people[sid].id" :uname="people[sid].name") button.player-action( v-if="isGamer(sid)" @click="watchGame(sid)" ) | {{ st.tr["Observe"] }} button.player-action( - v-else-if="isFocusedOnHall(sid)" + v-else-if="st.user.sid != sid" + :class="{focused: isFocusedOnHall(sid)}" @click="challenge(sid)" ) | {{ st.tr["Challenge"] }} - p.anonymous @nonymous ({{ anonymousCount }}) + p.anonymous @nonymous ({{ anonymousCount() }}) #chat Chat( - :newChat="newChat" + ref="chatcomp" @mychat="processChat" :pastChats="[]" ) @@ -122,6 +161,28 @@ main | {{ st.tr["Who's there?"] }} button(@click="showNewchallengeForm()") | {{ st.tr["New game"] }} + .row(v-if="presetChalls.length > 0") + .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 + h4.text-center {{ st.tr["Preset challenges"] }} + table + thead + tr + th {{ st.tr["Variant"] }} + th {{ st.tr["Cadence"] }} + th {{ st.tr["Options"] }} + th + tbody + // TODO: remove the check !!pc.options + tr( + v-for="pc in presetChalls" + @click="newChallFromPreset(pc)" + v-if="!!pc.options" + ) + td {{ pc.vname }} + td {{ pc.cadence }} + td(:class="getRandomnessClass(pc)") {{ pc.options.abridged || '' }} + td.remove-preset(@click="removePresetChall($event, pc)") + img(src="/images/icons/delete.svg") .row .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 div#div2 @@ -129,7 +190,7 @@ main button.tabbtn#btnClive(@click="setDisplay('c','live',$event)") | {{ st.tr["Live challenges"] }} button.tabbtn#btnCcorr(@click="setDisplay('c','corr',$event)") - | {{ st.tr["Correspondance challenges"] }} + | {{ st.tr["Correspondence challenges"] }} ChallengeList( v-show="cdisplay=='live'" :challenges="filterChallenges('live')" @@ -145,30 +206,37 @@ main button.tabbtn#btnGlive(@click="setDisplay('g','live',$event)") | {{ st.tr["Live games"] }} button.tabbtn#btnGcorr(@click="setDisplay('g','corr',$event)") - | {{ st.tr["Correspondance games"] }} + | {{ st.tr["Correspondence games"] }} GameList( v-show="gdisplay=='live'" :games="filterGames('live')" - :showBoth="true" - @show-game="showGame" - ) - GameList( - v-show="gdisplay=='corr'" - :games="filterGames('corr')" - :showBoth="true" + :show-both="true" @show-game="showGame" ) + div(v-show="gdisplay=='corr'") + GameList( + :games="filterGames('corr')" + :show-both="true" + @show-game="showGame" + ) + button#loadMoreBtn( + v-if="hasMore" + @click="loadMoreCorr()" + ) + | {{ st.tr["Load more"] }}