generated from dwd/boilarplate-astro-tailwind
got conflict with branch b5
commit
2d6e51ff9d
|
@ -0,0 +1 @@
|
|||
<svg width="70px" height="70px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M9.77778 21H14.2222C17.3433 21 18.9038 21 20.0248 20.2646C20.51 19.9462 20.9267 19.5371 21.251 19.0607C22 17.9601 22 16.4279 22 13.3636C22 10.2994 22 8.76721 21.251 7.6666C20.9267 7.19014 20.51 6.78104 20.0248 6.46268C19.3044 5.99013 18.4027 5.82123 17.022 5.76086C16.3631 5.76086 15.7959 5.27068 15.6667 4.63636C15.4728 3.68489 14.6219 3 13.6337 3H10.3663C9.37805 3 8.52715 3.68489 8.33333 4.63636C8.20412 5.27068 7.63685 5.76086 6.978 5.76086C5.59733 5.82123 4.69555 5.99013 3.97524 6.46268C3.48995 6.78104 3.07328 7.19014 2.74902 7.6666C2 8.76721 2 10.2994 2 13.3636C2 16.4279 2 17.9601 2.74902 19.0607C3.07328 19.5371 3.48995 19.9462 3.97524 20.2646C5.09624 21 6.65675 21 9.77778 21ZM16 13C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13C8 10.7909 9.79086 9 12 9C14.2091 9 16 10.7909 16 13ZM18 9.25C17.5858 9.25 17.25 9.58579 17.25 10C17.25 10.4142 17.5858 10.75 18 10.75H19C19.4142 10.75 19.75 10.4142 19.75 10C19.75 9.58579 19.4142 9.25 19 9.25H18Z" fill="#780a0a"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M16 13C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13C8 10.7909 9.79086 9 12 9C14.2091 9 16 10.7909 16 13ZM12.75 11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V12.25H10C9.58579 12.25 9.25 12.5858 9.25 13C9.25 13.4142 9.58579 13.75 10 13.75H11.25V15C11.25 15.4142 11.5858 15.75 12 15.75C12.4142 15.75 12.75 15.4142 12.75 15V13.75H14C14.4142 13.75 14.75 13.4142 14.75 13C14.75 12.5858 14.4142 12.25 14 12.25H12.75V11Z" fill="#780a0a"></path> <path d="M18 9.25C17.5858 9.25 17.25 9.58579 17.25 10C17.25 10.4142 17.5858 10.75 18 10.75H19C19.4142 10.75 19.75 10.4142 19.75 10C19.75 9.58579 19.4142 9.25 19 9.25H18Z" fill="#780a0a"></path> </g></svg>
|
After Width: | Height: | Size: 2.0 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,103 @@
|
|||
<template>
|
||||
<div class="my-10">
|
||||
<section class="container mx-auto px-4 max-w-2xl shadow-lg rounded-xl p-6">
|
||||
<p class="text-2xl py-4">Edit News</p>
|
||||
<form id="formID">
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage"></p>
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage2"></p>
|
||||
<label for="file">Choose a file:</label>
|
||||
<input @change="saveFile" type="file" name="fileToUploadToSpApi" id="fileToUpload" required />
|
||||
</form>
|
||||
<form action="">
|
||||
<div>
|
||||
<input :value="data.file_url" type="text" name="fileLink" id="fileLink" class="p-2 border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
slugURLbn: "",
|
||||
fullURL: "",
|
||||
spliturl: "",
|
||||
bartaData: {}, // Initialize bartaData as an object
|
||||
bnData: {},
|
||||
data:{},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// this.getBarta();
|
||||
let fullURL = window.location.href.split("/")[5].split('?add=')[1];
|
||||
console.log(fullURL)
|
||||
},
|
||||
methods: {
|
||||
saveFile(event) {
|
||||
event.preventDefault();
|
||||
let formData = new FormData();
|
||||
// Append the selected file to the FormData object
|
||||
formData.append('file', event.target.files[0]);
|
||||
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/upload_file/v2/`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
},
|
||||
|
||||
// getBarta() {
|
||||
// let currentUrl = window.location.href;
|
||||
// console.log('full url', currentUrl)
|
||||
// let langValue = currentUrl.split("/")[5].split('?add=')[1];
|
||||
// console.log( langValue);
|
||||
// let formData = new FormData();
|
||||
// formData.append('slug', langValue);
|
||||
// fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news/`, {
|
||||
// method: 'POST',
|
||||
// body: formData,
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// // Assign fetched data to bartaData property
|
||||
// // console.log(data)
|
||||
// this.bartaData = data;
|
||||
// console.log(this.bartaData)
|
||||
// })
|
||||
// .catch(error => {
|
||||
// // console.log('An error occurred', error);
|
||||
// });
|
||||
// },
|
||||
// getBartaBN() {
|
||||
// let currentUrl = window.location.href;
|
||||
// let spliturl = currentUrl.split("/")[3].split("edit=")[1];
|
||||
// // console.log(spliturl);
|
||||
// let formData = new FormData();
|
||||
// formData.append('slug', spliturl);
|
||||
// fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news/?action=news_bn`, {
|
||||
// method: 'POST',
|
||||
// body: formData,
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => {
|
||||
// // Assign fetched data to bartaData property
|
||||
// // console.log(data)
|
||||
// this.bnData = data;
|
||||
// console.log(this.bnData)
|
||||
// })
|
||||
// .catch(error => {
|
||||
// // console.log('An error occurred', error);
|
||||
// });
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<main>
|
||||
<div>
|
||||
<section class="bg-[#780A0A]">
|
||||
<div class="container mx-auto px-4 text-white ">
|
||||
<div class="flex flex-row ">
|
||||
<a class="p-4" href="/editor/add-news">Add News</a>
|
||||
<a class="p-4" href="/editor/edit-news">Edit News</a>
|
||||
<a class="p-4" href="/editor/add-file-list">Add Image</a>
|
||||
</div>
|
||||
<!-- <a href="/editor/add-news">Add News</a>
|
||||
<a href="/editor/add-news">Add News</a> -->
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
<div v-for="item in items" :key="item.id" class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<a class="flex flex-col" :href="`/bn/${item.slug}`">
|
||||
<img class="aspect-video rounded-t-lg" :src="item.img" :alt="item.title" />
|
||||
<h2 class="text-lg text-justify">{{ item.title }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<!-- Overlay -->
|
||||
<div v-if="item.dialogOpen" class="fixed inset-0 bg-black opacity-50"></div>
|
||||
<dialog :id="`d-${item.id}`" class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%] dialog" :open="item.dialogOpen">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a :href="`/bn/${item.slug}`" class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" :src="item.img" :alt="item.title" />
|
||||
<h1 class="text-lg font-bold">{{ item.heading }}</h1>
|
||||
<h2 class="text-justify">{{ item.in_brief }}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/bn/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/bn/${item.slug}&text=%20${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<!-- <a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/${item.slug}&text=${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> -->
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" @click="closeDialog(item)">✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button @click="openDialog(item)" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a :href="`/bn/${item.slug}`" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog(item) {
|
||||
item.dialogOpen = true;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
closeDialog(item) {
|
||||
item.dialogOpen = false;
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Escape') {
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let fullURL = window.location.href.split('/')[5].split('?cat=')[1];
|
||||
// console.log(fullURL);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/category-bn/?cat=${fullURL}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// console.log(data);
|
||||
this.items = data;
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white; /* Adjust as needed */
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Additional styles for the overlay (optional) */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
z-index: 999; /* Ensure the overlay is above other content */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
<div v-for="item in items" :key="item.id" class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<a class="flex flex-col" :href="`/en/${item.slug}`">
|
||||
<img class="aspect-video rounded-t-lg" :src="item.img" :alt="item.title" />
|
||||
<h2 class="text-lg text-justify">{{ item.title }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<!-- Overlay -->
|
||||
<div v-if="item.dialogOpen" class="fixed inset-0 bg-black opacity-50"></div>
|
||||
<dialog :id="`d-${item.id}`" class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%] dialog" :open="item.dialogOpen">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a :href="`/en/${item.slug}`" class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" :src="item.img" :alt="item.title" />
|
||||
<h1 class="text-lg font-bold">{{ item.heading }}</h1>
|
||||
<h2 class="text-justify">{{ item.in_brief }}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/en/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/en/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/en/${item.slug}&text=%20${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/en/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<!-- <a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/en/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/${item.slug}&text=${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> -->
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" @click="closeDialog(item)">✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button @click="openDialog(item)" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a :href="`/en/${item.slug}`" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog(item) {
|
||||
item.dialogOpen = true;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
closeDialog(item) {
|
||||
item.dialogOpen = false;
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Escape') {
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let fullURL = window.location.href.split('/')[5].split('?cat=')[1];
|
||||
// console.log(fullURL);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/category-en/?cat=${fullURL}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// console.log(data);
|
||||
this.items = data;
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white; /* Adjust as needed */
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Additional styles for the overlay (optional) */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
z-index: 999; /* Ensure the overlay is above other content */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
<div v-for="item in items" :key="item.id" class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<a class="flex flex-col" :href="`/es/${item.slug}`">
|
||||
<img class="aspect-video rounded-t-lg" :src="item.img" :alt="item.title" />
|
||||
<h2 class="text-lg text-justify">{{ item.title }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<!-- Overlay -->
|
||||
<div v-if="item.dialogOpen" class="fixed inset-0 bg-black opacity-50"></div>
|
||||
<dialog :id="`d-${item.id}`" class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%] dialog" :open="item.dialogOpen">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a :href="`/es/${item.slug}`" class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" :src="item.img" :alt="item.title" />
|
||||
<h1 class="text-lg font-bold">{{ item.heading }}</h1>
|
||||
<h2 class="text-justify">{{ item.in_brief }}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/es/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/es/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/es/${item.slug}&text=%20${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/es/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<!-- <a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/es/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/${item.slug}&text=${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> -->
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" @click="closeDialog(item)">✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button @click="openDialog(item)" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a :href="`/es/${item.slug}`" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog(item) {
|
||||
item.dialogOpen = true;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
closeDialog(item) {
|
||||
item.dialogOpen = false;
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Escape') {
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let fullURL = window.location.href.split('/')[5].split('?cat=')[1];
|
||||
// console.log(fullURL);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/category-es/?cat=${fullURL}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// console.log(data);
|
||||
this.items = data;
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white; /* Adjust as needed */
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Additional styles for the overlay (optional) */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
z-index: 999; /* Ensure the overlay is above other content */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -31,6 +31,7 @@
|
|||
<div class="flex flex-col">
|
||||
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option :value="bartaData.category">{{ bartaData.category }}</option>
|
||||
<option value="national">National</option>
|
||||
<option value="politics">Politics</option>
|
||||
<option value="local">Local</option>
|
||||
|
@ -74,8 +75,12 @@
|
|||
<button onclick="callApi(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div></div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -100,7 +105,7 @@
|
|||
let currentUrl = window.location.href;
|
||||
let langValue = currentUrl.split("/")[4].split("lang=")[1];
|
||||
let spliturl = currentUrl.split("/")[4].split("edit=")[1].split(`lang=${langValue}`)[0].split(`&`)[0];
|
||||
console.log(spliturl);
|
||||
console.log(spliturl, langValue);
|
||||
let formData = new FormData();
|
||||
formData.append('slug', spliturl);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/edit-news/?action=news_${langValue}`, {
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<label for="langValue">Read Also:</label>
|
||||
<select v-on:change="dataCall()" v-model="langValue" name="langValue" id="langValue">
|
||||
<option value="en">English</option>
|
||||
<option value="bn">Bengali</option>
|
||||
<option value="hi">Hindi</option>
|
||||
<option value="zh">Mandarin</option>
|
||||
<option value="es">Espanish</option>
|
||||
</select>
|
||||
<div v-for="items in items" :key="items.id">
|
||||
<p>{{ items.title }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return{
|
||||
data: "",
|
||||
items: "",
|
||||
langValue: 'en'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
dataCall(){
|
||||
// let fullURL = window.location.href;
|
||||
// console.log(fullURL)
|
||||
console.log(langValue)
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_${this.langValue}`)
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
this.items = data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
// getData() {
|
||||
// fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/')
|
||||
// .then(response => {
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Network response was not ok');
|
||||
// }
|
||||
// return response.json();
|
||||
// })
|
||||
// .then(data => {
|
||||
// // Handle the JSON response data
|
||||
// console.log(data);
|
||||
// })
|
||||
// .catch(error => {
|
||||
// // Handle any errors that occurred during the fetch
|
||||
// console.error('Fetch error:', error);
|
||||
// });
|
||||
// }
|
||||
},
|
||||
mounted() {
|
||||
this.dataCall(); // Call the getData function when the component is mounted
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
<div v-for="item in items" :key="item.id" class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<a class="flex flex-col" :href="`/hi/${item.slug}`">
|
||||
<img class="aspect-video rounded-t-lg" :src="item.img" :alt="item.title" />
|
||||
<h2 class="text-lg text-justify">{{ item.title }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<!-- Overlay -->
|
||||
<div v-if="item.dialogOpen" class="fixed inset-0 bg-black opacity-50"></div>
|
||||
<dialog :id="`d-${item.id}`" class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%] dialog" :open="item.dialogOpen">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a :href="`/hi/${item.slug}`" class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" :src="item.img" :alt="item.title" />
|
||||
<h1 class="text-lg font-bold">{{ item.heading }}</h1>
|
||||
<h2 class="text-justify">{{ item.in_brief }}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/hi/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/hi/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/hi/${item.slug}&text=%20${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/hi/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<!-- <a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/hi/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/${item.slug}&text=${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> -->
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" @click="closeDialog(item)">✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button @click="openDialog(item)" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a :href="`/hi/${item.slug}`" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog(item) {
|
||||
item.dialogOpen = true;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
closeDialog(item) {
|
||||
item.dialogOpen = false;
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Escape') {
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let fullURL = window.location.href.split('/')[5].split('?cat=')[1];
|
||||
// console.log(fullURL);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/category-hi/?cat=${fullURL}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// console.log(data);
|
||||
this.items = data;
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white; /* Adjust as needed */
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Additional styles for the overlay (optional) */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
z-index: 999; /* Ensure the overlay is above other content */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<nav>
|
||||
<div class="logo">
|
||||
<!-- <img class="w-[50px] rounded-full drop-shadow-2xl p-0.5 animate-[spin_3s_ease]" src="/img/logo.svg" alt="" /> animate-[bounce_3s_ease] -->
|
||||
<a href="/"><img class=" border-2 rounded-md border-white shadow-md shadow-white drop-shadow-2xl " src="/img/barta_logo.png" alt="Barta Logo" /></a>
|
||||
<a href="/en"><img class=" border-2 rounded-md border-white shadow-md shadow-white drop-shadow-2xl " src="/img/barta_logo.png" alt="Barta Logo" /></a>
|
||||
</div>
|
||||
<div class="hamburger">
|
||||
<div class="line1"></div>
|
||||
|
@ -12,7 +12,7 @@
|
|||
</div>
|
||||
<ul class="nav-links">
|
||||
<li><a class="text-yellow-500" href="/bn">বাংলা</a></li>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/en">Home</a></li>
|
||||
<li><a href="/national">National</a></li>
|
||||
<li><a href="/politics">Politics</a></li>
|
||||
<li><a href="/local">Local</a></li>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="line3"></div>
|
||||
</div>
|
||||
<ul class="nav-links">
|
||||
<li><a class="text-yellow-500" href="/">English</a></li>
|
||||
<li><a class="text-yellow-500" href="/en">English</a></li>
|
||||
<li><a href="/bn">হোম</a></li>
|
||||
<li><a href="/bn/national">জাতীয়</a></li>
|
||||
<li><a href="/bn/politics">রাজনীতি</a></li>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<template>
|
||||
<div class="modal-mask" v-if="show" @click="closeModal">
|
||||
<div class="modal-container" @click.stop>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$parent.$on('open-modal', this.openModal);
|
||||
},
|
||||
methods: {
|
||||
openModal(itemId) {
|
||||
// Logic to show modal, optionally filter by itemId if needed
|
||||
this.show = true;
|
||||
},
|
||||
closeModal() {
|
||||
this.show = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.modal-mask {
|
||||
position: fixed;
|
||||
z-index: 9998;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.modal-container {
|
||||
background-color: white;
|
||||
border-radius: 0.5rem;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
<div v-for="item in items" :key="item.id" class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div>
|
||||
<a class="flex flex-col" :href="`/zh/${item.slug}`">
|
||||
<img class="aspect-video rounded-t-lg" :src="item.img" :alt="item.title" />
|
||||
<h2 class="text-lg text-justify">{{ item.title }}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<!-- Overlay -->
|
||||
<div v-if="item.dialogOpen" class="fixed inset-0 bg-black opacity-50"></div>
|
||||
<dialog :id="`d-${item.id}`" class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%] dialog" :open="item.dialogOpen">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a :href="`/zh/${item.slug}`" class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" :src="item.img" :alt="item.title" />
|
||||
<h1 class="text-lg font-bold">{{ item.heading }}</h1>
|
||||
<h2 class="text-justify">{{ item.in_brief }}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/zh/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/zh/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/zh/${item.slug}&text=%20${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/zh/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<!-- <a class="hover:-translate-y-2 duration-[1s]" :href="`whatsapp://send?text=${item.title}%20%0A%20https://barta-india.in/${item.slug}`" data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.facebook.com/share.php?u=https://barta-india.in/zh/${item.slug}`" target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`http://www.twitter.com/share?url=https://barta-india.in/${item.slug}&text=${item.title}`" target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" :href="`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${item.slug}&title=${item.title}&summary=${item.title}&source=${item.title}`" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a> -->
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" @click="closeDialog(item)">✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button @click="openDialog(item)" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a :href="`/zh/${item.slug}`" class="bg-[#780a0a] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
openDialog(item) {
|
||||
item.dialogOpen = true;
|
||||
|
||||
window.addEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
closeDialog(item) {
|
||||
item.dialogOpen = false;
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
},
|
||||
handleKeyDown(event) {
|
||||
if (event.key === 'Escape') {
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
|
||||
window.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let fullURL = window.location.href.split('/')[5].split('?cat=')[1];
|
||||
// console.log(fullURL);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/category-zh/?cat=${fullURL}`)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
// console.log(data);
|
||||
this.items = data;
|
||||
|
||||
this.items.forEach(item => {
|
||||
item.dialogOpen = false;
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getData();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.dialog {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: white; /* Adjust as needed */
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Additional styles for the overlay (optional) */
|
||||
.dialog-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
z-index: 999; /* Ensure the overlay is above other content */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
@ -1,97 +1,94 @@
|
|||
---
|
||||
import LayoutBN from '../../layouts/LayoutBN.astro';
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const response = await fetch('https://api7.siliconpin.com/items/barta?filter[status][_eq]=published&filter[lang][_eq]=bengali');
|
||||
const data = await response.json();
|
||||
const finalData = data.data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_bn', options);
|
||||
const data = await response.json();
|
||||
const finalData = data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const response = await fetch('https://api7.siliconpin.com/items/barta?filter[status][_eq]=published&filter[lang][_eq]=bengali');
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_bn', options);
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data.data[idx];
|
||||
// console.log(data.data[idx])
|
||||
const idx = data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data[idx];
|
||||
// console.log(items)
|
||||
---
|
||||
<LayoutBN title={items.meta_title}
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/bn/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/bn/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/bn/${items.slug}`
|
||||
>
|
||||
<Layout title=""
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={items.img}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={items.img}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/bn/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/bn/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/bn/${items.slug}`>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={items.img} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify text-red-700 mt-4" set:html={items.content}></p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</LayoutBN>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify mt-4">{items.content}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style>
|
||||
section > div > p > p {
|
||||
text-align: justify;
|
||||
}
|
||||
</style>
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import Layout from "../../../layouts/Layout.astro"
|
||||
import BNCategory from "../../../components/BNCategory.vue";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="text-[#780a0a] py-6 flex flex-row" id="">
|
||||
<a id="folder" href="/bn"></a> >
|
||||
<p id="cat"></p>
|
||||
</div>
|
||||
<BNCategory client:visible />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let fullURL = window.location.href.split('/');
|
||||
// console.log(fullURL);
|
||||
let folderName = document.getElementById('folder').innerHTML = fullURL[3];
|
||||
let catName = document.getElementById('cat').innerHTML = fullURL[5].split('?cat=')[1]
|
||||
</script>
|
|
@ -1,44 +1,33 @@
|
|||
---
|
||||
import LayoutBN from '../../layouts/LayoutBN.astro';
|
||||
const fetchData = await fetch('https://api7.siliconpin.com/items/barta?sort=-date_created&filter[lang][_eq]=bengali');
|
||||
const dataJSON = await fetchData.json();
|
||||
const data = dataJSON.data;
|
||||
const fetchMeta = await fetch('https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_bn');
|
||||
const metaJSON = await fetchMeta.json();
|
||||
const items = metaJSON.data[0];
|
||||
// const imageData = data.image;
|
||||
// const data = fetchDataJSON.data;
|
||||
// console.log()
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_bn', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
|
||||
<LayoutBN title={items.title}
|
||||
metaTitle={items.meta_title}
|
||||
description={items.description}
|
||||
ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterTitle={items.title}
|
||||
tiwtterDesc={items.description}
|
||||
tiwtterURL=`https://barta-india.in/bn`
|
||||
ogSiteName=`https://barta-india.in/bn`
|
||||
ogType={items.og_type}
|
||||
ogTitle={items.title}
|
||||
ogDesc={items.description}
|
||||
ogURL=`https://barta-india.in/bn`
|
||||
>
|
||||
<main>
|
||||
<Layout title="">
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="flex flex-row md:justify-center my-10 overflow-x-scroll md:overflow-x-clip">
|
||||
<a href="/bn/cat/?cat=local" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Local</a>
|
||||
<a href="/bn/cat/?cat=national" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">National</a>
|
||||
<a href="/bn/cat/?cat=world" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">World</a>
|
||||
<a href="/bn/cat/?cat=politics" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Politics</a>
|
||||
<a href="/bn/cat/?cat=technology" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Technology</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
{news.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/bn/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
|
||||
<img class="aspect-video rounded-t-lg" src={items.img} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -47,16 +36,16 @@ const items = metaJSON.data[0];
|
|||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/bn/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
|
||||
<img class="rounded-t-xl" src={items.img} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
|
@ -69,21 +58,14 @@ const items = metaJSON.data[0];
|
|||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
|
||||
<a href={`/bn/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
<!-- <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p> -->
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</LayoutBN>
|
||||
<script is:inline>
|
||||
const pageName = window.location.href.split('/')[3];
|
||||
document.getElementById('pageName').innerHTML = '> ' + pageName;
|
||||
// console.log(pageName)
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</Layout>
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
import LayoutBN from '../../layouts/LayoutBN.astro';
|
||||
export async function getStaticPaths() {
|
||||
const response = await fetch('https://api7.siliconpin.com/items/barta?filter[status][_eq]=published&filter[lang][_eq]=bengali');
|
||||
const data = await response.json();
|
||||
const finalData = data.data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const response = await fetch('https://api7.siliconpin.com/items/barta?filter[status][_eq]=published&filter[lang][_eq]=bengali');
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data.data[idx];
|
||||
// console.log(data.data[idx])
|
||||
---
|
||||
<LayoutBN title={items.meta_title}
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/bn/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/bn/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/bn/${items.slug}`
|
||||
>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/bn/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/bn/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/bn/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/bn/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify text-red-700 mt-4" set:html={items.content}></p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</LayoutBN>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
||||
|
||||
<style>
|
||||
section > div > p > p {
|
||||
text-align: justify;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
import LayoutBN from '../../layouts/LayoutBN.astro';
|
||||
const fetchData = await fetch('https://api7.siliconpin.com/items/barta?sort=-date_created&filter[lang][_eq]=bengali');
|
||||
const dataJSON = await fetchData.json();
|
||||
const data = dataJSON.data;
|
||||
const fetchMeta = await fetch('https://api7.siliconpin.com/items/meta_data?filter[status][_eq]=published&filter[domain][_eq]=barta&filter[pages][_eq]=home_bn');
|
||||
const metaJSON = await fetchMeta.json();
|
||||
const items = metaJSON.data[0];
|
||||
// const imageData = data.image;
|
||||
// const data = fetchDataJSON.data;
|
||||
// console.log()
|
||||
---
|
||||
|
||||
<LayoutBN title={items.title}
|
||||
metaTitle={items.meta_title}
|
||||
description={items.description}
|
||||
ogImg={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={`https://api7.siliconpin.com/assets/${items.img}`}
|
||||
tiwtterTitle={items.title}
|
||||
tiwtterDesc={items.description}
|
||||
tiwtterURL=`https://barta-india.in/bn`
|
||||
ogSiteName=`https://barta-india.in/bn`
|
||||
ogType={items.og_type}
|
||||
ogTitle={items.title}
|
||||
ogDesc={items.description}
|
||||
ogURL=`https://barta-india.in/bn`
|
||||
>
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{data.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/bn/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/bn/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={`https://api7.siliconpin.com/assets/${items.img}?quality=50&format=jpeg`} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fbarta-india.in%2F${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p>
|
||||
<a href={`/bn/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</LayoutBN>
|
||||
<script is:inline>
|
||||
const pageName = window.location.href.split('/')[3];
|
||||
document.getElementById('pageName').innerHTML = '> ' + pageName;
|
||||
// console.log(pageName)
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,112 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import AdminHeader from "../../components/AdminHeader.astro";
|
||||
---
|
||||
<Layout title="Upload File | Barta-India">
|
||||
<AdminHeader />
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="mt-16">
|
||||
<table class="border-2">
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
<th class="border-[2px] border-[#dbdde1]">ID</th>
|
||||
<th class="border-[2px] border-[#dbdde1]">News Slug</th>
|
||||
<th class="border-[2px] border-[#dbdde1]">Image</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="border-2" id="statusTableBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="container mx-auto px-4 flex flex-col space-y-4">
|
||||
<!-- <form action="https://apisp.dev2.cicdhosting.com/upload_file/v2/" method="post" enctype="multipart/form-data">
|
||||
Select image to upload:
|
||||
<input type="file" name="fileToUploadToSpApi" id="fileToUpload">
|
||||
<input type="submit" value="Upload Image" name="submit">
|
||||
</form> -->
|
||||
<!-- <h1>Upload File</h1> -->
|
||||
<!-- <form action="https://apisp.dev2.cicdhosting.com/upload_file/v2/" method="post" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" /> <br>
|
||||
<input type="submit" value="Upload">
|
||||
</form> -->
|
||||
<!-- <form id="formID">
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage"></p>
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage2"></p>
|
||||
<label for="file">Choose a file:</label>
|
||||
<input type="file" name="fileToUploadToSpApi" id="fileToUpload" required>
|
||||
<br>
|
||||
<input onclick="noImageNews();" type="submit" value="Upload">
|
||||
</form> -->
|
||||
</div>
|
||||
<!-- <button onclick="noImageNews();">onclick="noImageNews();"</button> -->
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
window.onload = function noImageNews() {
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/no-file/`)
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
let tableBody = document.getElementById('statusTableBody');
|
||||
data.forEach(function(singleData) {
|
||||
let row = tableBody.insertRow();
|
||||
row.style.border = '2px solid #dbdde1';
|
||||
let cellId = row.insertCell(0);
|
||||
cellId.style.border = '2px solid #dbdde1';
|
||||
cellId.innerHTML = singleData.id;
|
||||
let cellStatus = row.insertCell(1);
|
||||
cellStatus.style.border = '2px solid #dbdde1';
|
||||
cellStatus.innerHTML = singleData.slug;
|
||||
let cellEdit = row.insertCell(2);
|
||||
cellEdit.style.border = '2px solid #dbdde1';
|
||||
let addButton = document.createElement('a');
|
||||
addButton.innerText = 'Add';
|
||||
addButton.style.color = 'blue';
|
||||
addButton.href = `/editor/add-file/?add=${singleData.slug}`
|
||||
addButton.addEventListener('click', function() {
|
||||
// Add your edit functionality here
|
||||
// console.log('Editing ID:', singleData.id);
|
||||
});
|
||||
cellEdit.appendChild(addButton);
|
||||
});
|
||||
console.log(data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('An error occurred', error); // Typo was here: 'console.erroe'
|
||||
});
|
||||
};
|
||||
|
||||
// noImageNews = window.onload;
|
||||
function saveFile(event){
|
||||
event.preventDefault();
|
||||
let formID = document.getElementById('formID');
|
||||
let formData = new FormData(formID);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/upload_file/v2/`,{
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
if(data.error_code == 8050){
|
||||
document.getElementById('errorMessage').innerHTML = data.error;
|
||||
document.getElementById('errorMessage').style.display = 'block';
|
||||
document.getElementById('errorMessage2').style.display = 'none';
|
||||
}
|
||||
if(data.error_code == 8051){
|
||||
document.getElementById('errorMessage2').innerHTML = data.error;
|
||||
document.getElementById('errorMessage2').style.display = 'block';
|
||||
document.getElementById('errorMessage').style.display = 'none';
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,112 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import AdminHeader from "../../components/AdminHeader.astro";
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<AdminHeader />
|
||||
<div>
|
||||
<!-- <AddFile client:visible /> -->
|
||||
<section class="container mx-auto px-4 max-w-2xl shadow-2xl rounded-2xl mt-16">
|
||||
<h3 class="text-2xl py-4">Add File</h3>
|
||||
<p id="uploadConfirm" class="text-green-500 font-bold py-2" style="display: none;">Image Uploaded successfully</p>
|
||||
<form id="imageChoose" class="flex flex-col">
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage"></p>
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage2"></p>
|
||||
<label for="file">Choose a file:</label>
|
||||
<input oninput="saveFile(event);" type="file" name="fileToUploadToSpApi" id="fileToUpload" />
|
||||
<br>
|
||||
<!-- <input oninput="saveFile(event);" type="submit" value="Upload"> -->
|
||||
</form>
|
||||
<form id="imageLink" style="display: none;" class="space-y-4">
|
||||
<div class="flex flex-col">
|
||||
<input type="text" name="slug" id="slug" class="p-2 border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" required />
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input type="text" name="fileLink" id="fileLink" class="p-2 border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" required />
|
||||
</div>
|
||||
<div>
|
||||
<input onclick="submitNewsImage(event);" type="submit" value="Upload" class="bg-[#780a0a] px-4 py-2 rounded-lg text-white cursor-pointer" />
|
||||
</div>
|
||||
</form>
|
||||
<div class="flex flex-col justify-center place-items-center p-6">
|
||||
<img id="imgview" src="" alt="" class="rounded-xl" />
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
function imagePreview() {
|
||||
let fileInput = document.getElementById('fileToUpload');
|
||||
let file = fileInput.files[0];
|
||||
let imgView = document.getElementById('imgview');
|
||||
if (file) {
|
||||
document.getElementById('imgview').style.display = 'block';
|
||||
let imgUrl = URL.createObjectURL(file);
|
||||
imgView.src = imgUrl;
|
||||
} else {
|
||||
imgView.src = "";
|
||||
}
|
||||
}
|
||||
|
||||
let slug = window.location.href.split('/')[5].split('?add=')[1];
|
||||
// console.log(slug)
|
||||
document.getElementById('slug').value = slug;
|
||||
|
||||
function saveFile(event){
|
||||
event.preventDefault();
|
||||
let imageChoose = document.getElementById('imageChoose');
|
||||
let formData = new FormData(imageChoose);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/upload_file/v2/`,{
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
if(data.error_code == 8050){
|
||||
document.getElementById('errorMessage').innerHTML = data.error;
|
||||
document.getElementById('errorMessage').style.display = 'block';
|
||||
document.getElementById('errorMessage2').style.display = 'none';
|
||||
}
|
||||
if(data.error_code == 8051){
|
||||
document.getElementById('errorMessage2').innerHTML = data.error;
|
||||
document.getElementById('errorMessage2').style.display = 'block';
|
||||
document.getElementById('errorMessage').style.display = 'none';
|
||||
}
|
||||
if(data.file_url){
|
||||
document.getElementById('fileLink').value = data.file_url;
|
||||
document.getElementById('imageChoose').style.display = 'none';
|
||||
document.getElementById('imageLink').style.display = 'block';
|
||||
}
|
||||
console.log(data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
})
|
||||
imagePreview();
|
||||
}
|
||||
|
||||
function submitNewsImage(event) {
|
||||
event.preventDefault();
|
||||
let formElement = document.getElementById('imageLink'); // Replace 'yourFormId' with the actual ID of your form
|
||||
let formData = new FormData(formElement); // Pass the form element
|
||||
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/no-file-add-file/`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(response => response.json()) // Convert response to text
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
if(data.success === true){
|
||||
document.getElementById('uploadConfirm').style.display = 'block';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error occurred:', error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
|
@ -1,20 +1,24 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
// import ImageUpload from "../../components/ImageUpload.vue";
|
||||
// import ImageUpload from "../components/ImageUpload.vue";
|
||||
import AdminHeader from "../../components/AdminHeader.astro";
|
||||
|
||||
---
|
||||
|
||||
<Layout title="Add News | Barta India">
|
||||
<AdminHeader />
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4 md:max-w-3xl mt-40 space-y-4 shadow-xl rounded-xl p-4">
|
||||
<h1 class="text-center text-2xl underline decoration-4 decoration-[#580a0a]">Genarate New News</h1>
|
||||
<p style="display: none;" id="genStatus" class="text-green-500 font-bold">News Genarate Succesfully</p>
|
||||
<form id="newsPara" class="flex flex-col space-y-4" enctype="multipart/form-data">
|
||||
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<!-- <label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select required onchange="qryWithLang();" name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option value="0">-Select-</option>
|
||||
<option value="english">English</option>
|
||||
<option value="bengali">Bengali</option>
|
||||
</select>
|
||||
</select> -->
|
||||
<div class="flex flex-col">
|
||||
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
|
@ -28,179 +32,116 @@ import Layout from "../../layouts/Layout.astro";
|
|||
</div>
|
||||
<div class="flex flex-col ">
|
||||
<label for="preText">News Paragraph</label>
|
||||
<textarea onchange="buttonVisibility();" required name="preText" id="preText" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
|
||||
<textarea required name="preText" id="preText" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<textarea required name="systemMessage" id="systemMessage" cols="30" rows="3" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
|
||||
<textarea required name="systemMessage" id="systemMessage" cols="30" rows="3" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl">provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters, heading within 170 characters in en, bn, hi, zh, es ar all in a json structure no use comma after line ending</textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<input type="text" name="fileLink" id="fileLink" class="p-2 border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/>
|
||||
</div>
|
||||
<div>
|
||||
<button id="genButton" style="display: none;" onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
|
||||
<button id="genButton2" style="display: block;" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg opacity-50 cursor-not-allowed" >Genarate</button>
|
||||
<button id="genButton" onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
|
||||
</div>
|
||||
<!-- <input id="message" type="text" value="" class="border-2 border-[#580a0a] p-2 focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/> -->
|
||||
</form>
|
||||
</section>
|
||||
<section id="formSection" style="display: none;" class="container mx-auto md:max-w-3xl px-4 shadow-xl rounded-xl p-6">
|
||||
<div class="flex justify-center">
|
||||
<h1 class="text-xl my-6 p-2 border-2 bg-[#580a0a] text-white rounded-full">Add News to Barta-India's Page</h1>
|
||||
</div>
|
||||
<p>All(<span class="text-[#580a0a] font-bold">*</span>) are mandatory fields</p>
|
||||
<form id="newsForm" class="flex flex-col space-y-4">
|
||||
<div class="flex flex-col">
|
||||
<label for="status">Status<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="status" id="status" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
|
||||
<option value="null">-Select-</option>
|
||||
<option value="published">Published</option>
|
||||
<option value="draft">Draft</option>
|
||||
<option value="archived">Archived</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
|
||||
<option value="null">-Select-</option>
|
||||
<option value="bengali">Bengali</option>
|
||||
<option value="english">English</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option value="null">-Select-</option>
|
||||
<option value="national">National</option>
|
||||
<option value="politics">Politics</option>
|
||||
<option value="local">Local</option>
|
||||
<option value="technology">Technology</option>
|
||||
<option value="world">World</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="title">Title<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="title" id="title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="slug">Slug<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input oninput="updateSlug();" name="slug" id="slug" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="heading">Heading<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="heading" id="heading" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="meta_title">Meta Title<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="meta_title" id="meta_title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 60 characters & try to use common words" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="meta_description">Meta Description<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="meta_description" id="meta_description" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 160 characters & try to use common words" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="in_brief">In Brief<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="in_brief" id="in_brief" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 280 characters & try to descibe" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label class="text-lg" for="content">News Description<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<textarea class="border-2 p-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" name="content" id="content" cols="30" rows="10" required></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="upldFile">Upload File</label>
|
||||
<input id="upldFile" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" type="file">
|
||||
</div>
|
||||
<div class="flex float-right">
|
||||
<button onclick="callApi(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Save</button>
|
||||
</div>
|
||||
<form id="formID">
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage"></p>
|
||||
<p class="text-red-500" style="display: none;" id="errorMessage2"></p>
|
||||
<label for="file">Choose a file:</label>
|
||||
<input oninput="saveFile(event);" type="file" name="fileToUploadToSpApi" id="fileToUpload" required />
|
||||
<br>
|
||||
<!-- <input oninput="saveFile(event);" type="submit" value="Upload"> -->
|
||||
</form>
|
||||
</section>
|
||||
<!-- border-2 border-[#780a0a] rounded-xl -->
|
||||
<section class="bg-white rounded-full px-6 py-4" id="loadingSection" style="display: none;">
|
||||
<div class="flex flex-col justify-center place-items-center">
|
||||
<div class="load-aimate animate-spin "></div>
|
||||
<p>Processing...</p>
|
||||
</div>
|
||||
</section>
|
||||
<!-- <section class="container mx-auto">
|
||||
<div>
|
||||
<dialog id="d" class="w-[50%]">
|
||||
<form method="dialog">
|
||||
<p>Modal Content Modal Content Lorem ipsum dolor sit, amet consectetur adipisicing elit. Hic consequatur aspernatur, explicabo sequi perspiciatis quisquam voluptates tenetur placeat numquam consectetur! Tempore expedita facilis tempora labore at illo beatae eligendi magnam.</p>
|
||||
<button>ok</button>
|
||||
</form>
|
||||
</dialog>
|
||||
<button onclick="d.showModal()">Open</button>
|
||||
</div>
|
||||
</section> -->
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
|
||||
<script is:inline>
|
||||
function qryWithLang(){
|
||||
let langValue = document.getElementById('language').value;
|
||||
document.getElementById('systemMessage').value = `need title, heading not more than 160 characters, meta_title not more than 60 characters, meta_description not more than 160 characters, short_description not more than 280 characters, long_description below 2000 characters, all are ${langValue} language all in a json structure`;
|
||||
// give me long description below 2000 characters, title, heading not more than 160 characters, short desciption not more than 280 characters, meta_title not more than 60 characters and try to use common words, meta_description not more than 160 characters and try to use common words, all text are convert to ${langValue} language, give me all in a json structure`
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
}
|
||||
function buttonVisibility() {
|
||||
var preTextValue = document.getElementById('preText').value.trim();
|
||||
var systemMessageValue = document.getElementById('systemMessage').value.trim();
|
||||
var languageValue = document.getElementById('language').value;
|
||||
var categoryValue = document.getElementById('category').value;
|
||||
var genButton = document.getElementById('genButton');
|
||||
var genButton2 = document.getElementById('genButton2');
|
||||
if (preTextValue.length > 0 && systemMessageValue.length > 0 && languageValue !== null) {
|
||||
genButton.style.display = 'block';
|
||||
genButton2.style.display = 'none';
|
||||
} else {
|
||||
genButton.style.display = 'none';
|
||||
genButton2.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function submitNewsPara(event) {
|
||||
function saveFile(event){
|
||||
event.preventDefault();
|
||||
let genButton = document.getElementById('genButton');
|
||||
let langInput = document.getElementById('language');
|
||||
let loadSection = document.getElementById('loadingSection');
|
||||
let newsData = document.getElementById('newsPara');
|
||||
loadSection.style.display = 'block';
|
||||
genButton.disabled = true;
|
||||
langInput.disabled = true;
|
||||
genButton.style.cursor = 'not-allowed';
|
||||
|
||||
let formData = new FormData(newsData);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/`, {
|
||||
let formID = document.getElementById('formID');
|
||||
let formData = new FormData(formID);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/upload_file/v2/`,{
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
// if (data === 200) {
|
||||
// counter++;
|
||||
// } else {
|
||||
// formSection genButton brightness-50
|
||||
console.log(data)
|
||||
// }
|
||||
if(data.error_code == 8050){
|
||||
document.getElementById('errorMessage').innerHTML = data.error;
|
||||
document.getElementById('errorMessage').style.display = 'block';
|
||||
document.getElementById('errorMessage2').style.display = 'none';
|
||||
}
|
||||
if(data.error_code == 8051){
|
||||
document.getElementById('errorMessage2').innerHTML = data.error;
|
||||
document.getElementById('errorMessage2').style.display = 'block';
|
||||
document.getElementById('errorMessage').style.display = 'none';
|
||||
}
|
||||
if(data.file_url){
|
||||
document.getElementById('fileLink').value = data.file_url;
|
||||
}
|
||||
console.log(data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
})
|
||||
}
|
||||
function qryWithLang(){
|
||||
let langValue = document.getElementById('language').value;
|
||||
document.getElementById('systemMessage').value = `provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters, heading within 170 characters in en, bn, hi, zh, es, pt, ru, fr, ur, ar all in a json structure no use comma after line ending`;
|
||||
// give me long description below 2000 characters, title, heading not more than 160 characters, short desciption not more than 280 characters, meta_title not more than 60 characters and try to use common words, meta_description not more than 160 characters and try to use common words, all text are convert to ${langValue} language, give me all in a json structure`
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
// need title, heading not more than 160 characters, meta_title not more than 60 characters, meta_description not more than 160 characters, short_description not more than 280 characters, long_description below 2000 characters, all are ${langValue} language all in a json structure
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali, hindi, Mandarin, Spanish, Portuguese, Russian, French, all in a json structure
|
||||
}
|
||||
|
||||
function submitNewsPara(event) {
|
||||
event.preventDefault();
|
||||
let loadSection = document.getElementById('loadingSection');
|
||||
let newsData = document.getElementById('newsPara');
|
||||
let formData = new FormData(newsData);
|
||||
loadSection.style.display = 'block';
|
||||
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/multi-lang/`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
let newsData = data.choices[0].message.content;
|
||||
if(newsData){
|
||||
document.getElementById('formSection').style.display = 'block';
|
||||
document.getElementById('genStatus').style.display = 'block';
|
||||
loadSection.style.display = 'none';
|
||||
genButton.disabled = false;
|
||||
genButton.style.cursor = 'pointer';
|
||||
langInput.disabled = false;
|
||||
// document.getElementById('loadingSection').classList.remove = 'brightness-50';
|
||||
// document.getElementById('genButton').classList.remove = 'disabled';
|
||||
}
|
||||
let jsonObject = JSON.parse(newsData);
|
||||
document.getElementById('title').value = jsonObject.title;
|
||||
document.getElementById('slug').value = jsonObject.title;
|
||||
document.getElementById('heading').value = jsonObject.heading;
|
||||
document.getElementById('meta_title').value = jsonObject.meta_title;
|
||||
document.getElementById('meta_description').value = jsonObject.meta_description;
|
||||
document.getElementById('in_brief').value = jsonObject.short_description;
|
||||
document.getElementById('content').value = jsonObject.long_description;
|
||||
if(jsonObject.long_description){
|
||||
// document.getElementById('content').value = jsonObject.long_description;
|
||||
}
|
||||
// Sample array
|
||||
|
||||
// Using forEach to log each element
|
||||
// jsonObject.forEach(function(arrayData) {
|
||||
// console.log('Array Data', arrayData);
|
||||
// });
|
||||
|
||||
// console.log(jsonObject.en)
|
||||
// console.log(jsonObject.bn)
|
||||
|
||||
// document.getElementById('title').value = jsonObject.title;
|
||||
// document.getElementById('slug').value = jsonObject.title;
|
||||
// document.getElementById('heading').value = jsonObject.heading;
|
||||
// document.getElementById('meta_title').value = jsonObject.meta_title;
|
||||
// document.getElementById('meta_description').value = jsonObject.meta_description;
|
||||
// document.getElementById('in_brief').value = jsonObject.short_description;
|
||||
// document.getElementById('content').value = jsonObject.long_description;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error occurred', error);
|
||||
|
@ -246,6 +187,20 @@ import Layout from "../../layouts/Layout.astro";
|
|||
console.error('Error occurred', error);
|
||||
});
|
||||
}
|
||||
// function imagePreview() {
|
||||
// let fileInput = document.getElementById('file');
|
||||
// let file = fileInput.files[0];
|
||||
// let imgView = document.getElementById('imgview');
|
||||
// if (file) {
|
||||
// document.getElementById('imgview').style.display = 'block';
|
||||
// let imgUrl = URL.createObjectURL(file);
|
||||
// imgView.src = imgUrl;
|
||||
// document.getElementById('imgDIV').classList.add('border-2', 'border-[#780a0a]', 'rounded-xl');
|
||||
// } else {
|
||||
// imgView.src = "";
|
||||
// }
|
||||
// }
|
||||
|
||||
</script>
|
||||
<style>
|
||||
#loadingSection{
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import AdminHeader from "../../components/AdminHeader.astro";
|
||||
---
|
||||
<Layout title="Edit News | Barta-India">
|
||||
<AdminHeader />
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="flex flex-col">
|
||||
<p class="text-2xl">Edit News</p>
|
||||
<select name="lang" id="lang">Select Language
|
||||
<!-- <select name="lang" id="lang">Select Language
|
||||
<option value="en">English</option>
|
||||
<option value="bn">Bengali</option>
|
||||
<option value="hi">Hindi</option>
|
||||
<option value="zh">Mandarine</option>
|
||||
<option value="se">Spanish</option>
|
||||
</select>
|
||||
</select> -->
|
||||
<table class="border-2">
|
||||
<thead>
|
||||
<tr class="text-center">
|
||||
|
@ -44,7 +46,7 @@ import Layout from "../../layouts/Layout.astro";
|
|||
let cellEdit = row.insertCell(2);
|
||||
let editButton = document.createElement('a');
|
||||
editButton.innerText = 'Edit';
|
||||
editButton.href = `/editor/?edit=${singleData.slug}&lang=${document.getElementById('lang').value}`
|
||||
editButton.href = `/editor/?edit=${singleData.slug}&lang=en`
|
||||
editButton.addEventListener('click', function() {
|
||||
// Add your edit functionality here
|
||||
// console.log('Editing ID:', singleData.id);
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import EditNews from "../../components/EditNews.vue";
|
||||
import AdminHeader from "../../components/AdminHeader.astro";
|
||||
---
|
||||
<Layout title="Edit News | Barta-India">
|
||||
<AdminHeader />
|
||||
<main>
|
||||
<div>
|
||||
<EditNews client:visible />
|
||||
|
||||
</div>
|
||||
</main>
|
||||
<!-- </Layout>
|
||||
|
|
|
@ -0,0 +1,267 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
// import ImageUpload from "../../components/ImageUpload.vue";
|
||||
---
|
||||
|
||||
<Layout title="Add News | Barta India">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4 md:max-w-3xl mt-40 space-y-4 shadow-xl rounded-xl p-4">
|
||||
<h1 class="text-center text-2xl underline decoration-4 decoration-[#580a0a]">Genarate New News</h1>
|
||||
<form id="newsPara" class="flex flex-col space-y-4" enctype="multipart/form-data">
|
||||
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select required onchange="qryWithLang();" name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option value="0">-Select-</option>
|
||||
<option value="english">English</option>
|
||||
<option value="bengali">Bengali</option>
|
||||
</select>
|
||||
<div class="flex flex-col">
|
||||
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option value="0">-Select-</option>
|
||||
<option value="national">National</option>
|
||||
<option value="politics">Politics</option>
|
||||
<option value="local">Local</option>
|
||||
<option value="technology">Technology</option>
|
||||
<option value="world">World</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col ">
|
||||
<label for="preText">News Paragraph</label>
|
||||
<textarea onchange="buttonVisibility();" required name="preText" id="preText" cols="30" maxlength="1000000" rows="10" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<textarea required name="systemMessage" id="systemMessage" cols="30" rows="3" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"></textarea>
|
||||
</div>
|
||||
<div>
|
||||
<button id="genButton" style="display: none;" onclick="submitNewsPara(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg" >Genarate</button>
|
||||
<button id="genButton2" style="display: block;" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg opacity-50 cursor-not-allowed" >Genarate</button>
|
||||
</div>
|
||||
<!-- <input id="message" type="text" value="" class="border-2 border-[#580a0a] p-2 focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl"/> -->
|
||||
</form>
|
||||
</section>
|
||||
<section id="formSection" style="display: none;" class="container mx-auto md:max-w-3xl px-4 shadow-xl rounded-xl p-6">
|
||||
<div class="flex justify-center">
|
||||
<h1 class="text-xl my-6 p-2 border-2 bg-[#580a0a] text-white rounded-full">Add News to Barta-India's Page</h1>
|
||||
</div>
|
||||
<p>All(<span class="text-[#580a0a] font-bold">*</span>) are mandatory fields</p>
|
||||
<form id="newsForm" class="flex flex-col space-y-4">
|
||||
<div class="flex flex-col">
|
||||
<label for="status">Status<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="status" id="status" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
|
||||
<option value="null">-Select-</option>
|
||||
<option value="published">Published</option>
|
||||
<option value="draft">Draft</option>
|
||||
<option value="archived">Archived</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="language">Language<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="language" id="language" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" required>
|
||||
<option value="null">-Select-</option>
|
||||
<option value="bengali">Bengali</option>
|
||||
<option value="english">English</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="category">Category<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<select name="category" id="category" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2">
|
||||
<option value="null">-Select-</option>
|
||||
<option value="national">National</option>
|
||||
<option value="politics">Politics</option>
|
||||
<option value="local">Local</option>
|
||||
<option value="technology">Technology</option>
|
||||
<option value="world">World</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="title">Title<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="title" id="title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="slug">Slug<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input oninput="updateSlug();" name="slug" id="slug" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="heading">Heading<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="heading" id="heading" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="meta_title">Meta Title<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="meta_title" id="meta_title" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 60 characters & try to use common words" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="meta_description">Meta Description<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="meta_description" id="meta_description" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 160 characters & try to use common words" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="in_brief">In Brief<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<input name="in_brief" id="in_brief" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl p-2" type="text" placeholder="max: length 280 characters & try to descibe" required>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label class="text-lg" for="content">News Description<span class="text-[#580a0a] font-bold">*</span></label>
|
||||
<textarea class="border-2 p-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" name="content" id="content" cols="30" rows="10" required></textarea>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<label for="upldFile">Upload File</label>
|
||||
<input id="upldFile" class="border-2 border-[#580a0a] focus:outline-none focus:border-4 focus:border-[#580a0a] rounded-xl" type="file">
|
||||
</div>
|
||||
<div class="flex float-right">
|
||||
<button onclick="callApi(event);" class="bg-[#580a0a] text-white px-4 py-2 rounded-lg">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<section class="bg-white rounded-full px-6 py-4" id="loadingSection" style="display: none;">
|
||||
<div class="flex flex-col justify-center place-items-center">
|
||||
<div class="load-aimate animate-spin "></div>
|
||||
<p>Processing...</p>
|
||||
</div>
|
||||
</section>
|
||||
<!-- <section class="container mx-auto">
|
||||
<div>
|
||||
<dialog id="d" class="w-[50%]">
|
||||
<form method="dialog">
|
||||
<p>Modal Content Modal Content Lorem ipsum dolor sit, amet consectetur adipisicing elit. Hic consequatur aspernatur, explicabo sequi perspiciatis quisquam voluptates tenetur placeat numquam consectetur! Tempore expedita facilis tempora labore at illo beatae eligendi magnam.</p>
|
||||
<button>ok</button>
|
||||
</form>
|
||||
</dialog>
|
||||
<button onclick="d.showModal()">Open</button>
|
||||
</div>
|
||||
</section> -->
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
|
||||
<script is:inline>
|
||||
function qryWithLang(){
|
||||
let langValue = document.getElementById('language').value;
|
||||
document.getElementById('systemMessage').value = `need title, heading not more than 160 characters, meta_title not more than 60 characters, meta_description not more than 160 characters, short_description not more than 280 characters, long_description below 2000 characters, all are ${langValue} language all in a json structure`;
|
||||
// give me long description below 2000 characters, title, heading not more than 160 characters, short desciption not more than 280 characters, meta_title not more than 60 characters and try to use common words, meta_description not more than 160 characters and try to use common words, all text are convert to ${langValue} language, give me all in a json structure`
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
// provide meta_title within 60 characters, meta_description within 160 characters, short_description within 280 characters in English, bengali and hindi all in a json structure
|
||||
}
|
||||
function buttonVisibility() {
|
||||
var preTextValue = document.getElementById('preText').value.trim();
|
||||
var systemMessageValue = document.getElementById('systemMessage').value.trim();
|
||||
var languageValue = document.getElementById('language').value;
|
||||
var categoryValue = document.getElementById('category').value;
|
||||
var genButton = document.getElementById('genButton');
|
||||
var genButton2 = document.getElementById('genButton2');
|
||||
if (preTextValue.length > 0 && systemMessageValue.length > 0 && languageValue !== null) {
|
||||
genButton.style.display = 'block';
|
||||
genButton2.style.display = 'none';
|
||||
} else {
|
||||
genButton.style.display = 'none';
|
||||
genButton2.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function submitNewsPara(event) {
|
||||
event.preventDefault();
|
||||
let genButton = document.getElementById('genButton');
|
||||
let langInput = document.getElementById('language');
|
||||
let loadSection = document.getElementById('loadingSection');
|
||||
let newsData = document.getElementById('newsPara');
|
||||
loadSection.style.display = 'block';
|
||||
genButton.disabled = true;
|
||||
langInput.disabled = true;
|
||||
genButton.style.cursor = 'not-allowed';
|
||||
|
||||
let formData = new FormData(newsData);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
// if (data === 200) {
|
||||
// counter++;
|
||||
// } else {
|
||||
// formSection genButton brightness-50
|
||||
console.log(data)
|
||||
// }
|
||||
let newsData = data.choices[0].message.content;
|
||||
if(newsData){
|
||||
document.getElementById('formSection').style.display = 'block';
|
||||
loadSection.style.display = 'none';
|
||||
genButton.disabled = false;
|
||||
genButton.style.cursor = 'pointer';
|
||||
langInput.disabled = false;
|
||||
// document.getElementById('loadingSection').classList.remove = 'brightness-50';
|
||||
// document.getElementById('genButton').classList.remove = 'disabled';
|
||||
}
|
||||
let jsonObject = JSON.parse(newsData);
|
||||
document.getElementById('title').value = jsonObject.title;
|
||||
document.getElementById('slug').value = jsonObject.title;
|
||||
document.getElementById('heading').value = jsonObject.heading;
|
||||
document.getElementById('meta_title').value = jsonObject.meta_title;
|
||||
document.getElementById('meta_description').value = jsonObject.meta_description;
|
||||
document.getElementById('in_brief').value = jsonObject.short_description;
|
||||
document.getElementById('content').value = jsonObject.long_description;
|
||||
if(jsonObject.long_description){
|
||||
// document.getElementById('content').value = jsonObject.long_description;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error occurred', error);
|
||||
});
|
||||
}
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase()
|
||||
.replace(/\s+/g, '-') // Replace spaces with -
|
||||
.replace(/[^\w-]+/g, '') // Remove all non-word characters
|
||||
.replace(/--+/g, '-') // Replace multiple - with single -
|
||||
.replace(/^-+/, '') // Trim - from start of text
|
||||
.replace(/-+$/, ''); // Trim - from end of text
|
||||
}
|
||||
|
||||
function updateSlug() {
|
||||
const titleInput = document.getElementById('slug');
|
||||
const slugInput = document.getElementById('slug');
|
||||
const titleValue = titleInput.value;
|
||||
slugInput.value = slugify(titleValue);
|
||||
}
|
||||
|
||||
function callApi(event) {
|
||||
event.preventDefault();
|
||||
let slugValue = document.getElementById('slug').value;
|
||||
let newsData = document.getElementById('newsForm');
|
||||
let formData = new FormData(newsData);
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/news/add-news/?action=save`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
})
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
if (data.success === true) {
|
||||
window.location.href= `/add-file?slug=${slugValue}`
|
||||
// console.log(slugValue)
|
||||
console.log('Form Data Submitted Successfully');
|
||||
} else {
|
||||
console.log('Data Submit Failed');
|
||||
}
|
||||
console.log(data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error occurred', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
#loadingSection{
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.load-aimate{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
border-left: 5px solid #580a0a;
|
||||
border-right: 5px solid #580a0a;
|
||||
border-bottom: 5px solid #580a0a;
|
||||
border-top: 5px solid #FFFFFF;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en', options);
|
||||
const data = await response.json();
|
||||
const finalData = data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en', options);
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data[idx];
|
||||
// console.log(items)
|
||||
---
|
||||
<Layout title=""
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={items.img}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={items.img}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/en/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/en/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/en/${items.slug}`>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={items.img} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/en/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/en/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/en/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/en/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify mt-4">{items.content}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import Layout from "../../../layouts/Layout.astro"
|
||||
import ENCategory from "../../../components/ENCategory.vue";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="text-[#780a0a] py-6 flex flex-row" id="">
|
||||
<a id="folder" href="/en"></a> >
|
||||
<p id="cat"></p>
|
||||
</div>
|
||||
<ENCategory client:visible />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let fullURL = window.location.href.split('/');
|
||||
console.log(fullURL);
|
||||
let folderName = document.getElementById('folder').innerHTML = fullURL[3];
|
||||
let catName = document.getElementById('cat').innerHTML = fullURL[5].split('?cat=')[1]
|
||||
</script>
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="flex flex-row md:justify-center my-10 overflow-x-scroll md:overflow-x-clip">
|
||||
<a href="/en/cat/?cat=local" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Local</a>
|
||||
<a href="/en/cat/?cat=national" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">National</a>
|
||||
<a href="/en/cat/?cat=world" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">World</a>
|
||||
<a href="/en/cat/?cat=politics" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Politics</a>
|
||||
<a href="/en/cat/?cat=technology" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Technology</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{news.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/en/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={items.img} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/en/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={items.img} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/share.php?u=https://barta-india.in/en/${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a href={`/en/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
<!-- <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p> -->
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_es', options);
|
||||
const data = await response.json();
|
||||
const finalData = data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_es', options);
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data[idx];
|
||||
// console.log(items)
|
||||
---
|
||||
<Layout title=""
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={items.img}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={items.img}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/zh/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/zh/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/zh/${items.slug}`>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={items.img} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/zh/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/zh/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/zh/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/zh/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify mt-4">{items.content}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import Layout from "../../../layouts/Layout.astro"
|
||||
import ESCategory from "../../../components/ESCategory.vue";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_zh', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="text-[#780a0a] py-6 flex flex-row" id="">
|
||||
<a id="folder" href="/es"></a> >
|
||||
<p id="cat"></p>
|
||||
</div>
|
||||
<ESCategory client:visible />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let fullURL = window.location.href.split('/');
|
||||
// console.log(fullURL);
|
||||
let folderName = document.getElementById('folder').innerHTML = fullURL[3];
|
||||
let catName = document.getElementById('cat').innerHTML = fullURL[5].split('?cat=')[1]
|
||||
</script>
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_es', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="flex flex-row md:justify-center my-10 overflow-x-scroll md:overflow-x-clip">
|
||||
<a href="/es/cat/?cat=local" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Local</a>
|
||||
<a href="/es/cat/?cat=national" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">National</a>
|
||||
<a href="/es/cat/?cat=world" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">World</a>
|
||||
<a href="/es/cat/?cat=politics" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Politics</a>
|
||||
<a href="/es/cat/?cat=technology" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Technology</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{news.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/es/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={items.img} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/es/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={items.img} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/es/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/share.php?u=https://barta-india.in/es/${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/es/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/es/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a href={`/es/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
<!-- <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p> -->
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_hi', options);
|
||||
const data = await response.json();
|
||||
const finalData = data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_hi', options);
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data[idx];
|
||||
// console.log(items)
|
||||
---
|
||||
<Layout title=""
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={items.img}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={items.img}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/hi/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/hi/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/hi/${items.slug}`>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={items.img} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/hi/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/hi/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/hi/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/hi/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify mt-4">{items.content}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import Layout from "../../../layouts/Layout.astro"
|
||||
import HICategory from "../../../components/HICategory.vue";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_hi', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="text-[#780a0a] py-6 flex flex-row" id="">
|
||||
<a id="folder" href="/hi"></a> >
|
||||
<p id="cat"></p>
|
||||
</div>
|
||||
<HICategory client:visible />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let fullURL = window.location.href.split('/');
|
||||
// console.log(fullURL);
|
||||
let folderName = document.getElementById('folder').innerHTML = fullURL[3];
|
||||
let catName = document.getElementById('cat').innerHTML = fullURL[5].split('?cat=')[1]
|
||||
</script>
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_hi', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="flex flex-row md:justify-center my-10 overflow-x-scroll md:overflow-x-clip">
|
||||
<a href="/hi/cat/?cat=local" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Local</a>
|
||||
<a href="/hi/cat/?cat=national" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">National</a>
|
||||
<a href="/hi/cat/?cat=world" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">World</a>
|
||||
<a href="/hi/cat/?cat=politics" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Politics</a>
|
||||
<a href="/hi/cat/?cat=technology" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Technology</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{news.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/hi/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={items.img} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/hi/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={items.img} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/hi/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/share.php?u=https://barta-india.in/hi/${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/hi/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/hi/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a href={`/hi/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
<!-- <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p> -->
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
import Layout from "../layouts/Layout.astro";
|
||||
import GetData from "../components/GetData.vue"
|
||||
const fetchData = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/');
|
||||
const dataJSON = await fetchData.json();
|
||||
const data = dataJSON.data;
|
||||
console.log(data);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<GetData client:visible />
|
||||
<p>News List</p>
|
||||
<div>
|
||||
<button onclick="getData();">Get Data</button>
|
||||
<p id="dataID"></p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
function getData(){
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en`)
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("an error occoured", error)
|
||||
})
|
||||
// fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_en')
|
||||
// .then(response => {
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Network response was not ok');
|
||||
// }
|
||||
// return response.json();
|
||||
// })
|
||||
// .then(data => {
|
||||
// // Handle the JSON response data
|
||||
// console.log(data);
|
||||
// })
|
||||
// .catch(error => {
|
||||
// // Handle any errors that occurred during the fetch
|
||||
// console.error('Fetch error:', error);
|
||||
// });
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div>
|
||||
<button onclick="getWeather();">Get Data</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
function getWeather(){
|
||||
fetch(`https://apisp.dev2.cicdhosting.com/_dedicated/dwd/runner/weather/openweathermap/test/`)
|
||||
.then(data => data.json())
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
})
|
||||
}
|
||||
</script>
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
async function getWeatherData(city) {
|
||||
const apiKey = 'aed8dd87581613e1d2bbbf63eeb618da';
|
||||
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${city}&appid=${apiKey}`;
|
||||
const apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=Los%20Angeles&appid=${apiKey}`;
|
||||
|
||||
try {
|
||||
const response = await fetch(apiUrl);
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_zh', options);
|
||||
const data = await response.json();
|
||||
const finalData = data.map((n: { slug: string | undefined; })=>{
|
||||
return {params: {id:n.slug}}
|
||||
})
|
||||
return finalData;
|
||||
}
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_zh', options);
|
||||
const data = await response.json();
|
||||
const { id } = Astro.params;
|
||||
const idx = data.findIndex((n: { slug: string | undefined; }) => n.slug ===id);
|
||||
const items = data[idx];
|
||||
// console.log(items)
|
||||
---
|
||||
<Layout title=""
|
||||
metaTitle={items.meta_title}
|
||||
description={items.meta_description}
|
||||
ogImg={items.img}
|
||||
tiwtterCard="summary_large_image"
|
||||
tiwtterImage={items.img}
|
||||
tiwtterTitle={items.meta_title}
|
||||
tiwtterDesc={items.meta_description}
|
||||
tiwtterURL=`https://barta-india.in/zh/${items.slug}`
|
||||
artPubTime={items.date_created}
|
||||
ogSiteName=`https://barta-india.in/zh/${items.slug}`
|
||||
ogType='News'
|
||||
ogTitle={items.meta_title}
|
||||
ogDesc={items.meta_description}
|
||||
ogURL=`https://barta-india.in/zh/${items.slug}`>
|
||||
<main>
|
||||
<section class="container mx-auto px-4 mt-16">
|
||||
<div class="flex flex-col justify-center">
|
||||
<div class=""><button onclick="toggleSpeech();" id="listenButton" class="float-right text-white font-bold px-6 py-2 rounded-lg bg-[#780a0a]">Listen</button></div>
|
||||
<h1 id="message1" class="text-3xl font-bold border-b-4 border-[#780A0A]">{items.heading}</h1>
|
||||
<h2 id="message2" class="text-xl py-2">{items.title}</h2>
|
||||
<div class="flex flex-col place-items-center">
|
||||
<img src={items.img} alt={items.title} class="md:w-[40%]" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-center md:justify-end mt-2">
|
||||
<div class="flex flex-row place-items-center p-2 shadow-lg shadow-[#780a0a] border-b-2 border-[#780a0a] rounded-b-2xl w-fit">
|
||||
<p class="text-xl font-bold text-[#780a0a]">Share on: </p>
|
||||
<a href=`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/zh/${items.slug}` data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a href=`https://www.facebook.com/share.php?u=https://barta-india.in/zh/${items.slug}` target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a href=`http://www.twitter.com/share?url=https://barta-india.in/zh/${items.slug}&text=%20${items.title}` target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a href=`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/zh/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}` onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-justify mt-4">{items.content}</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let isListening = false;
|
||||
let speechSynthesisInstance = window.speechSynthesis;
|
||||
|
||||
function toggleSpeech() {
|
||||
if (isListening) {
|
||||
stopSpeech();
|
||||
} else {
|
||||
startSpeech();
|
||||
}
|
||||
}
|
||||
|
||||
function startSpeech() {
|
||||
let message1 = document.getElementById('message1').innerText;
|
||||
let message2 = document.getElementById('message2').innerText;
|
||||
let allSpeechText = message1 + ' ' + message2;
|
||||
|
||||
let speechText = new SpeechSynthesisUtterance(allSpeechText);
|
||||
speechText.lang = 'bn'; // Set language to Bengali
|
||||
|
||||
speechSynthesisInstance.speak(speechText);
|
||||
|
||||
document.getElementById('listenButton').innerText = 'Stop';
|
||||
isListening = true;
|
||||
}
|
||||
|
||||
function stopSpeech() {
|
||||
speechSynthesisInstance.cancel();
|
||||
document.getElementById('listenButton').innerText = 'Listen';
|
||||
isListening = false;
|
||||
}
|
||||
// if(window.location.reload()){
|
||||
// isListening = false;
|
||||
// }
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
import Layout from "../../../layouts/Layout.astro"
|
||||
import ZHCategory from "../../../components/ZHCategory.vue";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_zh', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<div>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="text-[#780a0a] py-6 flex flex-row" id="">
|
||||
<a id="folder" href="/zh"></a> >
|
||||
<p id="cat"></p>
|
||||
</div>
|
||||
<ZHCategory client:visible />
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</Layout>
|
||||
<script is:inline>
|
||||
let fullURL = window.location.href.split('/');
|
||||
// console.log(fullURL);
|
||||
let folderName = document.getElementById('folder').innerHTML = fullURL[3];
|
||||
let catName = document.getElementById('cat').innerHTML = fullURL[5].split('?cat=')[1]
|
||||
</script>
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
const postData = { key1: 'value1', key2: 'value2'};
|
||||
const options = { method: 'POST', headers: { 'Content-Type': 'application/json', 'Origin': 'https://2024.dev2-cs.siliconpin.com' }, body: JSON.stringify(postData)};
|
||||
const response = await fetch('https://apisp.dev2.cicdhosting.com/_dedicated/dwd/get-news/?action=news_zh', options);
|
||||
const data = await response.json();
|
||||
const news = data;
|
||||
// console.log(news);
|
||||
---
|
||||
<Layout title="">
|
||||
<main>
|
||||
<section class="container mx-auto px-4">
|
||||
<div class="my-16">
|
||||
<span class="text-[#780a0a] font-bold" id="pageName"></span>
|
||||
<h1 class="text-4xl font-bold border-b-4 border-[#780A0A]">Latest News</h1>
|
||||
</div>
|
||||
<div class="flex flex-row md:justify-center my-10 overflow-x-scroll md:overflow-x-clip">
|
||||
<a href="/zh/cat/?cat=local" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Local</a>
|
||||
<a href="/zh/cat/?cat=national" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">National</a>
|
||||
<a href="/zh/cat/?cat=world" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">World</a>
|
||||
<a href="/zh/cat/?cat=politics" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Politics</a>
|
||||
<a href="/zh/cat/?cat=technology" class="border-2 border-[#780a0a] py-2.5 px-6 text-lg text-[#780a0a] hover:bg-[#780a0a50] duration-[1s]">Technology</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">
|
||||
{news.map((items: {id: string | undefined; heading: string | undefined; img: string | undefined; title : string | undefined; content : string | undefined; slug : string | undefined; date_created : string | undefined; in_brief: string | undefined;}) =>
|
||||
<div class="flex flex-col border-2 border-[#780a0a] gap-6 p-4 place-content-between rounded-lg">
|
||||
<div class="flex flex-col">
|
||||
<div class="">
|
||||
<a class="flex flex-col" href={`/zh/${items.slug}`}>
|
||||
<img class="aspect-video rounded-t-lg" src={items.img} alt={items.title} />
|
||||
<h2 class="text-lg text-justify ">{items.title}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<dialog id={`d-${items.id}`} class="shadow-xl rounded-xl md:w-[50%] xl:w-[30%]">
|
||||
<form method="dialog">
|
||||
<div class="flex flex-col md:flex-col">
|
||||
<a href={`/zh/${items.slug}`} class="flex flex-col md:flex-col">
|
||||
<img class="rounded-t-xl" src={items.img} alt={items.title} />
|
||||
<h1 class="text-lg font-bold">{items.heading} </h1>
|
||||
<h2 class="text-justify ">{items.in_brief}</h2>
|
||||
</a>
|
||||
<div class="flex flex-row place-content-between place-items-center">
|
||||
<div class="flex flex-row place-content-between place-items-center p-2 space-x-6 shadow-lg shadow-gray-400 rounded-2xl">
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`whatsapp://send?text=${items.title}%20%0A%20https://barta-india.in/zh/${items.slug}`} data-action="share/whatsapp/share"><img src="/img/whatsapp.svg" alt="WhatsApp Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.facebook.com/share.php?u=https://barta-india.in/zh/${items.slug}`} target="_blank"><img src="/img/facebook.svg" alt="Facebook Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`http://www.twitter.com/share?url=https://barta-india.in/zh/${items.slug}&text=${items.title}`} target="_blank"><img src="/img/x.svg" alt="Twitter/X Logo"/></a>
|
||||
<a class="hover:-translate-y-2 duration-[1s]" href={`https://www.linkedin.com/shareArticle?mini=true&url=https://barta-india.in/zh/${items.slug}&title=${items.title}&summary=${items.title}&source=${items.title}`} onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><img src="/img/link.svg" alt="Linkdin Logo"/></a>
|
||||
</div>
|
||||
<div class="flex border-b-4 border-gray-500 border-t rounded-full text-3xl hover:rotate-180 duration-[3s]">
|
||||
<button class="text-white font-bold py-2 px-4 bg-[#780a0a] rounded-full shadow-xl" onclick={`document.getElementById('d-${items.id}').close()`}>✘</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-row place-content-between">
|
||||
<button onclick={`document.getElementById('d-${items.id}').showModal()`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">In Brief</button>
|
||||
<a href={`/zh/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold py-2 px-6">Details</a>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<!-- <a href={`/${items.slug}`} class="bg-[#780A0A] text-white rounded-md font-bold px-6 ">Read More>></a> -->
|
||||
<!-- <p class="">Publish at: <br/> {items.date_created.split(':')[0].split('T')[0]}</p> -->
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</Layout>
|
Loading…
Reference in New Issue