2017-06-02 20:55:02 +00:00
|
|
|
|
<template lang="pug">
|
2017-08-03 20:04:03 +00:00
|
|
|
|
router-link.card-link(:to="{ name: 'guild', params: { groupId: guild._id } }")
|
|
|
|
|
|
.card
|
2017-11-09 18:37:47 +00:00
|
|
|
|
.card-body
|
2017-08-03 20:04:03 +00:00
|
|
|
|
.row
|
2017-09-14 19:53:27 +00:00
|
|
|
|
.col-md-2.badge-column
|
2018-01-10 00:29:59 +00:00
|
|
|
|
.shield-wrap(:class="{gold: guild.memberCount >= 1000, silver: guild.memberCount >= 100 && guild.memberCount < 1000}")
|
|
|
|
|
|
.svg-icon.shield(v-html="icons.goldGuildBadge", v-if='guild.memberCount >= 1000')
|
|
|
|
|
|
.svg-icon.shield(v-html="icons.silverGuildBadgeIcon", v-if='guild.memberCount >= 100 && guild.memberCount < 1000')
|
2017-09-14 19:53:27 +00:00
|
|
|
|
.svg-icon.shield(v-html="icons.bronzeGuildBadgeIcon", v-if='guild.memberCount < 100')
|
2017-09-25 18:02:12 +00:00
|
|
|
|
.member-count {{ guild.memberCount | abbrNum }}
|
2017-08-03 20:04:03 +00:00
|
|
|
|
.col-md-10
|
|
|
|
|
|
.row
|
|
|
|
|
|
.col-md-8
|
|
|
|
|
|
router-link(:to="{ name: 'guild', params: { groupId: guild._id } }")
|
|
|
|
|
|
h3 {{ guild.name }}
|
2017-09-14 19:53:27 +00:00
|
|
|
|
p.summary(v-if='guild.summary') {{guild.summary.substr(0, MAX_SUMMARY_SIZE_FOR_GUILDS)}}
|
|
|
|
|
|
p.summary(v-else) {{ guild.name }}
|
2017-08-03 20:04:03 +00:00
|
|
|
|
.col-md-2.cta-container
|
2017-11-30 14:16:00 +00:00
|
|
|
|
button.btn.btn-danger(v-if='isMember && displayLeave' @click.prevent='leave()', v-once) {{ $t('leave') }}
|
2017-08-03 20:04:03 +00:00
|
|
|
|
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")
|
2017-08-18 20:29:49 +00:00
|
|
|
|
span.count {{ guild.balance * 4 }}
|
2017-08-03 20:04:03 +00:00
|
|
|
|
div.guild-bank(v-if='displayGemBank', v-once) {{$t('guildBank')}}
|
|
|
|
|
|
.row
|
|
|
|
|
|
.col-md-12
|
2017-09-06 23:28:52 +00:00
|
|
|
|
.category-label(v-for="category in guild.categorySlugs")
|
|
|
|
|
|
| {{$t(category)}}
|
2017-08-03 20:04:03 +00:00
|
|
|
|
span.recommend-text(v-if='showSuggested(guild._id)') Suggested because you’re new to Habitica.
|
2017-06-02 20:55:02 +00:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2017-07-26 15:05:13 +00:00
|
|
|
|
@import '~client/assets/scss/colors.scss';
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
2017-08-03 20:04:03 +00:00
|
|
|
|
.card-link {
|
|
|
|
|
|
color: #4E4A57 !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.card-link:hover {
|
|
|
|
|
|
text-decoration: none !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.card {
|
2017-09-14 19:53:27 +00:00
|
|
|
|
min-height: 160px;
|
2017-07-26 15:05:13 +00:00
|
|
|
|
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;
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.recommend-text {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
font-style: italic;
|
|
|
|
|
|
line-height: 2;
|
|
|
|
|
|
color: $gray-300;
|
|
|
|
|
|
}
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.cta-container {
|
|
|
|
|
|
margin: 0 auto;
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
2017-07-29 22:08:36 +00:00
|
|
|
|
button {
|
|
|
|
|
|
margin-top: 2.5em;
|
2017-07-26 15:05:13 +00:00
|
|
|
|
}
|
2017-07-29 22:08:36 +00:00
|
|
|
|
}
|
2017-07-26 15:05:13 +00:00
|
|
|
|
|
2017-07-29 22:08:36 +00:00
|
|
|
|
.item-with-icon {
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.count {
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
height: 37px;
|
|
|
|
|
|
width: 37px;
|
|
|
|
|
|
margin-left: .2em;
|
|
|
|
|
|
}
|
2017-06-02 20:55:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.shield {
|
|
|
|
|
|
width: 70px;
|
2017-09-14 19:53:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-25 18:02:12 +00:00
|
|
|
|
.gold {
|
|
|
|
|
|
color: #fdbb5a;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.silver {
|
|
|
|
|
|
color: #c2c2c2;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-09-14 19:53:27 +00:00
|
|
|
|
.badge-column {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
|
|
.shield-wrap {
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
height: 70px;
|
|
|
|
|
|
}
|
2017-07-26 15:05:13 +00:00
|
|
|
|
}
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.guild-bank {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.33;
|
|
|
|
|
|
color: $gray-300;
|
|
|
|
|
|
}
|
2017-06-08 19:04:19 +00:00
|
|
|
|
|
2017-07-26 15:05:13 +00:00
|
|
|
|
.member-count {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
top: -3.6em;
|
2017-07-29 22:08:36 +00:00
|
|
|
|
font-size: 22px;
|
2017-07-26 15:05:13 +00:00
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
color: #b36213;
|
2017-07-29 22:08:36 +00:00
|
|
|
|
margin-top: 2.1em;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.gem-bank {
|
|
|
|
|
|
margin-top: 2em;
|
|
|
|
|
|
|
|
|
|
|
|
.gem {
|
|
|
|
|
|
width: 25px;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
vertical-align: bottom;
|
|
|
|
|
|
margin-right: .8em;
|
|
|
|
|
|
}
|
2017-07-26 15:05:13 +00:00
|
|
|
|
}
|
2017-06-02 20:55:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2017-07-26 15:05:13 +00:00
|
|
|
|
import moment from 'moment';
|
2017-06-02 20:55:02 +00:00
|
|
|
|
import { mapState } from 'client/libs/store';
|
|
|
|
|
|
import groupUtilities from 'client/mixins/groupsUtilities';
|
2017-09-13 18:31:23 +00:00
|
|
|
|
import markdown from 'client/directives/markdown';
|
2017-06-08 19:04:19 +00:00
|
|
|
|
import gemIcon from 'assets/svg/gem.svg';
|
2017-08-09 16:56:48 +00:00
|
|
|
|
import goldGuildBadgeIcon from 'assets/svg/gold-guild-badge-large.svg';
|
|
|
|
|
|
import silverGuildBadgeIcon from 'assets/svg/silver-guild-badge-large.svg';
|
|
|
|
|
|
import bronzeGuildBadgeIcon from 'assets/svg/bronze-guild-badge-large.svg';
|
2017-09-14 19:53:27 +00:00
|
|
|
|
import { MAX_SUMMARY_SIZE_FOR_GUILDS } from 'common/script/constants';
|
2017-06-02 20:55:02 +00:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
mixins: [groupUtilities],
|
2017-09-13 18:31:23 +00:00
|
|
|
|
directives: {
|
|
|
|
|
|
markdown,
|
|
|
|
|
|
},
|
2017-06-02 20:55:02 +00:00
|
|
|
|
props: ['guild', 'displayLeave', 'displayGemBank'],
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
...mapState({user: 'user.data'}),
|
|
|
|
|
|
isMember () {
|
|
|
|
|
|
return this.isMemberOfGroup(this.user, this.guild);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2017-06-08 19:04:19 +00:00
|
|
|
|
data () {
|
|
|
|
|
|
return {
|
2017-09-14 19:53:27 +00:00
|
|
|
|
MAX_SUMMARY_SIZE_FOR_GUILDS,
|
2017-06-08 19:04:19 +00:00
|
|
|
|
icons: Object.freeze({
|
|
|
|
|
|
gem: gemIcon,
|
|
|
|
|
|
goldGuildBadge: goldGuildBadgeIcon,
|
2017-08-07 20:26:17 +00:00
|
|
|
|
silverGuildBadgeIcon,
|
|
|
|
|
|
bronzeGuildBadgeIcon,
|
2017-06-08 19:04:19 +00:00
|
|
|
|
}),
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
2017-06-02 20:55:02 +00:00
|
|
|
|
methods: {
|
2017-07-26 15:05:13 +00:00
|
|
|
|
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;
|
|
|
|
|
|
},
|
2017-06-02 20:55:02 +00:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
2018-01-31 10:55:39 +00:00
|
|
|
|
await this.$store.dispatch('guilds:join', {groupId: this.guild._id, type: 'guild'});
|
2017-06-02 20:55:02 +00:00
|
|
|
|
},
|
|
|
|
|
|
async leave () {
|
|
|
|
|
|
// @TODO: ask about challenges when we add challenges
|
2017-11-30 14:16:00 +00:00
|
|
|
|
await this.$store.dispatch('guilds:leave', {groupId: this.guild._id, type: 'myGuilds'});
|
2017-06-02 20:55:02 +00:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|