Skip to content

Commit

Permalink
Add checkbox for hide space
Browse files Browse the repository at this point in the history
  • Loading branch information
bonustrack committed Feb 27, 2021
1 parent 272415f commit 680ab54
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 21 deletions.
18 changes: 11 additions & 7 deletions src/components/Checkbox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<input v-model="input" @input="handleInput" />
<a @click="handleToggle">
<Icon
:name="input ? 'toggle-on' : 'toggle_off'"
:class="input ? 'text-green' : 'border-color'"
size="32"
/>
</a>
</template>

<script>
Expand All @@ -10,18 +16,16 @@ export default {
emits: ['update:modelValue'],
data() {
return {
input: ''
input: false
};
},
created() {
if (this.modelValue) this.input = this.modelValue.toString();
},
methods: {
handleInput() {
const value = ['1', 'yes', 'ok', 'true'].includes(
this.input.trim().toLowerCase()
);
this.$emit('update:modelValue', value);
handleToggle() {
this.input = !this.input;
this.$emit('update:modelValue', this.input);
}
}
};
Expand Down
4 changes: 4 additions & 0 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,7 @@ textarea {
overflow: auto;
white-space: nowrap;
}

.border-color {
color: var(--border-color);
}
20 changes: 11 additions & 9 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ export default {
},
computed: {
spaces() {
const list = Object.keys(this.app.spaces).map(key => {
const spotlightIndex = spotlight.indexOf(key);
return {
...this.app.spaces[key],
favorite: !!this.favoriteSpaces.favorites[key],
isActive: !!this.app.spaces[key]._activeProposals,
spotlight: spotlightIndex === -1 ? 1e3 : spotlightIndex
};
});
const list = Object.keys(this.app.spaces)
.map(key => {
const spotlightIndex = spotlight.indexOf(key);
return {
...this.app.spaces[key],
favorite: !!this.favoriteSpaces.favorites[key],
isActive: !!this.app.spaces[key]._activeProposals,
spotlight: spotlightIndex === -1 ? 1e3 : spotlightIndex
};
})
.filter(space => !space.private);
return orderBy(list, ['favorite', 'spotlight'], ['desc', 'asc']).filter(
space =>
JSON.stringify(space)
Expand Down
13 changes: 8 additions & 5 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
<Icon name="info" size="24" class="text-gray p-1" />
</a>
</UiButton>
<div class="mb-2 d-flex flex-items-center px-2">
<Checkbox v-model="form.private" class="mr-2 mt-1" />
Hide space from homepage
</div>
</div>
</Block>
<Block title="Strategies">
Expand Down Expand Up @@ -149,14 +153,13 @@
<InputNumber v-model="form.filters.minScore" class="input" />
</div>
</UiButton>
<UiButton class="text-left width-full mb-2 d-flex px-3">
<div class="text-gray mr-2">Only members</div>
<div class="mb-2 d-flex flex-items-center px-2">
<Checkbox
v-model="form.filters.onlyMembers"
class="input flex-auto"
:placeholder="`&quot;yes&quot; or &quot;no&quot;`"
class="mr-2 mt-1"
/>
</UiButton>
Show only members proposals
</div>
<UiButton class="d-block width-full px-3" style="height: auto;">
<TextareaArray
v-model="form.filters.invalids"
Expand Down

0 comments on commit 680ab54

Please sign in to comment.