1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00
* Changed: The FFZ Control Center's home page now displays a list of new settings when you have new settings, as well as recently updated add-ons. A GitHub link was added as well. The Twitter embed will properly use light theme when appropriate.
* Changed: [Add-Ons](~add_ons) now supports sorting by update time, as well as name.
* Changed: The FFZ Control Center will now appear larger depending on your window size.
* Fixed: The [Add-Ons](~add_ons) list not being properly searchable in the FFZ Control Center.
* Fixed: Appearance of unread counters in the FFZ Control Center's navigation.
* Fixed: Messages not highlighting correctly when a viewer card is open.
This commit is contained in:
SirStendec 2021-03-12 20:16:39 -05:00
parent a91907c869
commit 7428781614
12 changed files with 415 additions and 34 deletions

View file

@ -13,6 +13,133 @@
<section class="tw-pd-t-1 tw-border-t tw-mg-t-1">
<markdown :source="t('home.about', md)" />
</section>
<div
v-if="unseen"
class="tw-pd-t-1 tw-border-t tw-mg-t-1"
>
<h3 class="tw-pd-b-05">
{{ t('home.new-settings', 'New Settings') }}
</h3>
<div class="tw-pd-b-1">
{{ t('home.new-settings.desc', 'These are settings that you haven\'t looked at yet.') }}
</div>
<div
v-for="cat of unseen"
:key="cat.key"
class="tw-mg-b-05"
>
<a
class="tw-strong"
href="#"
@click.prevent="item.requestPage(cat.key)"
>
<span
v-for="(tk,idx) of cat.tokens"
:key="idx"
>
{{ tk.i18n ? t(tk.i18n, tk.title) : tk.title }}
</span>
</a>
<div
v-for="entry of cat.entries"
:key="entry.key"
class="tw-mg-l-2"
>
{{ entry.i18n ? t(entry.i18n, entry.title) : entry.title }}
</div>
</div>
</div>
<div
v-if="addons"
class="tw-pd-t-1 tw-border-t tw-mg-t-1"
>
<h3 class="tw-pd-b-05">
{{ t('home.addon-updates', 'Updated Add-Ons') }}
</h3>
<div class="tw-pd-b-1">
<markdown :source="t('home.addon-updates.desc', 'These add-ons have updated within the past seven days. Check the [changelog](~add_ons.changelog) to see what\'s changed.')" />
</div>
<div
v-for="addon of addons"
:key="addon.key"
class="tw-mg-b-05 tw-flex tw-align-items-center"
>
<div class="tw-card-img--size-4 tw-overflow-hidden tw-mg-r-1">
<img :src="addon.icon" class="tw-image">
</div>
<div>
<a
v-if="addon.enabled && addon.settings"
href="#"
class="tw-strong tw-link--inherit"
@click.prevent="item.requestPage(addon.settings)"
>
{{ addon.name_i18n ? t(addon.name_i18n, addon.name) : addon.name }}
</a>
<div v-else class="tw-strong">
{{ addon.name_i18n ? t(addon.name_i18n, addon.name) : addon.name }}
</div>
<div class="tw-c-text-alt">
<span class="tw-mg-r-1">
{{ t('addon.version', 'Version {version}', addon) }}
</span>
<span>
{{ t('addon.updated', 'Updated: {when,humantime}', {when: addon.updated}) }}
</span>
</div>
</div>
</div>
</div>
<div
v-if="new_addons"
class="tw-pd-t-1 tw-border-t tw-mg-t-1"
>
<h3 class="tw-pd-b-05">
{{ t('home.addon-new', 'New Add-Ons') }}
</h3>
<div class="tw-pd-b-1">
<markdown :source="t('home.addon-new.desc', 'These add-ons were published within the past seven days. Check them out in [Add-Ons](~add_ons).')" />
</div>
<div
v-for="addon of new_addons"
:key="addon.key"
class="tw-mg-b-05 tw-flex tw-align-items-center"
>
<div class="tw-card-img--size-4 tw-overflow-hidden tw-mg-r-1">
<img :src="addon.icon" class="tw-image">
</div>
<div>
<a
v-if="addon.enabled && addon.settings"
href="#"
class="tw-strong tw-link--inherit"
@click.prevent="item.requestPage(addon.settings)"
>
{{ addon.name_i18n ? t(addon.name_i18n, addon.name) : addon.name }}
</a>
<div v-else class="tw-strong">
{{ addon.name_i18n ? t(addon.name_i18n, addon.name) : addon.name }}
</div>
<div class="tw-c-text-alt">
<span class="tw-mg-r-1">
{{ t('addon.version', 'Version {version}', addon) }}
</span>
<span>
{{ t('addon.updated', 'Updated: {when,humantime}', {when: addon.updated}) }}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="tw-mg-l-1 tw-flex-shrink-0 tweet-column">
<div class="tw-flex tw-mg-b-1">
@ -40,7 +167,7 @@
</a>
<a
:data-title="t('home.twitter', 'Twitter')"
class="tw-flex-grow-1 tw-button ffz-tooltip ffz--twitter-button"
class="tw-flex-grow-1 tw-button ffz-tooltip ffz--twitter-button tw-mg-r-1"
href="https://twitter.com/frankerfacez"
target="_blank"
rel="noopener noreferrer"
@ -49,9 +176,25 @@
<figure class="ffz-i-twitter tw-font-size-3" />
</span>
</a>
<a
:data-title="t('home.github', 'GitHub')"
class="tw-flex-grow-1 tw-button ffz-tooltip ffz--github-button"
href="https://github.com/FrankerFaceZ/FrankerFaceZ"
target="_blank"
rel="noopener noreferrer"
>
<span class="tw-button__icon tw-pd-05">
<figure class="ffz-i-github tw-font-size-3" />
</span>
</a>
</div>
<a class="twitter-timeline" data-width="300" data-theme="dark" href="https://twitter.com/FrankerFaceZ?ref_src=twsrc%5Etfw">
<a
:data-theme="theme"
class="twitter-timeline"
data-width="300"
href="https://twitter.com/FrankerFaceZ?ref_src=twsrc%5Etfw"
>
{{ t('home.tweets', 'Tweets by FrankerFaceZ') }}
</a>
</div>
@ -70,10 +213,32 @@ export default {
data() {
return {
md: HOME_MD
md: HOME_MD,
theme: '',
addons: null,
new_addons: null,
unseen: this.item.getUnseen()
}
},
created() {
this.updateAddons();
this.updateTheme();
this.context.context.on('changed:theme.is-dark', this.updateTheme, this);
const ffz = this.context.getFFZ();
ffz.on('main_menu:update-unseen', this.updateUnseen, this);
ffz.on('addons:data-loaded', this.updateAddons, this);
},
beforeDestroy() {
this.context.context.off('changed:theme.is-dark', this.updateTheme, this);
const ffz = this.context.getFFZ();
ffz.off('main_menu:update-unseen', this.updateUnseen, this);
ffz.off('addons:data-loaded', this.updateAddons, this);
},
mounted() {
let el;
document.head.appendChild(el = e('script', {
@ -83,7 +248,54 @@ export default {
src: 'https://platform.twitter.com/widgets.js',
onLoad: () => el.remove()
}));
},
methods: {
updateUnseen() {
this.unseen = this.item.getUnseen();
},
updateAddons() {
const ffz = this.context.getFFZ(),
addon_module = ffz.resolve('addons'),
addons = addon_module?.addons;
const out = [],
new_out = [],
week_ago = Date.now() - (86400 * 7 * 1000);
if ( addons )
for(const [key, addon] of Object.entries(addons)) {
const enabled = addon_module.isAddonEnabled(key),
copy = {
key,
enabled,
icon: addon.icon,
name: addon.name,
name_i18n: addon.name_i18n,
updated: addon.updated,
settings: addon.settings,
version: addon.version
};
if ( addon.created && addon.created >= week_ago )
new_out.push(copy);
if ( addon.updated && addon.updated >= week_ago && enabled ) {
out.push(copy);
}
}
out.sort((a,b) => b.updated - a.updated);
new_out.sort((a,b) => b.created - a.created);
this.addons = out.length ? out : null;
this.new_addons = new_out.length ? new_out : null;
},
updateTheme() {
this.theme = this.context.context.get('theme.is-dark') ? 'dark' : 'light'
}
}
}
</script>