Skip to content
This repository was archived by the owner on May 24, 2021. It is now read-only.

Commit 60b3f72

Browse files
feat(share-tab): Adapt sharing UI, buttons for volume slider
1 parent 635f225 commit 60b3f72

File tree

12 files changed

+189
-181
lines changed

12 files changed

+189
-181
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@
4242
"deploy:surge": "surge --project ./dist --domain podlove-player.surge.sh"
4343
},
4444
"dependencies": {
45-
"bluebird": "^3.5.0",
45+
"bluebird": "3.5.0",
4646
"clipboard": "1.6.0",
4747
"color": "1.0.3",
4848
"detect-browser": "1.6.2",
49-
"foundation-sites": "^6.3.1",
49+
"foundation-sites": "6.3.1",
5050
"hashcode": "1.0.3",
5151
"howler": "2.0.3",
5252
"iframe-resizer": "3.5.7",
5353
"keyboardjs": "2.3.3",
5454
"lodash": "4.17.4",
55-
"mobile-detect": "^1.3.6",
56-
"normalize.css": "^6.0.0",
55+
"mobile-detect": "1.3.6",
56+
"normalize.css": "6.0.0",
5757
"query-string": "4.3.1",
5858
"redux": "3.5.2",
5959
"revue": "3.0.0",
@@ -64,36 +64,36 @@
6464
"ava": "0.18.2",
6565
"babel-core": "6.22.0",
6666
"babel-loader": "7.0.0",
67-
"babel-plugin-lodash": "^3.2.11",
67+
"babel-plugin-lodash": "3.2.11",
6868
"babel-plugin-transform-runtime": "6.22.0",
6969
"babel-plugin-webpack-alias": "2.1.2",
70-
"babel-preset-bluebird": "^1.0.1",
70+
"babel-preset-bluebird": "1.0.1",
7171
"babel-preset-es2015": "6.22.0",
7272
"babel-preset-stage-2": "6.22.0",
7373
"babel-register": "6.22.0",
7474
"browser-env": "2.0.25",
75-
"compression-webpack-plugin": "^0.4.0",
75+
"compression-webpack-plugin": "0.4.0",
7676
"cross-env": "3.0.0",
7777
"css-loader": "0.25.0",
78-
"file-loader": "^0.11.1",
78+
"file-loader": "0.11.1",
7979
"html-webpack-plugin": "2.26.0",
8080
"inject-loader": "3.0.0-beta4",
81-
"inline-environment-variables-webpack-plugin": "^1.2.0",
81+
"inline-environment-variables-webpack-plugin": "1.2.0",
8282
"lolex": "1.6.0",
8383
"node-sass": "4.1.1",
8484
"nyc": "10.1.2",
8585
"raw-loader": "0.5.1",
8686
"sass-loader": "4.1.1",
87-
"semver": "^5.3.0",
87+
"semver": "5.3.0",
8888
"sinon": "2.1.0",
8989
"surge": "0.18.0",
9090
"transform-runtime": "0.0.0",
9191
"vue-loader": "11.3.4",
9292
"vue-template-compiler": "2.2.6",
9393
"webpack": "2.3.2",
94-
"webpack-bundle-analyzer": "^2.4.0",
94+
"webpack-bundle-analyzer": "2.4.0",
9595
"webpack-dashboard": "0.3.0",
96-
"webpack-dev-server": "2.1.0-beta.9"
96+
"webpack-dev-server": "2.4.5"
9797
},
9898
"engines": {
9999
"node": ">=5.0.0"

src/components/shared/Button.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<button :style="buttonStyle(color)" class="podlove-player--button" @click="click()"><slot></slot></button>
2+
<button :style="buttonStyle(color)" class="podlove-player--button" @click="click && click()"><slot></slot></button>
33
</template>
44

55
<script>

src/components/tabs/settings/Settings.vue

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
<span class="title">Volume</span>
66
<span class="volume">{{decimalToPercent(volume)}}%</span>
77
</h4>
8-
<PodloveSlider min="0" max="1" :value="volume" step="0.001" :onInput="setVolume" :thumbColor="theme.settings.slider.thumb"></PodloveSlider>
8+
<div class="input-slider">
9+
<PodloveButton class="slider-button" :click="changeVolume(volume, -5)" :style="buttonStyle(theme)">-</PodloveButton>
10+
<PodloveButton class="slider-button" :click="changeVolume(volume, 5)" :style="buttonStyle(theme)">+</PodloveButton>
11+
<PodloveSlider class="input-slider" min="0" max="1" :value="volume" step="0.001" :onInput="setVolume" :thumbColor="theme.tabs.slider.thumb"></PodloveSlider>
12+
</div>
913
</div>
1014
<div class="input">
1115
<h4 class="label">
1216
<span class="title">Speed</span>
1317
<span class="rate">{{decimalToPercent(rate)}}%</span>
1418
</h4>
15-
<div class="input--rate">
16-
<PodloveButton class="rate-button" :click="decreaseRate(rate)" :style="buttonStyle(theme)">-</PodloveButton>
17-
<PodloveButton class="rate-button" :click="increaseRate(rate)" :style="buttonStyle(theme)">+</PodloveButton>
18-
<PodloveSlider class="rate--slider" min="0.5" max="4" :value="rate" step="0.001" :onInput="setRate" :thumbColor="theme.settings.slider.thumb"></PodloveSlider>
19+
<div class="input-slider">
20+
<PodloveButton class="slider-button" :click="changeRate(rate, -5)" :style="buttonStyle(theme)">-</PodloveButton>
21+
<PodloveButton class="slider-button" :click="changeRate(rate, 5)" :style="buttonStyle(theme)">+</PodloveButton>
22+
<PodloveSlider class="input-slider" min="0.5" max="4" :value="rate" step="0.001" :onInput="setRate" :thumbColor="theme.tabs.slider.thumb"></PodloveSlider>
1923
</div>
2024
</div>
2125
<div class="footer">
@@ -39,8 +43,8 @@
3943
}
4044
4145
const buttonStyle = (theme) => ({
42-
color: theme.settings.slider.text,
43-
background: theme.settings.slider.button
46+
color: theme.tabs.button.text,
47+
background: theme.tabs.button.background
4448
})
4549
4650
const setVolume = volume => {
@@ -52,62 +56,36 @@
5256
}
5357
5458
const roundUp = (base, number) => {
55-
if (number % base == 0) {
59+
if (number % base === 0) {
5660
return number + base
5761
}
5862
5963
return number + (base - number % base)
6064
}
6165
62-
const increaseRate = (rate) => {
63-
let reference = Date.now()
64-
65-
rate = decimalToPercent(rate)
66-
return () => {
67-
let now = Date.now()
68-
69-
if ((now - reference) < 500) {
70-
store.dispatch(store.actions.setRate(roundUp(10, rate) / 100))
71-
} else {
72-
store.dispatch(store.actions.setRate(roundUp(5, rate) / 100))
73-
}
74-
75-
reference = now
76-
}
66+
const changeRate = (rate, offset) => () => {
67+
store.dispatch(store.actions.setRate(roundUp(offset, (rate * 100)) / 100))
7768
}
7869
79-
const decreaseRate = (rate) => {
80-
let reference = Date.now()
81-
82-
rate = decimalToPercent(rate)
83-
return () => {
84-
let now = Date.now()
85-
86-
if ((now - reference) < 500) {
87-
store.dispatch(store.actions.setRate(roundUp(-10, rate) / 100))
88-
} else {
89-
store.dispatch(store.actions.setRate(roundUp(-5, rate) / 100))
90-
}
91-
92-
reference = now
93-
}
70+
const changeVolume = (volume, offset) => () => {
71+
store.dispatch(store.actions.setVolume(roundUp(offset, (volume * 100)) / 100))
9472
}
9573
9674
export default {
9775
data() {
9876
return {
9977
volume: this.$select('volume'),
10078
rate: this.$select('rate'),
101-
version: this.$select('debug.version'),
79+
version: this.$select('runtime.version'),
10280
theme: this.$select('theme')
10381
}
10482
},
10583
methods: {
10684
exportStore,
10785
setVolume,
10886
setRate,
109-
increaseRate,
110-
decreaseRate,
87+
changeRate,
88+
changeVolume,
11189
buttonStyle,
11290
decimalToPercent
11391
},
@@ -120,6 +98,7 @@
12098

12199
<style lang="scss">
122100
@import 'variables';
101+
@import 'inputs';
123102
124103
$preset-width: 40px;
125104
$button-size: 30px;
@@ -135,11 +114,6 @@
135114
color: rgba($accent-color, 0.25)
136115
}
137116
138-
.input {
139-
border-bottom: 1px dashed rgba($accent-color, 0.2);
140-
padding-bottom: $padding * 2;
141-
}
142-
143117
.footer {
144118
margin-top: $margin;
145119
text-align: right;
@@ -159,17 +133,17 @@
159133
width: $preset-width;
160134
}
161135
162-
.input--rate {
136+
.input-slider {
163137
display: flex;
164138
align-items: center;
165139
}
166140
167-
.rate--slider {
141+
.input-slider {
168142
width: 100%;
169143
margin-left: $margin / 2;
170144
}
171145
172-
.rate-button {
146+
.slider-button {
173147
font-weight: bold;
174148
font-size: 1.2em;
175149
height: $button-size;

0 commit comments

Comments
 (0)