bugfixing: switch between hot and new posts
This commit is contained in:
parent
dcfa7dbc30
commit
016f18809c
@ -284,7 +284,7 @@ $: {
|
|||||||
{/if}
|
{/if}
|
||||||
</form>
|
</form>
|
||||||
<!--End Upvote-->
|
<!--End Upvote-->
|
||||||
<label class="px-6 py-4 w-14 rounded-lg bg-[#202020] border border-gray-700 text-[1rem] text-bold text-white">
|
<label class="text-center py-4 w-14 rounded-lg bg-[#202020] border border-gray-700 text-[1rem] text-bold text-white">
|
||||||
{upvoteCounter[posts?.id] - downvoteCounter[posts?.id] }
|
{upvoteCounter[posts?.id] - downvoteCounter[posts?.id] }
|
||||||
</label>
|
</label>
|
||||||
<!--Start Downvote-->
|
<!--Start Downvote-->
|
||||||
|
|||||||
@ -235,9 +235,7 @@ onMount( async() => {
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- End Column -->
|
<!-- End Column -->
|
||||||
|
|
||||||
@ -254,7 +252,7 @@ onMount( async() => {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full max-w-3xl m-auto mb-20 flex justify-center items-center">
|
<div class="w-full max-w-3xl m-auto mb-20 -mt-4 flex justify-center items-center">
|
||||||
<a href="/community" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
<a href="/community" class="px-4 py-3 text-white bg-[#202327] rounded-lg flex flex-row items-center font-medium transition duration-150 ease-in-out group">
|
||||||
<span>Follow the Community </span>
|
<span>Follow the Community </span>
|
||||||
<span class="ml-1 mt-0.5 tracking-normal group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out">
|
<span class="ml-1 mt-0.5 tracking-normal group-hover:translate-x-0.5 transition-transform duration-150 ease-in-out">
|
||||||
|
|||||||
@ -56,7 +56,7 @@ async function infiniteHandler({ detail: { loaded, complete } })
|
|||||||
{
|
{
|
||||||
|
|
||||||
// console.log("Page position:", window.pageYOffset);
|
// console.log("Page position:", window.pageYOffset);
|
||||||
seenPostId = posts?.map(obj => obj.id);
|
seenPostId = posts?.map(obj => obj?.id);
|
||||||
|
|
||||||
if (!postLoading && !noPostMore) {
|
if (!postLoading && !noPostMore) {
|
||||||
postLoading = true;
|
postLoading = true;
|
||||||
@ -244,7 +244,7 @@ onMount(async () => {
|
|||||||
|
|
||||||
else {
|
else {
|
||||||
// Use cached data if available
|
// Use cached data if available
|
||||||
posts = $cachedPosts[0].posts;
|
posts = $cachedPosts?.at(0)?.posts;
|
||||||
communityStats = getCache('', 'getCommunityStats');
|
communityStats = getCache('', 'getCommunityStats');
|
||||||
moderators = getCache('', 'getModerators');
|
moderators = getCache('', 'getModerators');
|
||||||
discordData = getCache('','getDiscordWidget');
|
discordData = getCache('','getDiscordWidget');
|
||||||
@ -269,22 +269,19 @@ onDestroy(async () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
let sortingPosts = $cachedPosts?.at(0)?.sortingPosts?.length > 0 ? $cachedPosts?.at(0)?.sortingPosts : 'new';
|
let sortingPosts = $cachedPosts?.at(0)?.sortingPosts?.length > 0 ? $cachedPosts?.at(0)?.sortingPosts : 'hot';
|
||||||
|
|
||||||
async function handleCategoryOfPosts(state) {
|
async function handleCategoryOfPosts(state) {
|
||||||
loading = true;
|
loading = true;
|
||||||
posts = null;
|
posts = [];
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
postLoading = false;
|
postLoading = false;
|
||||||
seenPostId = [];
|
seenPostId = [];
|
||||||
noPostMore = false;
|
noPostMore = false;
|
||||||
|
|
||||||
sortingPosts = state;
|
sortingPosts = state;
|
||||||
|
$cachedPosts = [];
|
||||||
posts = await getPost();
|
posts = await getPost();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -346,6 +343,7 @@ $: {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user