Skip to content

Commit

Permalink
Merge pull request #11 from Arzte/show-addons-only
Browse files Browse the repository at this point in the history
Force show requirements only for addons
  • Loading branch information
ltouroumov authored Jul 3, 2024
2 parents 8a07a25 + a33e11d commit 7c1590d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/viewer/ViewAddon.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="obj-addon" :class="{ disabled: !isEnabled }">
<div class="obj-title">{{ addon.title }}</div>
<ViewRequirements :requireds="addon.requireds" />
<ViewRequirements :requireds="addon.requireds" :show-always="true" />
<div class="obj-text">{{ addon.text }}</div>
</div>
</template>
Expand Down
7 changes: 5 additions & 2 deletions components/viewer/ViewRequirement.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
v-if="req.showRequired || !req.id"
v-if="req.showRequired || showAlways"
class="obj-requirement"
:class="{ disabled: !isEnabled }"
>
Expand All @@ -26,7 +26,10 @@ import { buildConditions } from '~/composables/conditions';
import { ConditionTerm } from '~/composables/project';
import { useProjectRefs, useProjectStore } from '~/composables/store/project';

const { req } = defineProps<{ req: ConditionTerm }>();
const { req, showAlways } = defineProps<{
req: ConditionTerm;
showAlways?: boolean;
}>();

const { getObject } = useProjectStore();

Expand Down
9 changes: 7 additions & 2 deletions components/viewer/ViewRequirements.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<template>
<div v-if="requireds.length > 0" class="obj-requirements">
<ViewRequirement v-for="(req, idx) in requireds" :key="idx" :req="req" />
<ViewRequirement
v-for="(req, idx) in requireds"
:key="idx"
:req="req"
:show-always="showAlways"
/>
</div>
</template>

<script setup lang="ts">
import ViewRequirement from '~/components/viewer/ViewRequirement.vue';
import { ConditionTerm } from '~/composables/project';
defineProps<{ requireds: ConditionTerm[] }>();
defineProps<{ requireds: ConditionTerm[]; showAlways?: boolean }>();
</script>

<style lang="scss">
Expand Down

0 comments on commit 7c1590d

Please sign in to comment.