search_ui/components/entity/components/EntityShare.vue
2025-02-01 14:36:10 +03:30

224 lines
7.3 KiB
Vue

<template>
<div>
<!-- <h5 class="title p-2">
{{ sectionItem.qanon_title }}
</h5>
<p class="description">
{{ sectionItem.main_type }}
</p> -->
<div v-if="shareText" class="d-flex align-items-center">
<button-component
title="کپی نشانی"
buttonText=""
classes="color-1 mb-2"
@click="copyToClip(shareText)"
>
<svg class="icon icon-copy2 fz-8">
<use xlink:href="#icon-copy2"></use>
</svg>
{{ shareText }}
</button-component>
</div>
<button-component
v-if="shareLink"
title="کپی پیوند"
buttonText=""
classes="color-1 mb-2"
@click="copyToClip(shareLink)"
>
<svg class="icon icon-copy2 fz-8">
<use xlink:href="#icon-copy2"></use>
</svg>
{{ shareLink }}
</button-component>
<div v-if="!isMajlesBuild" class="share-buttons mt-5 border-top pt-3">
<h6>به اشتراک گذاری</h6>
<div class="d-flex align-items-center">
<a
class="btn"
href="tg://msg_url?text=ماده 5 قانون توزیع عادلانه آب&amp;url=https://davoudabadi.ir/p/0462751"
>
<svg
xmlns="http://www.w3.org/2000/svg"
name="telegram"
class="fill-[#229ED9] h-7 w-7"
fill="currentColor"
viewBox="0 0 16 16"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.287 5.906c-.778.324-2.334.994-4.666 2.01-.378.15-.577.298-.595.442-.03.243.275.339.69.47l.175.055c.408.133.958.288 1.243.294.26.006.549-.1.868-.32 2.179-1.471 3.304-2.214 3.374-2.23.05-.012.12-.026.166.016.047.041.042.12.037.141-.03.129-1.227 1.241-1.846 1.817-.193.18-.33.307-.358.336a8.154 8.154 0 0 1-.188.186c-.38.366-.664.64.015 1.088.327.216.589.393.85.571.284.194.568.387.936.629.093.06.183.125.27.187.331.236.63.448.997.414.214-.02.435-.22.547-.82.265-1.417.786-4.486.906-5.751a1.426 1.426 0 0 0-.013-.315.337.337 0 0 0-.114-.217.526.526 0 0 0-.31-.093c-.3.005-.763.166-2.984 1.09z"
></path>
</svg>
</a>
<a
class="btn"
href="whatsapp://send?text=ماده 5 قانون توزیع عادلانه آب https://davoudabadi.ir/p/0462751"
>
<svg
xmlns="http://www.w3.org/2000/svg"
name="whatsup"
class="text-green-600 h-7 w-7"
fill="currentColor"
viewBox="0 0 16 16"
>
<path
d="M13.601 2.326A7.854 7.854 0 0 0 7.994 0C3.627 0 .068 3.558.064 7.926c0 1.399.366 2.76 1.057 3.965L0 16l4.204-1.102a7.933 7.933 0 0 0 3.79.965h.004c4.368 0 7.926-3.558 7.93-7.93A7.898 7.898 0 0 0 13.6 2.326zM7.994 14.521a6.573 6.573 0 0 1-3.356-.92l-.24-.144-2.494.654.666-2.433-.156-.251a6.56 6.56 0 0 1-1.007-3.505c0-3.626 2.957-6.584 6.591-6.584a6.56 6.56 0 0 1 4.66 1.931 6.557 6.557 0 0 1 1.928 4.66c-.004 3.639-2.961 6.592-6.592 6.592zm3.615-4.934c-.197-.099-1.17-.578-1.353-.646-.182-.065-.315-.099-.445.099-.133.197-.513.646-.627.775-.114.133-.232.148-.43.05-.197-.1-.836-.308-1.592-.985-.59-.525-.985-1.175-1.103-1.372-.114-.198-.011-.304.088-.403.087-.088.197-.232.296-.346.1-.114.133-.198.198-.33.065-.134.034-.248-.015-.347-.05-.099-.445-1.076-.612-1.47-.16-.389-.323-.335-.445-.34-.114-.007-.247-.007-.38-.007a.729.729 0 0 0-.529.247c-.182.198-.691.677-.691 1.654 0 .977.71 1.916.81 2.049.098.133 1.394 2.132 3.383 2.992.47.205.84.326 1.129.418.475.152.904.129 1.246.08.38-.058 1.171-.48 1.338-.943.164-.464.164-.86.114-.943-.049-.084-.182-.133-.38-.232z"
></path>
</svg>
</a>
<a
class="btn"
href="https://twitter.com/share?text=ماده 5 قانون توزیع عادلانه آب&amp;url=https://davoudabadi.ir/p/0462751"
>
<svg
xmlns="http://www.w3.org/2000/svg"
name="twitter"
class="fill-[#1DA1F2] h-7 w-7"
fill="currentColor"
viewBox="0 0 16 16"
>
<path
d="M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z"
></path>
</svg>
</a>
</div>
<!-- <button-component buttonText="" @click="deleteLink" classes="fz-8 px-1">
<svg class="icon icon-Component-295--1">
<use xlink:href="#icon-Component-295--1"></use>
</svg>
</button-component>
<button-component buttonText="" @click="makeLink" classes="fz-8 px-1">
<svg class="icon icon-reset-form">
<use xlink:href="#icon-reset-form"></use>
</svg>
</button-component> -->
</div>
</div>
</template>
<script>
import chatApi from "~/apis/chatApi";
import { mapState } from "pinia";
export default {
props: {
shareLink: {
default() {
return "";
},
},
shareText: {
default() {
return "";
},
},
},
mounted() {
let myHref = location.href;
// this.inviteLink = myHref + "/" + this.sectionItem.id;
},
data() {
return {
inviteLink: null,
};
},
computed: {
...mapState(["currentUser"]),
},
methods: {
deleteLink() {
this.makeLink(0);
},
cancel() {
this.$emit("close");
},
// async makeLink(create = 1) {
// if (this.fetchingData) return;
// this.fetchingData = true;
// const payload = {
// sectionItem_id: this.sectionItem.id,
// new: create,
// };
// return await this.httpService
// .postRequest(chatApi.groups.invite, payload)
// .then((response) => {
// if (create) {
// this.inviteLink =
// location.origin +
// location.pathname +
// "?invite-id=" +
// response.data.invite_id;
// // this.copyToClip();
// } else
// this.mySwalToast({
// html: "لینک با موفقیت حذف شد.",
// });
// })
//
// .finally(() => {
// this.fetchingData = false;
// // this.$emit('close')
// });
// },
async copyToClip(text) {
try {
await navigator.clipboard.writeText(text);
this.mySwalToast({
html: "کپی شد.",
});
} catch (err) {
this.mySwalToast({
html: "خطایی رخ داد.لطفا دوباره امتحان کنید.",
});
}
},
},
};
</script>
<style lang="scss" scoped>
// .title {
// background-color: #ededed;
// }
// .description {
// max-height: 13em;
// height: auto;
// overflow: auto;
// }
.color-1 {
color: #6f6f6f;
border-style: dashed;
border-color: #a5abac;
}
.share-buttons {
display: flex;
align-items: center;
.btn {
svg {
max-width: 2em;
height: 2em;
}
}
}
// .fz-9 {
// font-size: 0.9rem;
// }
// .fz-8 {
// font-size: 0.8rem;
// color: #a1a1a1;
// }
</style>