Skip to content

Commit 3deda96

Browse files
committed
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into feat/add-back-stylelint-1
2 parents 88d6728 + 9815ed3 commit 3deda96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+344
-217
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { defineComponent } from 'vue'
2+
3+
export default defineComponent({
4+
name: 'FtAutoLoadNextPageWrapper',
5+
computed: {
6+
generalAutoLoadMorePaginatedItemsEnabled() {
7+
return this.$store.getters.getGeneralAutoLoadMorePaginatedItemsEnabled
8+
},
9+
observeVisibilityOptions() {
10+
if (!this.generalAutoLoadMorePaginatedItemsEnabled) { return false }
11+
12+
return {
13+
callback: (isVisible, _entry) => {
14+
// This is also fired when **hidden**
15+
// No point doing anything if not visible
16+
if (!isVisible) { return }
17+
18+
this.$emit('load-next-page')
19+
},
20+
intersection: {
21+
// Only when it intersects with N% above bottom
22+
rootMargin: '0% 0% 0% 0%',
23+
},
24+
// Callback responsible for loading multiple pages
25+
once: false,
26+
}
27+
},
28+
29+
},
30+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div
3+
class="ft-auto-load-next-page-wrapper"
4+
>
5+
<div
6+
v-observe-visibility="observeVisibilityOptions"
7+
>
8+
<!--
9+
Dummy element to be observed by Intersection Observer
10+
-->
11+
</div>
12+
<slot />
13+
</div>
14+
</template>
15+
16+
<script src="./ft-auto-load-next-page-wrapper.js" />

src/renderer/components/ft-playlist-add-video-prompt/ft-playlist-add-video-prompt.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export default defineComponent({
107107
newPlaylistDefaultProperties: function () {
108108
return this.$store.getters.getNewPlaylistDefaultProperties
109109
},
110-
110+
locale: function () {
111+
return this.$i18n.locale.replace('_', '-')
112+
},
111113
processedQuery: function() {
112114
return this.query.trim().toLowerCase()
113115
},

src/renderer/components/general-settings/general-settings.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ export default defineComponent({
141141
defaultInvidiousInstance: function () {
142142
return this.$store.getters.getDefaultInvidiousInstance
143143
},
144+
generalAutoLoadMorePaginatedItemsEnabled() {
145+
return this.$store.getters.getGeneralAutoLoadMorePaginatedItemsEnabled
146+
},
144147

145148
localeOptions: function () {
146149
return [
@@ -270,7 +273,8 @@ export default defineComponent({
270273
'updateThumbnailPreference',
271274
'updateForceLocalBackendForLegacy',
272275
'updateCurrentLocale',
273-
'updateExternalLinkHandling'
276+
'updateExternalLinkHandling',
277+
'updateGeneralAutoLoadMorePaginatedItemsEnabled',
274278
])
275279
}
276280
})

src/renderer/components/general-settings/general-settings.vue

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
:tooltip="$t('Tooltips.General Settings.Fallback to Non-Preferred Backend on Failure')"
1818
@change="updateBackendFallback"
1919
/>
20+
<ft-toggle-switch
21+
:label="$t('Settings.General Settings.Auto Load Next Page.Label')"
22+
:default-value="generalAutoLoadMorePaginatedItemsEnabled"
23+
:compact="true"
24+
:tooltip="$t('Settings.General Settings.Auto Load Next Page.Tooltip')"
25+
@change="updateGeneralAutoLoadMorePaginatedItemsEnabled"
26+
/>
2027
</div>
2128
<div class="switchColumn">
2229
<ft-toggle-switch

src/renderer/components/player-settings/player-settings.js

-10
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ export default defineComponent({
197197
return this.$store.getters.getScreenshotFilenamePattern
198198
},
199199

200-
commentAutoLoadEnabled: function () {
201-
return this.$store.getters.getCommentAutoLoadEnabled
202-
},
203-
204200
hideComments: function () {
205201
return this.$store.getters.getHideComments
206202
},
@@ -209,11 +205,6 @@ export default defineComponent({
209205
screenshotFolder: function() {
210206
this.getScreenshotFolderPlaceholder()
211207
},
212-
hideComments: function(newValue) {
213-
if (newValue) {
214-
this.updateCommentAutoLoadEnabled(false)
215-
}
216-
}
217208
},
218209
mounted: function() {
219210
this.getScreenshotFolderPlaceholder()
@@ -317,7 +308,6 @@ export default defineComponent({
317308
'updateScreenshotFolderPath',
318309
'updateScreenshotFilenamePattern',
319310
'parseScreenshotCustomFileName',
320-
'updateCommentAutoLoadEnabled',
321311
])
322312
}
323313
})

src/renderer/components/player-settings/player-settings.vue

-8
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,6 @@
255255
</ft-flex-box>
256256
<br>
257257
</div>
258-
<ft-flex-box>
259-
<ft-toggle-switch
260-
:label="$t('Settings.Player Settings.Comment Auto Load.Comment Auto Load')"
261-
:default-value="commentAutoLoadEnabled"
262-
:disabled="hideComments"
263-
@change="updateCommentAutoLoadEnabled"
264-
/>
265-
</ft-flex-box>
266258
</ft-settings-section>
267259
</template>
268260

src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import FtIconButton from '../ft-icon-button/ft-icon-button.vue'
77
import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
88
import FtElementList from '../ft-element-list/ft-element-list.vue'
99
import FtChannelBubble from '../ft-channel-bubble/ft-channel-bubble.vue'
10+
import FtAutoLoadNextPageWrapper from '../ft-auto-load-next-page-wrapper/ft-auto-load-next-page-wrapper.vue'
1011

1112
export default defineComponent({
1213
name: 'SubscriptionsTabUI',
@@ -17,7 +18,8 @@ export default defineComponent({
1718
'ft-icon-button': FtIconButton,
1819
'ft-flex-box': FtFlexBox,
1920
'ft-element-list': FtElementList,
20-
'ft-channel-bubble': FtChannelBubble
21+
'ft-channel-bubble': FtChannelBubble,
22+
'ft-auto-load-next-page-wrapper': FtAutoLoadNextPageWrapper,
2123
},
2224
props: {
2325
isLoading: {

src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue

+11-8
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,19 @@
4545
:use-channels-hidden-preference="false"
4646
:display="isCommunity ? 'list' : ''"
4747
/>
48-
<ft-flex-box
48+
<ft-auto-load-next-page-wrapper
4949
v-if="!isLoading && videoList.length > dataLimit"
50+
@load-next-page="increaseLimit"
5051
>
51-
<ft-button
52-
:label="isCommunity ? $t('Subscriptions.Load More Posts') : $t('Subscriptions.Load More Videos')"
53-
background-color="var(--primary-color)"
54-
text-color="var(--text-with-main-color)"
55-
@click="increaseLimit"
56-
/>
57-
</ft-flex-box>
52+
<ft-flex-box>
53+
<ft-button
54+
:label="isCommunity ? $t('Subscriptions.Load More Posts') : $t('Subscriptions.Load More Videos')"
55+
background-color="var(--primary-color)"
56+
text-color="var(--text-with-main-color)"
57+
@click="increaseLimit"
58+
/>
59+
</ft-flex-box>
60+
</ft-auto-load-next-page-wrapper>
5861
<ft-icon-button
5962
v-if="!isLoading && activeSubscriptionList.length > 0"
6063
:icon="['fas', 'sync']"

src/renderer/components/watch-video-comments/watch-video-comments.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ export default defineComponent({
6363
return this.$store.getters.getHideCommentPhotos
6464
},
6565

66-
commentAutoLoadEnabled: function () {
67-
return this.$store.getters.getCommentAutoLoadEnabled
68-
},
69-
7066
sortNames: function () {
7167
return [
7268
this.$t('Comments.Top comments'),
@@ -85,8 +81,13 @@ export default defineComponent({
8581
return (this.sortNewest) ? 'newest' : 'top'
8682
},
8783

84+
generalAutoLoadMorePaginatedItemsEnabled() {
85+
return this.$store.getters.getGeneralAutoLoadMorePaginatedItemsEnabled
86+
},
8887
observeVisibilityOptions: function () {
89-
if (!this.commentAutoLoadEnabled) { return false }
88+
if (!this.generalAutoLoadMorePaginatedItemsEnabled) {
89+
return false
90+
}
9091
if (!this.videoPlayerReady) { return false }
9192

9293
return {

src/renderer/store/modules/settings.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ const state = {
280280
thumbnailPreference: '',
281281
blurThumbnails: false,
282282
useProxy: false,
283+
userPlaylistSortOrder: 'date_added_descending',
283284
useRssFeeds: false,
284285
useSponsorBlock: false,
285286
videoVolumeMouseScroll: false,
@@ -298,13 +299,13 @@ const state = {
298299
fetchSubscriptionsAutomatically: true,
299300
settingsPassword: '',
300301
allowDashAv1Formats: false,
301-
commentAutoLoadEnabled: false,
302302
useDeArrowTitles: false,
303303
useDeArrowThumbnails: false,
304304
deArrowThumbnailGeneratorUrl: 'https://dearrow-thumb.ajay.app',
305305
// This makes the `favorites` playlist uses as quick bookmark target
306306
// If the playlist is removed quick bookmark is disabled
307307
quickBookmarkTargetPlaylistId: 'favorites',
308+
generalAutoLoadMorePaginatedItemsEnabled: false,
308309
}
309310

310311
const stateWithSideEffects = {

src/renderer/views/Channel/Channel.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import FtAgeRestricted from '../../components/ft-age-restricted/ft-age-restricte
1010
import FtShareButton from '../../components/ft-share-button/ft-share-button.vue'
1111
import FtSubscribeButton from '../../components/ft-subscribe-button/ft-subscribe-button.vue'
1212
import ChannelAbout from '../../components/channel-about/channel-about.vue'
13+
import FtAutoLoadNextPageWrapper from '../../components/ft-auto-load-next-page-wrapper/ft-auto-load-next-page-wrapper.vue'
1314

1415
import autolinker from 'autolinker'
1516
import {
@@ -52,7 +53,8 @@ export default defineComponent({
5253
'ft-age-restricted': FtAgeRestricted,
5354
'ft-share-button': FtShareButton,
5455
'ft-subscribe-button': FtSubscribeButton,
55-
'channel-about': ChannelAbout
56+
'channel-about': ChannelAbout,
57+
'ft-auto-load-next-page-wrapper': FtAutoLoadNextPageWrapper,
5658
},
5759
data: function () {
5860
return {
@@ -292,7 +294,7 @@ export default defineComponent({
292294
})
293295

294296
return values
295-
}
297+
},
296298
},
297299
watch: {
298300
$route() {

src/renderer/views/Channel/Channel.vue

+13-9
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,21 @@
394394
{{ $t("Channel.Your search results have returned 0 results") }}
395395
</p>
396396
</ft-flex-box>
397-
<div
397+
<ft-auto-load-next-page-wrapper
398398
v-if="showFetchMoreButton"
399-
class="getNextPage"
400-
role="button"
401-
tabindex="0"
402-
@click="handleFetchMore"
403-
@keydown.space.prevent="handleFetchMore"
404-
@keydown.enter.prevent="handleFetchMore"
399+
@load-next-page="handleFetchMore"
405400
>
406-
<font-awesome-icon :icon="['fas', 'search']" /> {{ $t("Search Filters.Fetch more results") }}
407-
</div>
401+
<div
402+
class="getNextPage"
403+
role="button"
404+
tabindex="0"
405+
@click="handleFetchMore"
406+
@keydown.space.prevent="handleFetchMore"
407+
@keydown.enter.prevent="handleFetchMore"
408+
>
409+
<font-awesome-icon :icon="['fas', 'search']" /> {{ $t("Search Filters.Fetch more results") }}
410+
</div>
411+
</ft-auto-load-next-page-wrapper>
408412
</div>
409413
</ft-card>
410414
<ft-card

src/renderer/views/Hashtag/Hashtag.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import FtCard from '../../components/ft-card/ft-card.vue'
33
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
44
import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
55
import FtLoader from '../../components/ft-loader/ft-loader.vue'
6+
import FtAutoLoadNextPageWrapper from '../../components/ft-auto-load-next-page-wrapper/ft-auto-load-next-page-wrapper.vue'
67
import packageDetails from '../../../../package.json'
78
import { getHashtagLocal, parseLocalListVideo } from '../../helpers/api/local'
89
import { copyToClipboard, setPublishedTimestampsInvidious, showToast } from '../../helpers/utils'
@@ -15,7 +16,8 @@ export default defineComponent({
1516
'ft-card': FtCard,
1617
'ft-element-list': FtElementList,
1718
'ft-flex-box': FtFlexBox,
18-
'ft-loader': FtLoader
19+
'ft-loader': FtLoader,
20+
'ft-auto-load-next-page-wrapper': FtAutoLoadNextPageWrapper,
1921
},
2022
data: function() {
2123
return {
@@ -38,7 +40,7 @@ export default defineComponent({
3840

3941
showFetchMoreButton() {
4042
return !isNullOrEmpty(this.hashtagContinuationData) || this.apiUsed === 'invidious'
41-
}
43+
},
4244
},
4345
watch: {
4446
$route() {

src/renderer/views/Hashtag/Hashtag.vue

+14-9
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@
2222
{{ $t("Hashtag.This hashtag does not currently have any videos") }}
2323
</p>
2424
</ft-flex-box>
25-
<div
25+
26+
<ft-auto-load-next-page-wrapper
2627
v-if="showFetchMoreButton"
27-
class="getNextPage"
28-
role="button"
29-
tabindex="0"
30-
@click="handleFetchMore"
31-
@keydown.space.prevent="handleFetchMore"
32-
@keydown.enter.prevent="handleFetchMore"
28+
@load-next-page="handleFetchMore"
3329
>
34-
<font-awesome-icon :icon="['fas', 'search']" /> {{ $t("Search Filters.Fetch more results") }}
35-
</div>
30+
<div
31+
class="getNextPage"
32+
role="button"
33+
tabindex="0"
34+
@click="handleFetchMore"
35+
@keydown.space.prevent="handleFetchMore"
36+
@keydown.enter.prevent="handleFetchMore"
37+
>
38+
<font-awesome-icon :icon="['fas', 'search']" /> {{ $t("Search Filters.Fetch more results") }}
39+
</div>
40+
</ft-auto-load-next-page-wrapper>
3641
</ft-card>
3742
</div>
3843
</template>

src/renderer/views/History/History.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FtFlexBox from '../../components/ft-flex-box/ft-flex-box.vue'
66
import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
77
import FtButton from '../../components/ft-button/ft-button.vue'
88
import FtInput from '../../components/ft-input/ft-input.vue'
9+
import FtAutoLoadNextPageWrapper from '../../components/ft-auto-load-next-page-wrapper/ft-auto-load-next-page-wrapper.vue'
910

1011
export default defineComponent({
1112
name: 'History',
@@ -15,7 +16,8 @@ export default defineComponent({
1516
'ft-flex-box': FtFlexBox,
1617
'ft-element-list': FtElementList,
1718
'ft-button': FtButton,
18-
'ft-input': FtInput
19+
'ft-input': FtInput,
20+
'ft-auto-load-next-page-wrapper': FtAutoLoadNextPageWrapper,
1921
},
2022
data: function () {
2123
return {
@@ -38,7 +40,7 @@ export default defineComponent({
3840
} else {
3941
return this.historyCacheSorted.slice(0, this.dataLimit)
4042
}
41-
}
43+
},
4244
},
4345
watch: {
4446
query() {

0 commit comments

Comments
 (0)