diff --git a/src/components/Audioplayer/RepeatDropdown/index.js b/src/components/Audioplayer/RepeatDropdown/index.js
index 22ae916be..b5ff5d1db 100644
--- a/src/components/Audioplayer/RepeatDropdown/index.js
+++ b/src/components/Audioplayer/RepeatDropdown/index.js
@@ -72,18 +72,27 @@ class RepeatButton extends Component {
setRepeat({
- ...repeat,
- from: parseInt(event.target.value, 10),
- to: parseInt(event.target.value, 10) + 3
- })}
+ onChange={(event) => {
+ let to = parseInt(event.target.value, 10) + 3;
+ to = to < surah.ayat ? to : surah.ayat;
+ setRepeat({
+ ...repeat,
+ from: parseInt(event.target.value, 10),
+ to
+ });
+ }}
>
{
- array.map((ayah, index) => (
-
- ))
+ array.reduce((options, ayah, index) => {
+ if (index + 1 < surah.ayat) { // Exclude last verse
+ options.push(
+
+ );
+ }
+ return options;
+ }, [])
}
@@ -100,11 +109,16 @@ class RepeatButton extends Component {
onChange={event => setRepeat({ ...repeat, to: parseInt(event.target.value, 10) })}
>
{
- array.map((ayah, index) => (
-
- ))
+ array.reduce((options, ayah, index) => {
+ if ((repeat.from ? repeat.from : 1) < index + 1 && index + 1 <= surah.ayat) {
+ options.push(
+
+ );
+ }
+ return options;
+ }, [])
}