2016-12-29 19:24:08 +00:00
< template lang = "pug" >
2017-03-06 19:09:34 +00:00
. row
2017-07-06 15:38:52 +00:00
. clearfix . col - 8. standard - page
. row
. col - 6. title - details
h1 ( v - once ) { { $t ( 'welcomeToTavern' ) } }
. row . chat - row
. col - 12
2017-08-07 20:26:17 +00:00
h3 ( v - once ) { { $t ( 'tavernChat' ) } }
2017-07-06 15:38:52 +00:00
2017-07-29 22:08:36 +00:00
. row
2017-08-09 16:56:48 +00:00
textarea ( placeholder = "Friendly reminder: this is an all-ages chat, so please keep content and language appropriate! Consult the Community Guidelines in the sidebar if you have questions." , v - model = 'newMessage' , @ keydown = 'updateCarretPosition' )
2017-08-31 22:14:09 +00:00
autocomplete ( : text = 'newMessage' , v - on : select = "selectedAutocomplete" , : coords = 'coords' , : chat = 'group.chat' )
2017-07-29 22:08:36 +00:00
button . btn . btn - secondary . send - chat . float - right ( v - once , @ click = 'sendMessage()' ) { { $t ( 'send' ) } }
2017-08-09 16:56:48 +00:00
button . btn . btn - secondary . float - left ( v - once , @ click = 'fetchRecentMessages()' ) { { $t ( 'fetchRecentMessages' ) } }
2017-07-06 15:38:52 +00:00
2017-07-31 19:54:52 +00:00
. row . community - guidelines ( v - if = '!communityGuidelinesAccepted' )
div . col - 8 ( v - once ) { { $t ( 'communityGuidelinesIntro' ) } }
div . col - 4
button . btn . btn - info ( @ click = 'acceptCommunityGuidelines()' , v - once ) { { $t ( 'acceptCommunityGuidelines' ) } }
2017-07-06 15:38:52 +00:00
2017-07-29 22:08:36 +00:00
. row
2017-09-01 21:26:10 +00:00
. hr . col - 12
2017-07-29 22:08:36 +00:00
chat - message ( : chat . sync = 'group.chat' , : group - id = 'group._id' , group - name = 'group.name' )
2017-07-06 15:38:52 +00:00
. col - md - 4. sidebar
. section
. grassy - meadow - backdrop
2017-08-29 20:23:09 +00:00
. daniel _front
2017-07-06 15:38:52 +00:00
2017-07-29 22:08:36 +00:00
. sleep . below - header - sections
2017-07-06 15:38:52 +00:00
strong ( v - once ) { { $t ( 'sleepDescription' ) } }
2016-12-29 19:24:08 +00:00
ul
2017-07-06 15:38:52 +00:00
li ( v - once ) { { $t ( 'sleepBullet1' ) } }
li ( v - once ) { { $t ( 'sleepBullet2' ) } }
li ( v - once ) { { $t ( 'sleepBullet3' ) } }
li ( v - once ) { { $t ( 'sleepBullet4' ) } }
button . btn . btn - secondary . pause - button ( v - if = '!user.preferences.sleep' , @ click = 'toggleSleep()' , v - once ) { { $t ( 'pauseDailies' ) } }
button . btn . btn - secondary . pause - button ( v - if = 'user.preferences.sleep' , @ click = 'toggleSleep()' , v - once ) { { $t ( 'unpauseDailies' ) } }
2017-07-29 22:08:36 +00:00
. below - header - sections
. section - header
. row
. col - 10
h3 ( v - once ) { { $t ( 'staffAndModerators' ) } }
. col - 2
. toggle - up ( @ click = "sections.staff = !sections.staff" , v - if = "sections.staff" )
. svg - icon ( v - html = "icons.upIcon" )
. toggle - down ( @ click = "sections.staff = !sections.staff" , v - if = "!sections.staff" )
. svg - icon ( v - html = "icons.downIcon" )
. section . row ( v - if = "sections.staff" )
2017-08-29 00:39:32 +00:00
. col - 4. staff ( v - for = 'user in staff' , : class = '{staff: user.type === "Staff", moderator: user.type === "Moderator", bailey: user.name === "It\'s Bailey"}' )
div
. title { { user . name } }
. svg - icon . staff - icon ( v - html = "icons.tierStaff" , v - if = 'user.type === "Staff"' )
. svg - icon . mod - icon ( v - html = "icons.tierMod" , v - if = 'user.type === "Moderator" && user.name !== "It\'s Bailey"' )
. svg - icon . npc - icon ( v - html = "icons.tierNPC" , v - if = 'user.name === "It\'s Bailey"' )
2017-07-29 22:08:36 +00:00
. type { { user . type } }
. section - header
. row
. col - 10
h3 ( v - once ) { { $t ( 'helpfulLinks' ) } }
. col - 2
. toggle - up ( @ click = "sections.helpfulLinks = !sections.helpfulLinks" , v - if = "sections.helpfulLinks" )
. svg - icon ( v - html = "icons.upIcon" )
. toggle - down ( @ click = "sections.helpfulLinks = !sections.helpfulLinks" , v - if = "!sections.helpfulLinks" )
. svg - icon ( v - html = "icons.downIcon" )
. section . row ( v - if = "sections.helpfulLinks" )
ul
li
2017-08-03 20:04:03 +00:00
a ( href = '/static/community-guidelines' , v - once ) { { $t ( 'communityGuidelinesLink' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-09 16:56:48 +00:00
router - link ( to = "/groups/guild/f2db2a7f-13c5-454d-b3ee-ea1f5089e601" ) { { $t ( 'lookingForGroup' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-03 20:04:03 +00:00
a ( href = '/static/faq' , v - once ) { { $t ( 'faq' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-03 20:04:03 +00:00
a ( href = '' , v - html = "$t('glossary')" )
2017-07-29 22:08:36 +00:00
li
2017-08-09 16:56:48 +00:00
a ( href = 'http://habitica.wikia.com/wiki/Habitica_Wiki' , v - once ) { { $t ( 'wiki' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-03 20:04:03 +00:00
a ( href = 'https://oldgods.net/habitrpg/habitrpg_user_data_display.html' , v - once ) { { $t ( 'dataDisplayTool' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-09 16:56:48 +00:00
router - link ( to = "/groups/guild/a29da26b-37de-4a71-b0c6-48e72a900dac" ) { { $t ( 'reportProblem' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-03 20:04:03 +00:00
a ( href = 'https://trello.com/c/odmhIqyW/440-read-first-table-of-contents' , v - once ) { { $t ( 'requestFeature' ) } }
2017-07-29 22:08:36 +00:00
li
2017-08-03 20:04:03 +00:00
a ( href = '' , v - html = "$t('communityForum')" )
2017-07-29 22:08:36 +00:00
li
2017-08-09 16:56:48 +00:00
router - link ( to = "/groups/guild/5481ccf3-5d2d-48a9-a871-70a7380cee5a" ) { { $t ( 'askQuestionGuild' ) } }
2017-07-29 22:08:36 +00:00
. section - header
. row
. col - 10
h3 ( v - once ) { { $t ( 'playerTiers' ) } }
. col - 2
. toggle - up ( @ click = "sections.playerTiers = !sections.playerTiers" , v - if = "sections.playerTiers" )
. svg - icon ( v - html = "icons.upIcon" )
. toggle - down ( @ click = "sections.playerTiers = !sections.playerTiers" , v - if = "!sections.playerTiers" )
. svg - icon ( v - html = "icons.downIcon" )
. section . row ( v - if = "sections.playerTiers" )
. col - 12
p ( v - once ) { { $t ( 'playerTiersDesc' ) } }
ul . tier - list
2017-08-29 00:39:32 +00:00
li . tier1 ( v - once )
| { { $t ( 'tier1' ) } }
. svg - icon ( v - html = "icons.tier1" )
li . tier2 ( v - once )
| { { $t ( 'tier2' ) } }
. svg - icon ( v - html = "icons.tier2" )
li . tier3 ( v - once )
| { { $t ( 'tier3' ) } }
. svg - icon ( v - html = "icons.tier3" )
li . tier4 ( v - once )
| { { $t ( 'tier4' ) } }
. svg - icon ( v - html = "icons.tier4" )
li . tier5 ( v - once )
| { { $t ( 'tier5' ) } }
. svg - icon ( v - html = "icons.tier5" )
li . tier6 ( v - once )
| { { $t ( 'tier6' ) } }
. svg - icon ( v - html = "icons.tier6" )
li . tier7 ( v - once )
| { { $t ( 'tier7' ) } }
. svg - icon ( v - html = "icons.tier7" )
li . moderator ( v - once )
| { { $t ( 'tierModerator' ) } }
. svg - icon ( v - html = "icons.tierMod" )
li . staff ( v - once )
| { { $t ( 'tierStaff' ) } }
. svg - icon ( v - html = "icons.tierStaff" )
li . npc ( v - once )
| { { $t ( 'tierNPC' ) } }
. svg - icon . npc - icon ( v - html = "icons.tierNPC" )
2016-12-29 19:24:08 +00:00
< / template >
2017-07-06 15:38:52 +00:00
< style lang = 'scss' scoped >
@ import '~client/assets/scss/colors.scss' ;
. chat - row {
position : relative ;
. community - guidelines {
background - color : rgba ( 135 , 129 , 144 , 0.84 ) ;
padding : 1 em ;
color : $white ;
position : absolute ;
top : 0 ;
height : 150 px ;
padding - top : 3 em ;
margin - top : 2.3 em ;
2017-07-31 19:54:52 +00:00
width : 100 % ;
2017-07-06 15:38:52 +00:00
border - radius : 4 px ;
}
textarea {
height : 150 px ;
width : 100 % ;
background - color : $white ;
border : solid 1 px $gray - 400 ;
font - size : 16 px ;
font - style : italic ;
line - height : 1.43 ;
color : $gray - 300 ;
padding : .5 em ;
}
. hr {
width : 100 % ;
height : 20 px ;
border - bottom : 1 px solid $gray - 500 ;
text - align : center ;
margin : 2 em 0 ;
}
. hr - middle {
font - size : 16 px ;
font - weight : bold ;
font - family : 'Roboto Condensed' ;
line - height : 1.5 ;
text - align : center ;
color : $gray - 200 ;
background - color : $gray - 700 ;
padding : .2 em ;
margin - top : .2 em ;
display : inline - block ;
width : 100 px ;
}
}
h1 {
color : $purple - 200 ;
}
. sidebar {
background - color : $gray - 600 ;
2017-07-29 22:08:36 +00:00
padding : 0 em ;
. below - header - sections {
padding : 1 em ;
}
2017-07-06 15:38:52 +00:00
}
. toggle - up , . toggle - down {
width : 20 px ;
}
. toggle - up : hover , . toggle - down : hover {
cursor : pointer ;
}
. pause - button {
background - color : # ffb445 ! important ;
color : $white ;
width : 100 % ;
}
. section - header {
margin - top : 2 em ;
}
. grassy - meadow - backdrop {
2017-08-23 03:58:13 +00:00
background - image : url ( '~assets/images/tavern_backdrop_web_backgroundtile.png' ) ;
background - repeat : repeat - x ;
2017-07-29 22:08:36 +00:00
width : 100 % ;
2017-07-06 15:38:52 +00:00
height : 246 px ;
}
2017-08-23 03:58:13 +00:00
. daniel _front {
background - image : url ( '~assets/images/tavern_backdrop_web_daniel_and_props.png' ) ;
height : 246 px ;
2017-08-29 20:23:09 +00:00
width : 471 px ;
background - repeat : no - repeat ;
2017-08-23 03:58:13 +00:00
margin : 0 auto ;
}
2017-07-06 15:38:52 +00:00
. sleep {
margin - top : 1 em ;
}
2017-08-29 00:39:32 +00:00
. npc - icon {
fill : # 77 f4c7 ;
stroke : # 005737 ;
}
2017-07-06 15:38:52 +00:00
. staff {
margin - bottom : 1 em ;
2017-08-29 00:39:32 +00:00
. staff - icon {
fill : # 9 a62ff ;
}
. mod - icon {
fill : # 277 eab ;
}
2017-07-06 15:38:52 +00:00
. title {
color : # 6133 b4 ;
font - weight : bold ;
2017-08-29 00:39:32 +00:00
display : inline - block ;
2017-07-06 15:38:52 +00:00
}
}
2017-08-29 00:39:32 +00:00
. svg - icon {
width : 10 px ;
display : inline - block ;
margin - left : .5 em ;
}
2017-07-06 15:38:52 +00:00
. tier - list {
list - style - type : none ;
padding : 0 ;
width : 98 % ;
li {
border - radius : 2 px ;
background - color : # edecee ;
border : solid 1 px # c3c0c7 ;
text - align : center ;
padding : 1 em ;
margin - bottom : 1 em ;
}
. tier1 {
color : # c42870 ;
}
. tier2 {
color : # b01515 ;
}
. tier3 {
color : # d70e14 ;
}
. tier4 {
color : # c24d00 ;
}
. tier5 {
color : # 9 e650f ;
}
. tier6 {
color : # 2 b8363 ;
}
. tier7 {
color : # 167 e87 ;
}
2017-08-29 20:23:09 +00:00
. tier8 , . moderator {
2017-07-06 15:38:52 +00:00
color : # 277 eab ;
}
2017-08-29 20:23:09 +00:00
. tier9 , . staff {
2017-07-06 15:38:52 +00:00
color : # 6133 b4 ;
}
. npc {
color : $black ;
}
}
. staff . title {
color : # 6133 b4 ;
}
. moderator . title {
color : # 277 eab ;
}
. bailey . title {
color : $black ;
}
< / style >
2016-12-29 19:24:08 +00:00
< script >
2017-07-06 15:38:52 +00:00
import { mapState } from 'client/libs/store' ;
2017-07-21 17:00:36 +00:00
import { TAVERN _ID } from '../../../common/script/constants' ;
import chatMessage from '../chat/chatMessages' ;
2017-07-25 14:24:40 +00:00
import autocomplete from '../chat/autoComplete' ;
2017-07-21 17:00:36 +00:00
2017-07-06 15:38:52 +00:00
import gemIcon from 'assets/svg/gem.svg' ;
import questIcon from 'assets/svg/quest.svg' ;
import challengeIcon from 'assets/svg/challenge.svg' ;
import informationIcon from 'assets/svg/information.svg' ;
import questBackground from 'assets/svg/quest-background-border.svg' ;
import upIcon from 'assets/svg/up.svg' ;
import downIcon from 'assets/svg/down.svg' ;
2017-08-29 00:39:32 +00:00
import tier1 from 'assets/svg/tier-1.svg' ;
import tier2 from 'assets/svg/tier-2.svg' ;
import tier3 from 'assets/svg/tier-3.svg' ;
import tier4 from 'assets/svg/tier-4.svg' ;
import tier5 from 'assets/svg/tier-5.svg' ;
import tier6 from 'assets/svg/tier-6.svg' ;
import tier7 from 'assets/svg/tier-7.svg' ;
import tierMod from 'assets/svg/tier-mod.svg' ;
import tierNPC from 'assets/svg/tier-npc.svg' ;
import tierStaff from 'assets/svg/tier-staff.svg' ;
2017-08-07 20:26:17 +00:00
2016-12-29 19:24:08 +00:00
export default {
2017-07-21 17:00:36 +00:00
components : {
chatMessage ,
2017-07-25 14:24:40 +00:00
autocomplete ,
2017-07-21 17:00:36 +00:00
} ,
2016-12-29 19:24:08 +00:00
data ( ) {
return {
2017-08-07 20:26:17 +00:00
groupId : TAVERN _ID ,
2017-07-06 15:38:52 +00:00
icons : Object . freeze ( {
2017-08-29 00:39:32 +00:00
tier1 ,
tier2 ,
tier3 ,
tier4 ,
tier5 ,
tier6 ,
tier7 ,
tierMod ,
tierNPC ,
tierStaff ,
2017-07-06 15:38:52 +00:00
gem : gemIcon ,
questIcon ,
challengeIcon ,
information : informationIcon ,
questBackground ,
upIcon ,
downIcon ,
} ) ,
group : {
chat : [ ] ,
} ,
sections : {
staff : true ,
2017-07-29 22:08:36 +00:00
helpfulLinks : true ,
playerTiers : true ,
2017-07-06 15:38:52 +00:00
} ,
staff : [
{
name : 'beffymaroo' ,
type : 'Staff' ,
} ,
2017-08-18 18:30:39 +00:00
// {
// name: 'lefnire',
// type: 'Staff',
// },
2017-07-06 15:38:52 +00:00
{
name : 'Lemoness' ,
type : 'Staff' ,
} ,
{
name : 'paglias' ,
type : 'Staff' ,
} ,
{
name : 'redphoenix' ,
type : 'Staff' ,
} ,
{
name : 'SabreCat' ,
type : 'Staff' ,
} ,
{
name : 'TheHollidayInn' ,
type : 'Staff' ,
} ,
{
name : 'viirus' ,
type : 'Staff' ,
} ,
{
name : 'It\'s Bailey' ,
type : 'Moderator' ,
} ,
{
name : 'Alys' ,
type : 'Moderator' ,
} ,
{
name : 'Blade' ,
type : 'Moderator' ,
} ,
{
name : 'Breadstrings' ,
type : 'Moderator' ,
} ,
{
name : 'Cantras' ,
type : 'Moderator' ,
} ,
2017-08-18 18:30:39 +00:00
// {
// name: 'Daniel the Bard',
// type: 'Moderator',
// },
2017-07-06 15:38:52 +00:00
{
name : 'deilann 5.0.5b' ,
type : 'Moderator' ,
} ,
{
name : 'Dewines' ,
type : 'Moderator' ,
} ,
{
name : 'Megan' ,
type : 'Moderator' ,
} ,
{
name : 'shanaqui' ,
type : 'Moderator' ,
} ,
] ,
2017-07-21 17:00:36 +00:00
newMessage : '' ,
2017-08-07 20:26:17 +00:00
coords : {
TOP : 0 ,
LEFT : 0 ,
} ,
2016-12-29 19:24:08 +00:00
} ;
} ,
2017-07-06 15:38:52 +00:00
computed : {
... mapState ( { user : 'user.data' } ) ,
communityGuidelinesAccepted ( ) {
return this . user . flags . communityGuidelinesAccepted ;
} ,
} ,
2017-07-21 17:00:36 +00:00
async mounted ( ) {
this . group = await this . $store . dispatch ( 'guilds:getGroup' , { groupId : TAVERN _ID } ) ;
2017-07-06 15:38:52 +00:00
} ,
2016-12-29 19:24:08 +00:00
methods : {
2017-08-07 20:26:17 +00:00
// https://medium.com/@_jh3y/how-to-where-s-the-caret-getting-the-xy-position-of-the-caret-a24ba372990a
getCoord ( e , text ) {
let carPos = text . selectionEnd ;
let div = document . createElement ( 'div' ) ;
let span = document . createElement ( 'span' ) ;
let copyStyle = getComputedStyle ( text ) ;
[ ] . forEach . call ( copyStyle , ( prop ) => {
div . style [ prop ] = copyStyle [ prop ] ;
} ) ;
div . style . position = 'absolute' ;
document . body . appendChild ( div ) ;
div . textContent = text . value . substr ( 0 , carPos ) ;
span . textContent = text . value . substr ( carPos ) || '.' ;
div . appendChild ( span ) ;
this . coords = {
TOP : span . offsetTop ,
LEFT : span . offsetLeft ,
} ;
document . body . removeChild ( div ) ;
} ,
updateCarretPosition ( eventUpdate ) {
let text = eventUpdate . target ;
this . getCoord ( eventUpdate , text ) ;
} ,
2017-07-25 14:24:40 +00:00
selectedAutocomplete ( newText ) {
this . newMessage = newText ;
} ,
2017-07-06 15:38:52 +00:00
acceptCommunityGuidelines ( ) {
this . $store . dispatch ( 'user:set' , { 'flags.communityGuidelinesAccepted' : true } ) ;
} ,
toggleSleep ( ) {
2017-07-29 22:08:36 +00:00
this . user . preferences . sleep = ! this . user . preferences . sleep ;
2017-07-06 15:38:52 +00:00
this . $store . dispatch ( 'user:sleep' ) ;
2016-12-29 19:24:08 +00:00
} ,
2017-07-21 17:00:36 +00:00
async sendMessage ( ) {
let response = await this . $store . dispatch ( 'chat:postChat' , {
groupId : TAVERN _ID ,
message : this . newMessage ,
} ) ;
this . group . chat . unshift ( response . message ) ;
this . newMessage = '' ;
2017-08-18 18:30:39 +00:00
// @TODO: I would like to not reload everytime we send. Realtime/Firebase?
let chat = await this . $store . dispatch ( 'chat:getChat' , { groupId : this . group . _id } ) ;
this . group . chat = chat ;
2017-07-21 17:00:36 +00:00
} ,
2017-08-09 16:56:48 +00:00
async fetchRecentMessages ( ) {
this . group = await this . $store . dispatch ( 'guilds:getGroup' , { groupId : TAVERN _ID } ) ;
} ,
2016-12-29 19:24:08 +00:00
} ,
} ;
< / script >