Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(chapters): Fixing various bugs related to chapters control
Browse files Browse the repository at this point in the history
- Fixes chapter skippers podlove#390
- Fixes iOS iframe width problem podlove#389
- Adds border to embedded tabs podlove#388
- Show progress bar and chapter controls on restore podlove#390
- Rework responsive break points podlove#396
  • Loading branch information
alexander-heimbuch committed Jun 17, 2017
1 parent df9eafd commit 2d5e061
Show file tree
Hide file tree
Showing 50 changed files with 591 additions and 312 deletions.
6 changes: 5 additions & 1 deletion src/components/header/Info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}
}
@media screen and (max-width: $width-l) {
@media screen and (max-width: $width-m) {
.info {
flex-direction: column;
text-align: center;
Expand All @@ -98,6 +98,10 @@
margin: 0 0 $margin 0;
justify-content: center;
}
.poster-container {
width: calc(100px + 3em); // Height of description
}
}
}
</style>
12 changes: 12 additions & 0 deletions src/components/icons/AudioIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24">
<path :fill="color" d="M9 18h-7v-12h7v12zm2-12v12l11 6v-24l-11 6z"/>
</svg>
</template>

<script>
export default {
props: ['color']
}
</script>

19 changes: 11 additions & 8 deletions src/components/player/control-bar/ChapterBackButton.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<ButtonComponent class="chapter-control" :click="onButtonClick">
<ButtonComponent class="chapter-control" :click="onButtonClick" :disabled="playtime === 0">
<ChapterBackIcon :color="theme.player.actions.background" />
</ButtonComponent>
</template>

<script>
import { previousChapterPlaytime } from 'utils/chapters'
import { currentChapter, currentChapterIndex } from 'utils/chapters'
import store from 'store'
import ButtonComponent from 'shared/Button.vue'
Expand All @@ -19,16 +19,19 @@
data () {
return {
chapters: this.$select('chapters'),
theme: this.$select('theme')
theme: this.$select('theme'),
playtime: this.$select('playtime')
}
},
methods: {
onButtonClick () {
const chapters = this.$select('chapters')
const playtime = this.$select('playtime')
const previousChapter = previousChapterPlaytime(chapters, playtime)
store.dispatch(store.actions.updatePlaytime(previousChapter || 0))
const current = currentChapter(this.chapters)
const currentIndex = currentChapterIndex(this.chapters)
if (this.playtime - current.start <= 2) {
store.dispatch(store.actions.previousChapter())
} else {
store.dispatch(store.actions.setChapter(currentIndex))
}
}
}
}
Expand Down
14 changes: 5 additions & 9 deletions src/components/player/control-bar/ChapterNextButton.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<template>
<ButtonComponent class="chapter-control" :click="onButtonClick">
<ButtonComponent class="chapter-control" :click="onButtonClick" :disabled="playtime === duration">
<ChapterNextIcon :color="theme.player.actions.background" />
</ButtonComponent>
</template>

