mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-10-14 06:51:58 +00:00
4.45.0
* Added: Emote cards are now at parity with vanilla Twitch emote cards when it comes to displaying Twitch emotes, including the ability to follow/subscribe to the source channel, view their other emotes, and report emotes. * Added: Emote cards for FFZ emotes now allow you to add an emote to any collection you can manage. * Added: Emote cards for other emotes now have an action to open the emote on the source service's webpage. * Fixed: Effect emotes not appearing when used incorrectly in chat. * Fixed: Rebuild the tab-completion emote array in a way more likely to cause Twitch's native input element to update when we change our emotes. * Changed: Use a higher contrast "New" pill when displaying new items in the FFZ Control Center. (Closes #1348) * Changed: Push the modular chat line rendering experiment to 100% roll-out.
This commit is contained in:
parent
53814e7024
commit
880e80388a
25 changed files with 1382 additions and 54 deletions
149
src/std-components/follow-button.vue
Normal file
149
src/std-components/follow-button.vue
Normal file
|
@ -0,0 +1,149 @@
|
|||
<template>
|
||||
<div>
|
||||
<template v-if="error">
|
||||
<button
|
||||
disabled
|
||||
class="tw-button tw-button--disabled"
|
||||
>
|
||||
<span class="tw-button__text">
|
||||
{{ t('follow-btn.error', 'Error') }}
|
||||
</span>
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<button
|
||||
v-if="following"
|
||||
:disabled="loading"
|
||||
:class="{'tw-button--disabled': loading}"
|
||||
:data-title="t('follow-btn.unfollow', 'Unfollow')"
|
||||
class="tw-button tw-button--status tw-button--success ffz-tooltip ffz--featured-button-unfollow"
|
||||
@click="unfollowUser"
|
||||
>
|
||||
<span class="tw-button__icon tw-button__icon--status tw-flex">
|
||||
<figure class="ffz-i-heart ffz--featured-button-unfollow-button" />
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
:disabled="loading"
|
||||
:class="{'tw-button--disabled': loading}"
|
||||
class="tw-button"
|
||||
@click="followUser"
|
||||
>
|
||||
<span class="tw-button__icon tw-button__icon--left">
|
||||
<figure class="ffz-i-heart" />
|
||||
</span>
|
||||
<span class="tw-button__text">
|
||||
{{ t('follow-btn.follow', 'Follow') }}
|
||||
</span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
props: [
|
||||
'channel',
|
||||
'initial',
|
||||
'initial-notif',
|
||||
'show-notif'
|
||||
],
|
||||
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
error: false,
|
||||
following: this.initial,
|
||||
notifications: this.initialNotif
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.twitch_data = FrankerFaceZ.get().resolve('site.twitch_data');
|
||||
|
||||
if ( this.following == null || (this.notifications == null && this.showNotif) )
|
||||
this.checkFollowing();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async checkFollowing() {
|
||||
if ( this.loading )
|
||||
return;
|
||||
|
||||
if ( ! this.twitch_data ) {
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
let following;
|
||||
try {
|
||||
following = await this.twitch_data.getUserFollowed(this.channel);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
this.following = !! following?.followedAt;
|
||||
this.notifications = !! following.disableNotifications;
|
||||
},
|
||||
|
||||
async followUser() {
|
||||
if ( this.loading )
|
||||
return;
|
||||
|
||||
if ( ! this.twitch_data ) {
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
let following;
|
||||
try {
|
||||
following = await this.twitch_data.followUser(this.channel);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
this.following = !! following?.followedAt;
|
||||
this.notifications = !! following.disableNotifications;
|
||||
},
|
||||
|
||||
async unfollowUser() {
|
||||
if ( this.loading )
|
||||
return;
|
||||
|
||||
if ( ! this.twitch_data ) {
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
try {
|
||||
await this.twitch_data.unfollowUser(this.channel);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
this.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = false;
|
||||
this.following = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue