Update Profile.vue, add Profile Embed to menu

This commit is contained in:
Daniel Supernault 2019-12-05 19:17:55 -07:00
parent eccc84cbdc
commit 477d866b6b
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -422,6 +422,9 @@
<div class="list-group-item cursor-pointer text-center rounded text-dark" @click="copyProfileLink"> <div class="list-group-item cursor-pointer text-center rounded text-dark" @click="copyProfileLink">
Copy Link Copy Link
</div> </div>
<div v-if="profile.locked == false" class="list-group-item cursor-pointer text-center rounded text-dark" @click="showEmbedProfileModal">
Embed
</div>
<div v-if="user && !owner && !relationship.following" class="list-group-item cursor-pointer text-center rounded text-dark" @click="followProfile"> <div v-if="user && !owner && !relationship.following" class="list-group-item cursor-pointer text-center rounded text-dark" @click="followProfile">
Follow Follow
</div> </div>
@ -471,6 +474,21 @@
</p> </p>
</div> </div>
</b-modal> </b-modal>
<b-modal ref="embedModal"
id="ctx-embed-modal"
hide-header
hide-footer
centered
rounded
size="md"
body-class="p-2 rounded">
<div>
<textarea class="form-control disabled" rows="1" style="border: 1px solid #efefef; font-size: 14px; line-height: 12px; height: 37px; margin: 0 0 7px; resize: none; white-space: nowrap;" v-model="ctxEmbedPayload"></textarea>
<hr>
<button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
<p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
</div>
</b-modal>
</div> </div>
</template> </template>
<style type="text/css" scoped> <style type="text/css" scoped>
@ -545,7 +563,9 @@
bookmarksPage: 2, bookmarksPage: 2,
collections: [], collections: [],
collectionsPage: 2, collectionsPage: 2,
isMobile: false isMobile: false,
ctxEmbedPayload: null,
copiedEmbed: false
} }
}, },
beforeMount() { beforeMount() {
@ -1083,6 +1103,8 @@
}, },
statusUrl(status) { statusUrl(status) {
return status.url;
if(status.local == true) { if(status.local == true) {
return status.url; return status.url;
} }
@ -1091,12 +1113,25 @@
}, },
profileUrl(status) { profileUrl(status) {
return status.url;
if(status.local == true) { if(status.local == true) {
return status.account.url; return status.account.url;
} }
return '/i/web/profile/_/' + status.account.id; return '/i/web/profile/_/' + status.account.id;
} },
showEmbedProfileModal() {
this.ctxEmbedPayload = window.App.util.embed.profile(this.profile.url)
this.$refs.embedModal.show();
},
ctxCopyEmbed() {
navigator.clipboard.writeText(this.ctxEmbedPayload);
this.$refs.embedModal.hide();
this.$refs.visitorContextMenu.hide();
},
} }
} }
</script> </script>