Files
habitica/website/client/components/groups/publicGuildItem.vue
T
Keith Holliday c5e0bcfb0e New client more misc (#8902)
* View party now opens member modal

* Clicking member in header opens member detail modal

* Began sticky header

* Added sleep

* Removed extra inbox and added name styles

* Lint fixes

* Added member filter

* Added task counts

* Updated quest start modal

* Updated members modal style

* Fixed editing party

* Updated tavern

* Updated my guilds

* More guild styles

* Many challenge styles and fixes

* Fixed notification menu display

* Added initial styles to groupplans

* Added syncing with inbox

* Fixed lint

* Added new edit profile layout

* Added initial achievement layout

* Began adding new stats layout

* Removed duplicate:

* fix(CI): attempt to address Travis Mongo connection issue

* fix(CI): don't strand us in Mongo shell

* Travis updates

* Try percise
2017-07-29 16:08:36 -06:00

151 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template lang="pug">
.card
.card-block
.row
.col-md-2
.svg-icon.shield(v-html="icons.goldGuildBadge")
.member-count {{guild.memberCount}}
.col-md-10
.row
.col-md-8
router-link(:to="{ name: 'guild', params: { groupId: guild._id } }")
h3 {{ guild.name }}
p {{ guild.description }}
.col-md-2.cta-container
button.btn.btn-danger(v-if='isMember && displayLeave' @click='leave()', v-once) {{ $t('leave') }}
button.btn.btn-success(v-if='!isMember' @click='join()', v-once) {{ $t('join') }}
div.item-with-icon.gem-bank(v-if='displayGemBank')
.svg-icon.gem(v-html="icons.gem")
span.count {{ guild.balance }}
div.guild-bank(v-if='displayGemBank', v-once) {{$t('guildBank')}}
.row
.col-md-12
.category-label(v-for="category in guild.categories")
| {{category}}
span.recommend-text(v-if='showSuggested(guild._id)') Suggested because youre new to Habitica.
</template>
<style lang="scss" scoped>
@import '~client/assets/scss/colors.scss';
.card {
height: 160px;
border-radius: 4px;
background-color: $white;
box-shadow: 0 2px 2px 0 rgba($black, 0.15), 0 1px 4px 0 rgba($black, 0.1);
margin-bottom: 1rem;
.recommend-text {
font-size: 12px;
font-style: italic;
line-height: 2;
color: $gray-300;
}
.cta-container {
margin: 0 auto;
button {
margin-top: 2.5em;
}
}
.item-with-icon {
.count {
font-size: 20px;
height: 37px;
width: 37px;
margin-left: .2em;
}
}
.shield {
width: 70px;
margin: 0 auto;
margin-top: 2em;
}
.guild-bank {
font-size: 12px;
line-height: 1.33;
color: $gray-300;
}
.member-count {
position: relative;
top: -3.6em;
font-size: 22px;
font-weight: bold;
line-height: 1.2;
text-align: center;
color: #b36213;
margin-top: 2.1em;
}
.gem-bank {
margin-top: 2em;
.gem {
width: 25px;
display: inline-block;
vertical-align: bottom;
margin-right: .8em;
}
}
}
</style>
<script>
import moment from 'moment';
import { mapState } from 'client/libs/store';
import groupUtilities from 'client/mixins/groupsUtilities';
import findIndex from 'lodash/findIndex';
import gemIcon from 'assets/svg/gem.svg';
import goldGuildBadgeIcon from 'assets/svg/gold-guild-badge.svg';
export default {
mixins: [groupUtilities],
props: ['guild', 'displayLeave', 'displayGemBank'],
computed: {
...mapState({user: 'user.data'}),
isMember () {
return this.isMemberOfGroup(this.user, this.guild);
},
},
data () {
return {
icons: Object.freeze({
gem: gemIcon,
goldGuildBadge: goldGuildBadgeIcon,
}),
};
},
methods: {
showSuggested (guildId) {
let habiticaHelpingGuildId = '5481ccf3-5d2d-48a9-a871-70a7380cee5a';
let createdAfterRedesign = moment(this.user.auth.timestamps.created).isAfter('2017-08-01');
return guildId === habiticaHelpingGuildId && createdAfterRedesign;
},
async join () {
// @TODO: This needs to be in the notifications where users will now accept invites
if (this.guild.cancelledPlan && !confirm(window.env.t('aboutToJoinCancelledGroupPlan'))) {
return;
}
await this.$store.dispatch('guilds:join', {guildId: this.guild._id, type: 'myGuilds'});
},
async leave () {
// @TODO: ask about challenges when we add challenges
await this.$store.dispatch('guilds:leave', {guildId: this.guild._id, type: 'myGuilds'});
},
async reject (invitationToReject) {
// @TODO: This needs to be in the notifications where users will now accept invites
let index = findIndex(this.user.invitations.guilds, function findInviteIndex (invite) {
return invite.id === invitationToReject.id;
});
this.user.invitations.guilds = this.user.invitations.guilds.splice(0, index);
await this.$store.dispatch('guilds:rejectInvite', {guildId: invitationToReject.id});
},
},
};
</script>