<script>
import { nextChapterPlaytime } from 'utils/chapters'
import store from 'store'
import ButtonComponent from 'shared/Button.vue'
import ChapterNextIcon from 'icons/ChapterNextIcon.vue'
Expand All @@ -19,16 +17,14 @@
data () {
return {
chapters: this.$select('chapters'),
theme: this.$select('theme')
theme: this.$select('theme'),
playtime: this.$select('playtime'),
duration: this.$select('duration')
}
},
methods: {
onButtonClick () {
const chapters = this.$select('chapters')
const duration = this.$select('duration')
const nextChapter = nextChapterPlaytime(chapters)
store.dispatch(store.actions.updatePlaytime(nextChapter || duration))
store.dispatch(store.actions.nextChapter())
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<ShareIcon slot="icon"></ShareIcon>
<span slot="title">{{ $t('SHARE.TITLE') }}</span>
</TabHeaderItemComponent>
<TabHeaderItemComponent :active="tabs.settings" v-if="components.tabs.settings" :click="toggleTab('settings')">
<SettingsIcon slot="icon"></SettingsIcon>
<span slot="title">{{ $t('SETTINGS.TITLE') }}</span>
<TabHeaderItemComponent :active="tabs.audio" v-if="components.tabs.audio" :click="toggleTab('audio')">
<AudioIcon slot="icon"></AudioIcon>
<span slot="title">{{ $t('AUDIO.TITLE') }}</span>
</TabHeaderItemComponent>
</TabHeaderComponent>
<TabBodyComponent :active="tabs.chapters" v-if="components.tabs.chapters">
Expand All @@ -20,8 +20,8 @@
<TabBodyComponent :active="tabs.share" v-if="components.tabs.share">
<ShareTab />
</TabBodyComponent>
<TabBodyComponent :active="tabs.settings" v-if="components.tabs.settings">
<SettingsTab />
<TabBodyComponent :active="tabs.audio" v-if="components.tabs.audio">
<AudioTab />
</TabBodyComponent>
</div>
</template>
Expand All @@ -35,11 +35,11 @@ import TabBodyComponent from 'shared/TabBody.vue'
import ChaptersIcon from 'icons/ChaptersIcon.vue'
import ShareIcon from 'icons/ShareIcon.vue'
import SettingsIcon from 'icons/SettingsIcon.vue'
import AudioIcon from 'icons/AudioIcon.vue'
import ChaptersTab from './chapters/Chapters.vue'
import ShareTab from './share/Share.vue'
import SettingsTab from './settings/Settings.vue'
import AudioTab from './audio/Audio.vue'
const containerStyle = theme => ({
'background-color': theme.tabs.body.background
Expand Down Expand Up @@ -71,8 +71,8 @@ export default {
ChaptersTab,
ShareIcon,
ShareTab,
SettingsIcon,
SettingsTab
AudioIcon,
AudioTab
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="settings">
<SettingsVolumeComponent class="seperator"/>
<SettingsRateComponent class="seperator"/>
<div class="audio">
<AudioVolumeComponent class="seperator"/>
<AudioRateComponent class="seperator"/>
<div class="footer">
<a class="version" title="Export Debug" :href="exportStore()" download="web-player-debug.json">Podlove Web Player v{{version}}</a>
</div>
Expand All @@ -11,8 +11,8 @@
<script>
import store from 'store'
import SettingsRateComponent from './SettingsRate.vue'
import SettingsVolumeComponent from './SettingsVolume.vue'
import AudioRateComponent from './AudioRate.vue'
import AudioVolumeComponent from './AudioVolume.vue'
// Template Functions
const exportStore = () =>
Expand All @@ -28,8 +28,8 @@
exportStore
},
components: {
SettingsRateComponent,
SettingsVolumeComponent
AudioRateComponent,
AudioVolumeComponent
}
}
</script>
Expand All @@ -38,7 +38,7 @@
@import 'variables';
@import 'inputs';
.settings {
.audio {
width: 100%;
.footer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="input-element">
<h4 class="title">
<span class="label">{{ $t('SETTINGS.SPEED') }}</span>
<span class="label">{{ $t('AUDIO.SPEED') }}</span>
<span class="rate">{{ toPercent(rate) }}%</span>
</h4>
<div class="input-slider">
Expand Down Expand Up @@ -116,7 +116,7 @@
@import 'variables';
@import 'inputs';
.settings {
.audio {
.title {
display: flex;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="input-element">
<h4 class="title">
<span class="label">{{ $t('SETTINGS.VOLUME') }}</span>
<span class="label">{{ $t('AUDIO.VOLUME') }}</span>
<span class="volume">{{ toPercent(volume) }}%</span>
</h4>
<div class="input-slider">
Expand Down Expand Up @@ -75,7 +75,7 @@
$mute-control-width: calc(60px + #{$padding});
.settings {
.audio {
.title {
display: flex;
justify-content: space-between;
Expand Down
9 changes: 4 additions & 5 deletions src/components/tabs/chapters/ChapterEntry.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="chapters--entry" :style="chapterStyle(theme, chapter)" @click="onChapterClick(chapter)">
<div class="chapters--entry" :style="chapterStyle(theme, chapter)" @click="onChapterClick(index)">
<span class="index">{{index + 1}}</span>
<span class="title truncate">{{chapter.title}}</span>
<span class="timer">{{remainingTime(chapter, playtime)}}</span>
Expand All @@ -11,7 +11,7 @@
<script>
import color from 'color'
import store from 'store'
import {secondsToTime} from 'utils/time'
import { secondsToTime } from 'utils/time'
const chapterStyle = (theme, chapter) => {
const style = {}
Expand Down Expand Up @@ -45,9 +45,8 @@
return secondsToTime(chapter.end - chapter.start)
}
const onChapterClick = chapter => {
store.dispatch(store.actions.updatePlaytime(chapter.start))
store.dispatch(store.actions.setPlaytime(chapter.start))
const onChapterClick = index => {
store.dispatch(store.actions.setChapter(index))
}
export default {
Expand Down
6 changes: 2 additions & 4 deletions src/components/tabs/share/ShareDownload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a class="button input-button truncate"
:href="activeAudioFile(share.download.files)"
:style="buttonStyle(theme)">
<DownloadIcon :color="theme.tabs.button.text" />
{{ $t('SHARE.ACTIONS.DOWNLOAD') }}
</a>
<input type="text" class="input-text" disabled :style="inputStyle(theme)" :value="activeAudioFile(share.download.files)" />
</div>
Expand All @@ -29,7 +29,6 @@
import store from 'store'
import { compose, find, get } from 'lodash/fp'
import DownloadIcon from 'icons/DownloadIcon.vue'
import ButtonComponent from 'shared/Button.vue'
const buttonStyle = (theme) => ({
Expand Down Expand Up @@ -64,8 +63,7 @@
switchAudioType
},
components: {
ButtonComponent,
DownloadIcon
ButtonComponent
}
}
</script>
Expand Down
6 changes: 2 additions & 4 deletions src/components/tabs/share/ShareEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:data-clipboard-text="clipboardContent(reference, share.embed, playtime)"
v-clipboard
:style="buttonStyle(theme)">
<CopyIcon :color="theme.tabs.button.text"/>
{{ $t('SHARE.ACTIONS.COPY') }}
</ButtonComponent>
<input type="text" class="input-text" :style="inputStyle(theme)" disabled :value="clipboardContent(reference, share.embed, playtime)" />
</div>
Expand Down Expand Up @@ -36,7 +36,6 @@
import { secondsToTime, timeToSeconds } from 'utils/time'
import ButtonComponent from 'shared/Button.vue'
import CopyIcon from 'icons/CopyIcon.vue'
const buttonStyle = (theme) => ({
color: theme.tabs.button.text,
Expand Down Expand Up @@ -108,8 +107,7 @@
setStarttime
},
components: {
ButtonComponent,
CopyIcon
ButtonComponent
}
}
</script>
Expand Down
6 changes: 2 additions & 4 deletions src/components/tabs/share/ShareLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:data-clipboard-text="clipboardContent(reference, share.link, playtime)"
v-clipboard
:style="buttonStyle(theme)">
<CopyIcon :color="theme.tabs.button.text" />
{{ $t('SHARE.ACTIONS.COPY') }}
</ButtonComponent>
<input type="text" class="input-text" disabled :style="inputStyle(theme)" :value="clipboardContent(reference, share.link, playtime)" />
</div>
Expand All @@ -27,7 +27,6 @@
import store from 'store'
import ButtonComponent from 'shared/Button.vue'
import CopyIcon from 'icons/CopyIcon.vue'
import { addQueryParameter } from 'utils/url'
import { secondsToTime, timeToSeconds } from 'utils/time'
Expand Down Expand Up @@ -94,8 +93,7 @@
setStarttime
},
components: {
ButtonComponent,
CopyIcon
ButtonComponent
}
}
</script>
Expand Down
8 changes: 7 additions & 1 deletion src/embed/embed.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { get, head, isString } from 'lodash'
import Bluebird from 'bluebird'
import browser from 'detect-browser'

import { findNode, createNode, appendNode, tag } from 'utils/dom'
import requestConfig from 'utils/request'
Expand All @@ -13,7 +14,10 @@ import iframeResizerContentWindow from 'raw-loader!iframe-resizer/js/iframeResiz
const playerSandbox = anchor => {
const frame = createNode('iframe')

frame.setAttribute('width', '100%')
if (browser.name !== 'ios') {
frame.setAttribute('width', '100%')
}

frame.setAttribute('seamless', '')
frame.setAttribute('scrolling', 'no')
frame.setAttribute('frameborder', '0')
Expand Down Expand Up @@ -49,6 +53,8 @@ const getPodloveStore = sandbox =>
const preloader = sandbox => ({
init: () => {
sandbox.style.opacity = 0
// maximum width player
sandbox.style['max-width'] = '768px'
sandbox.style.transition = 'all 500ms'
},
done: () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"DOWNLOAD": "download"
}
},
"SETTINGS": {
"TITLE": "Einstellung",
"AUDIO": {
"TITLE": "Audio",
"VOLUME": "Lautstärke",
"SPEED": "Geschwindigkeit",
"DEBUG_STATE": "Debug State exportieren"
Expand Down
4 changes: 2 additions & 2 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"DOWNLOAD": "download"
}
},
"SETTINGS": {
"TITLE": "Settings",
"AUDIO": {
"TITLE": "Audio",
"VOLUME": "Volume",
"SPEED": "Speed",
"DEBUG_STATE": "Export Debug State"
Expand Down
Loading

0 comments on commit 2d5e061

Please sign in to comment.