X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=f3c421e6c7c8ff5174ffbc2c0a54589d32103be8;hp=7c3a442de6b47e8fad388fdd153f229dbe6e95c0;hb=2eca7311a1f02285ec875be35cf73b32bdd3b73c;hpb=af041c940f747ecca5d33c42042a62efd9039f10 diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 7c3a442d..f3c421e6 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -10,15 +10,24 @@ main p(v-html="infoMessage") input#modalAccept.modal(type="checkbox") div#acceptDiv(role="dialog") - .card.text-center - p - span.variantName {{ curChallToAccept.vname }} + .card + p.text-center + span.variantName + | {{ curChallToAccept.vname }} + | {{ curChallToAccept.options.abridged || '' }} span {{ curChallToAccept.cadence }} span {{ st.tr["with"] + " " + curChallToAccept.from.name }} - .diagram(v-html="tchallDiag") - .button-group#buttonsTchall - button.acceptBtn(@click="decisionChallenge(true)") {{ st.tr["Accept challenge?"] }} - button.refuseBtn(@click="decisionChallenge(false)") {{ st.tr["Refuse"] }} + p.text-center(v-if="!!curChallToAccept.color") + | {{ st.tr["Your color:"] + " " + invColor(curChallToAccept.color) }} + .diagram( + v-if="!!curChallToAccept.fen" + v-html="tchallDiag" + ) + .button-group#buttonsTchall(:style="tchallButtonsMargin()") + button.acceptBtn(@click="decisionChallenge(true)") + span {{ st.tr["Accept challenge?"] }} + button.refuseBtn(@click="decisionChallenge(false)") + span {{ st.tr["Refuse"] }} input#modalNewgame.modal( type="checkbox" @change="cadenceFocusIfOpened($event)" @@ -29,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( @@ -41,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") + 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 @@ -55,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()" @@ -74,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" @@ -89,23 +132,24 @@ main #players p( v-for="sid in Object.keys(people)" - v-if="people[sid].name" + 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="st.user.id > 0 && sid!=st.user.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="[]" ) @@ -115,8 +159,28 @@ main .button-group button#peopleBtn(onClick="window.doClick('modalPeople')") | {{ st.tr["Who's there?"] }} - button(onClick="window.doClick('modalNewgame')") + 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 + tr( + v-for="pc in presetChalls" + @click="newChallFromPreset(pc)" + ) + 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 @@ -124,7 +188,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')" @@ -140,30 +204,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"] }}