Merge pull request #97 from alectrocute/ui-tweaks

Small UI tweaks (control shortcut on video overlay, select dropdown re-styling)
This commit is contained in:
Nurdism 2020-11-01 05:12:35 -05:00 committed by GitHub
commit ecfd8e9e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 15 deletions

View File

@ -39,11 +39,7 @@
<span>{{ $t('setting.keyboard_layout') }}</span> <span>{{ $t('setting.keyboard_layout') }}</span>
<label class="select"> <label class="select">
<select v-model="keyboard_layout"> <select v-model="keyboard_layout">
<option <option v-for="(name, code) in keyboard_layouts_list" :key="code" :value="code">{{ name }}</option>
v-for="(name, code) in keyboard_layouts_list"
:key="code"
:value="code"
>{{ name }}</option>
</select> </select>
<span /> <span />
</label> </label>
@ -198,20 +194,33 @@
.select { .select {
max-width: 120px; max-width: 120px;
text-align: right;
select:hover {
border: 1px solid $background-secondary;
}
select { select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
display: block; display: block;
width: 100%; width: 100%;
max-width: 100%; max-width: 100%;
padding: 4px; height: 30px;
text-align: right;
padding: 0 5px 0 10px;
margin: 0; margin: 0;
line-height: 30px; line-height: 30px;
font-weight: bold; font-weight: bold;
border: 0; font-size: 12px;
border-radius: 12px; text-overflow: ellipsis;
border: 1px solid transparent;
color: black; border-radius: 5px;
background-color: $style-primary; color: white;
background-color: $background-tertiary;
font-weight: lighter;
cursor: pointer;
option { option {
font-weight: normal; font-weight: normal;

View File

@ -29,6 +29,12 @@
<ul v-if="!fullscreen" class="video-menu"> <ul v-if="!fullscreen" class="video-menu">
<li><i @click.stop.prevent="requestFullscreen" class="fas fa-expand"></i></li> <li><i @click.stop.prevent="requestFullscreen" class="fas fa-expand"></i></li>
<li v-if="admin"><i @click.stop.prevent="onResolution" class="fas fa-desktop"></i></li> <li v-if="admin"><i @click.stop.prevent="onResolution" class="fas fa-desktop"></i></li>
<li class="request-control">
<i
:class="[hosted && !hosting ? 'disabled' : '', !hosted && !hosting ? 'faded' : '', 'fas', 'fa-keyboard']"
@click.stop.prevent="toggleControl"
/>
</li>
</ul> </ul>
<neko-resolution ref="resolution" /> <neko-resolution ref="resolution" />
</div> </div>
@ -64,6 +70,24 @@
text-align: center; text-align: center;
color: rgba($color: #fff, $alpha: 0.6); color: rgba($color: #fff, $alpha: 0.6);
cursor: pointer; cursor: pointer;
&.faded {
color: rgba($color: $text-normal, $alpha: 0.4);
}
&.disabled {
color: rgba($color: $style-error, $alpha: 0.4);
}
}
&.request-control {
display: none;
}
@media (max-width: 768px) {
&.request-control {
display: inline-block;
}
} }
} }
} }
@ -179,6 +203,10 @@
return this.$accessor.remote.hosting return this.$accessor.remote.hosting
} }
get hosted() {
return this.$accessor.remote.hosted
}
get volume() { get volume() {
return this.$accessor.video.volume return this.$accessor.video.volume
} }
@ -328,7 +356,7 @@
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
}) })
this._video.addEventListener('error', event => { this._video.addEventListener('error', (event) => {
this.$log.error(event.error) this.$log.error(event.error)
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
}) })
@ -374,7 +402,7 @@
.then(() => { .then(() => {
this.onResise() this.onResise()
}) })
.catch(err => this.$log.error) .catch((err) => this.$log.error)
} catch (err) { } catch (err) {
this.$log.error(err) this.$log.error(err)
} }
@ -400,6 +428,14 @@
} }
} }
toggleControl() {
if (!this.playable) {
return
}
this.$accessor.remote.toggle()
}
requestFullscreen() { requestFullscreen() {
this._player.requestFullscreen() this._player.requestFullscreen()
this.onResise() this.onResise()
@ -413,7 +449,7 @@
if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') { if (this.hosting && navigator.clipboard && typeof navigator.clipboard.readText === 'function') {
navigator.clipboard navigator.clipboard
.readText() .readText()
.then(text => { .then((text) => {
if (this.clipboard !== text) { if (this.clipboard !== text) {
this.$accessor.remote.setClipboard(text) this.$accessor.remote.setClipboard(text)
this.$accessor.remote.sendClipboard(text) this.$accessor.remote.sendClipboard(text)

View File

@ -60,7 +60,7 @@ export const setting = {
autoplay: 'Autoplay Video', autoplay: 'Autoplay Video',
ignore_emotes: 'Ignore Emotes', ignore_emotes: 'Ignore Emotes',
chat_sound: 'Play Chat Sound', chat_sound: 'Play Chat Sound',
keyboard_layout: 'Change Keyboard Layout', keyboard_layout: 'Keyboard Layout',
} }
export const connection = { export const connection = {