2 lines
8.4 KiB
JavaScript
2 lines
8.4 KiB
JavaScript
import{n,U as a}from"./index-DDNMzpZj.js";import{D as r}from"./DataFilter-CJCQVhjM.js";import{M as l,B as c}from"./BoxSummon-B3nklIl7.js";import{p as d}from"./mixins-CpCP8hE3.js";import"./StarsLine-CReD_mDq.js";import"./StatInput-BU1s-zba.js";const i=()=>({id:0,userId:null,summons:[{},{},{},{},{},{},{},{},{},{},{},{},{},{}],updated:0,found:!0}),u={namespaced:!0,state(){return i()},mutations:{setId(s,t){s.id=t}},actions:{loadSummons({state:s},t){if(!t)Object.assign(s,i());else if(t!==s.userId)return Object.assign(s,i()),this.axios.get("/friendsum/load/"+t).then(e=>{for(;e.data.data.length<s.summons.length;)e.data.data.push({});s.summons=e.data.data,s.id=e.data.gbfid,s.updated=e.data.updated,s.found=!0,s.userId=t}).catch(e=>{s.found=!1,s.userId=t})}}},m=d("friends",u),h=[{name:"Name",isColumn:!0,isFilter:!1,key:"n"},{name:"Rarity",isColumn:!0,isFilter:!0,key:"ri"},{name:"Element",isColumn:!0,isFilter:!0,key:"e"}],f={components:{BoxSummon:c,Modal:l},mixins:[m],head:{title:"Granblue.Party - Friend Summons",desc:"Share your Friend summons and User ID",image:"https://www.granblue.party/img/card_friendsum.jpg",keywords:"friend summons, share"},data(){return{clipboard_text:"",show_help:!1,show_modal:!1,selected_box_index:0,data_model:{e:a.copy(r.e)},loading:!0}},methods:{showModal(s){this.selected_box_index=s,s>7&&(s-=8),s<6?(this.data_model.e.data.forEach(t=>t.checked=!1),this.data_model.e.data[s].checked=!0):this.data_model.e.data.forEach(t=>t.checked=!0),this.show_modal=!0},changeObject(s){const t=this.selected_box_index;a.isEmpty(s)?this.$set(this.summons,t,{}):this.axios.get("/party/summons/"+s).then(e=>this.$set(this.summons,t,e.data)).catch(e=>this.$store.dispatch("addAxiosErrorMessage",e))},clickCopyURL(){const s=window.location.href+"/"+this.$store.getters.getUserId+"#";this.clipboard_text=s;let t=this;this.$nextTick().then(e=>{document.getElementById("clipboardInput").select(),document.execCommand("copy"),t.clipboard_text="",t.$store.dispatch("addMessage",{message:"URL copied to clipboard"})})},clickSave(){let s={gbfid:this.id,data:[]};this.summons.forEach(t=>{a.isEmpty(t)?s.data.push(null):s.data.push({id:t.summonid,uncap:t.stars})}),this.axios.post("/friendsum/save",s).then(t=>this.$store.dispatch("addMessage",{message:"Data saved successfully"})).catch(t=>this.$store.dispatch("addAxiosErrorMessage",t))},loadCollection(){return this.isOwnProfile?this.$store.commit("setPartyMode",this.$MODE.Edit):this.$store.commit("setPartyMode",this.$MODE.ReadOnly),this.$store.dispatch("friends/loadSummons",this.userId)}},computed:{id:{get(){return this.$store.state.friends.id},set(s){this.$store.commit("friends/setId",s)}},userId(){return this.isOwnProfile?this.$store.getters.getUserId:this.$route.params.friend_id},summons(){return this.$store.state.friends.summons},found(){return this.$store.state.friends.found},updated(){return this.$store.state.friends.updated},categories(){return h},isOwnProfile(){return this.$route.params.friend_id===void 0}},watch:{"$store.getters.getUserId"(s){this.loading=!0,this.loadCollection().then(t=>this.loading=!1)},$route(s,t){this.loading=!0,this.loadCollection().then(e=>this.loading=!1)}},serverPrefetch(){return this.loadCollection().then(s=>{this.found&&(this.$ssrContext.head_image="https://www.granblue.party/previews/friendsum/friendsum_"+this.userId+"."+this.updated+".jpg")})},async mounted(){await this.loadCollection().then(s=>this.loading=!1)}};var p=function(){var t=this,e=t._self._c;return e("div",{staticClass:"flex flex-col"},[t.loading===!0?e("div",[t._v(" Loading... ")]):!t.found&&!t.isOwnProfile?e("div",{staticClass:"flex flex-col items-center"},[e("h1",{staticClass:"self-center mb-8"},[t._v("No Friend Summons found")])]):e("div",{staticClass:"flex flex-col items-center"},[t.isOwnProfile?e("h1",{staticClass:"self-center mb-8"},[t._v("My Friend Summons")]):e("h1",{staticClass:"self-center mb-8"},[t._v("Friend Summons for Player ID: "+t._s(t.id))]),t.isOwnProfile?e("div",{staticClass:"flex flex-row flex-wrap gap-2"},[e("button",{staticClass:"btn",class:t.show_help?"btn-blue":"btn-white",on:{click:function(o){t.show_help=!t.show_help}}},[e("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","info-circle"]}}),t._v(" Usage ")],1),t.userId?e("button",{staticClass:"btn btn-blue",on:{click:t.clickCopyURL}},[e("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","share-alt"]}}),t._v(" Share ")],1):t._e(),t.userId?e("button",{staticClass:"btn btn-blue",on:{click:function(o){return t.clickSave()}}},[e("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","save"]}}),t._v(" Save ")],1):t._e(),e("label",[t._v("My ID "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.id,expression:"id"}],staticClass:"input is-small",staticStyle:{width:"15ch"},attrs:{type:"number",min:"1"},domProps:{value:t.id},on:{input:function(o){o.target.composing||(t.id=o.target.value)}}})])]):t._e(),t.show_help?e("div",{staticClass:"bg-secondary rounded p-4 mt-4 shrink"},[e("h2",[t._v("Click on the stars")]),e("p",{staticClass:"pb-4"},[t._v(" You can set the uncap level of the summons by clicking on the stars. ")]),e("h2",[t._v("Share your summons")]),t._m(0)]):t._e(),e("div",{staticClass:"flex flex-row flex-wrap self-center my-8"},[e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-white bg-red-600"},[t._v("Fire")]),e("box-summon",{attrs:{object:t.summons[0],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(0)}}}),e("box-summon",{attrs:{object:t.summons[8],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(8)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-white bg-blue-600"},[t._v("Water")]),e("box-summon",{attrs:{object:t.summons[3],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(3)}}}),e("box-summon",{attrs:{object:t.summons[11],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(11)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-white bg-amber-800"},[t._v("Earth")]),e("box-summon",{attrs:{object:t.summons[2],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(2)}}}),e("box-summon",{attrs:{object:t.summons[10],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(10)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-white bg-emerald-600"},[t._v("Wind")]),e("box-summon",{attrs:{object:t.summons[1],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(1)}}}),e("box-summon",{attrs:{object:t.summons[9],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(9)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-black bg-amber-400"},[t._v("Light")]),e("box-summon",{attrs:{object:t.summons[4],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(4)}}}),e("box-summon",{attrs:{object:t.summons[12],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(12)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-white bg-violet-600"},[t._v("Dark")]),e("box-summon",{attrs:{object:t.summons[5],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(5)}}}),e("box-summon",{attrs:{object:t.summons[13],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(13)}}})],1),e("div",{staticClass:"flex flex-col items-center mr-4"},[e("span",{staticClass:"px-3 py-1 my-1 rounded-full text-black bg-white"},[t._v("Misc")]),e("box-summon",{attrs:{object:t.summons[6],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(6)}}}),e("box-summon",{attrs:{object:t.summons[7],showLevel:!1},on:{"click-portrait":function(o){return t.showModal(7)}}})],1)]),e("modal",{attrs:{route:"/party/summons",categories:t.categories,dataModel:t.data_model},on:{"item-selected":t.changeObject},model:{value:t.show_modal,callback:function(o){t.show_modal=o},expression:"show_modal"}}),e("input",{directives:[{name:"show",rawName:"v-show",value:t.clipboard_text.length>0,expression:"clipboard_text.length > 0"}],attrs:{id:"clipboardInput",readonly:"",type:"text"},domProps:{value:t.clipboard_text}})],1)])},v=[function(){var s=this,t=s._self._c;return t("p",[s._v(' You can share your Friend summons by clicking "Save", then "Share".'),t("br"),s._v(" You need an account to use this feature. ")])}],b=n(f,p,v,!1,null,null);const $=b.exports;export{$ as default};
|