2017-11-13 01:23:39 -05:00
|
|
|
<template lang="html">
|
2018-03-30 17:58:56 -04:00
|
|
|
<div v-if="item.contents" :class="classes">
|
2020-08-17 13:33:30 -04:00
|
|
|
<header v-if="! item.no_header" class="tw-font-size-5">
|
2019-10-04 14:57:13 -04:00
|
|
|
{{ t(item.i18n_key, item.title) }}
|
2018-03-30 17:58:56 -04:00
|
|
|
</header>
|
|
|
|
<section
|
|
|
|
v-if="item.description"
|
2020-08-17 13:33:30 -04:00
|
|
|
class="tw-pd-b-1 tw-c-text-alt"
|
2019-06-20 15:15:54 -04:00
|
|
|
>
|
2019-10-04 14:57:13 -04:00
|
|
|
<markdown :source="t(item.desc_i18n_key, item.description)" />
|
2019-06-20 15:15:54 -04:00
|
|
|
</section>
|
2018-07-05 20:27:17 -04:00
|
|
|
<div
|
2021-05-13 15:54:21 -04:00
|
|
|
v-for="i in visibleContents"
|
2018-03-30 17:58:56 -04:00
|
|
|
:key="i.full_key"
|
2018-07-05 20:27:17 -04:00
|
|
|
:class="{'ffz-unmatched-item': showing && ! shouldShow(i)}"
|
|
|
|
>
|
|
|
|
<component
|
|
|
|
:is="i.component"
|
|
|
|
:context="context"
|
|
|
|
:item="i"
|
|
|
|
:filter="filter"
|
2019-06-01 02:11:22 -04:00
|
|
|
@navigate="navigate"
|
2018-07-05 20:27:17 -04:00
|
|
|
/>
|
|
|
|
</div>
|
2018-03-30 17:58:56 -04:00
|
|
|
</div>
|
2017-11-13 01:23:39 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2018-07-05 20:27:17 -04:00
|
|
|
props: ['item', 'context', 'filter'],
|
2017-11-13 01:23:39 -05:00
|
|
|
|
|
|
|
computed: {
|
2018-07-05 20:27:17 -04:00
|
|
|
showing() {
|
|
|
|
return this.shouldShow(this.item);
|
|
|
|
},
|
|
|
|
|
2021-05-13 15:54:21 -04:00
|
|
|
visibleContents() {
|
|
|
|
if ( ! this.item || ! this.item.contents )
|
|
|
|
return [];
|
|
|
|
|
|
|
|
if ( ! this.context.matches_only )
|
|
|
|
return this.item.contents;
|
|
|
|
|
|
|
|
return this.item.contents.filter(item => this.shouldShow(item));
|
|
|
|
},
|
|
|
|
|
2017-11-13 01:23:39 -05:00
|
|
|
classes() {
|
|
|
|
return [
|
|
|
|
'ffz--menu-container',
|
2017-12-13 17:35:20 -05:00
|
|
|
this.item.full_box ? 'tw-border' : 'tw-border-t'
|
2017-11-13 01:23:39 -05:00
|
|
|
]
|
|
|
|
}
|
2018-07-05 20:27:17 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2019-06-01 02:11:22 -04:00
|
|
|
navigate(...args) {
|
|
|
|
this.$emit('navigate', ...args);
|
|
|
|
},
|
|
|
|
|
2023-11-06 20:47:19 -05:00
|
|
|
shouldShow(item, is_walking = false) {
|
2024-02-06 22:49:45 -07:00
|
|
|
if ( item.no_filter )
|
2018-07-05 20:27:17 -04:00
|
|
|
return true;
|
|
|
|
|
2024-02-06 22:49:45 -07:00
|
|
|
if ( this.context.simple_view ) {
|
|
|
|
for(const key of ['tabs', 'contents', 'items'])
|
|
|
|
if ( item[key] )
|
|
|
|
for(const thing of item[key])
|
|
|
|
if ( this.shouldShow(thing) )
|
|
|
|
return true;
|
|
|
|
if ( ! item.setting || ! item.simple )
|
|
|
|
return false;
|
|
|
|
}
|
2024-02-06 22:28:50 -07:00
|
|
|
|
2024-02-06 22:49:45 -07:00
|
|
|
if ( ! this.filter )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ( this.filter.flags ) {
|
2023-11-06 20:47:19 -05:00
|
|
|
if ( this.filter.flags.has('modified') ) {
|
|
|
|
// We need to tree walk for this one.
|
|
|
|
if ( ! is_walking ) {
|
|
|
|
for(const key of ['tabs', 'contents', 'items'])
|
|
|
|
if ( item[key] )
|
|
|
|
for(const thing of item[key])
|
|
|
|
if ( this.shouldShow(thing) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! item.setting || ! this.context.currentProfile.has(item.setting) )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( this.filter.query ) {
|
|
|
|
if ( ! item.search_terms || ! item.search_terms.includes(this.filter.query) )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2018-07-05 20:27:17 -04:00
|
|
|
}
|
2017-11-13 01:23:39 -05:00
|
|
|
}
|
|
|
|
}
|
2024-02-06 22:28:50 -07:00
|
|
|
</script>
|