Skip to content

Commit

Permalink
Begin implementing subscription refresh timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
kommunarr committed Nov 19, 2023
1 parent c57daa8 commit a550a57
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,28 @@
color: var(--tertiary-text-color);
}

.floatingTopButton {
.refreshSubscriptionsButton {
position: fixed;
inset-block-start: 70px;
inset-inline-end: 10px;
display: flex;
flex-direction: column;
}

.refreshSubscriptionsButton {

}

.lastSubscriptionRefreshTimestamp {
position: absolute;
text-align: center;
inset-block-start: 100px;
inset-inline-end: 0px;
max-inline-size: 80px;
}

@media only screen and (max-width: 350px) {
.floatingTopButton {
.refreshSubscriptionsButton {
position: absolute
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ export default defineComponent({
}
},
computed: {
currentLocale: function () {
return this.$i18n.locale.replace('_', '-')
},

lastSubscriptionRefreshTimestamp: function () {
// note: may need to store base date string and reformat on load,
// as the user can change their locale
return this.$store.getters.getLastSubscriptionRefreshTimestamp
},

activeVideoList: function () {
if (this.videoList.length < this.dataLimit) {
return this.videoList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,23 @@
@click="increaseLimit"
/>
</ft-flex-box>
<ft-icon-button
v-if="!isLoading"
:icon="['fas', 'sync']"
class="floatingTopButton"
:title="$t('Subscriptions.Refresh Subscriptions')"
:size="12"
theme="primary"
@click="$emit('refresh')"
/>
<div class="floatingRefreshSection">
<ft-icon-button
v-if="!isLoading"
:icon="['fas', 'sync']"
class="refreshSubscriptionsButton"
:title="$t('Subscriptions.Refresh Subscriptions')"
:size="12"
theme="primary"
@click="$emit('refresh')"
/>
<p
v-if="lastSubscriptionRefreshTimestamp"
class="lastSubscriptionRefreshTimestamp"
>
{{ lastSubscriptionRefreshTimestamp }}
</p>
</div>
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default defineComponent({
return this.$store.getters.getCurrentInvidiousInstance
},

currentLocale: function () {
return this.$i18n.locale.replace('_', '-')
},

useRssFeeds: function () {
return this.$store.getters.getUseRssFeeds
},
Expand Down Expand Up @@ -155,6 +159,7 @@ export default defineComponent({
return videos
}))).flatMap((o) => o)
videoList.push(...videoListFromRemote)
this.updateLastSubscriptionRefreshTimestamp(new Date().toLocaleDateString(this.currentLocale, { year: '2-digit', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }))

this.videoList = updateVideoListAfterProcessing(videoList)
this.isLoading = false
Expand Down Expand Up @@ -333,6 +338,7 @@ export default defineComponent({
},

...mapActions([
'updateLastSubscriptionRefreshTimestamp',
'updateShowProgressBar',
'updateSubscriptionVideosCacheByChannel',
]),
Expand Down
1 change: 1 addition & 0 deletions src/renderer/store/modules/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const state = {
hideChapters: false,
showDistractionFreeTitles: false,
landingPage: 'subscriptions',
lastSubscriptionRefreshTimestamp: '',
listType: 'grid',
maxVideoPlaybackRate: 3,
playNextVideo: false,
Expand Down

0 comments on commit a550a57

Please sign in to comment.