Merge pull request #48 from emailerfacu-spec/dev

Hotfix
This commit is contained in:
emailerfacu-spec
2025-12-26 16:41:08 -03:00
committed by GitHub
3 changed files with 18 additions and 7 deletions
+3 -2
View File
@@ -38,7 +38,7 @@
}); });
if (image === null) return; if (image === null) return;
cargando = true; cargando = true;
await updateUsuario({ id: data.id, profileImage: true, image: image }); await updateUsuario({ id: data.id, profileImage: false, image: image });
let ret = await obtenerUsuarioPorUsername(data.username); let ret = await obtenerUsuarioPorUsername(data.username);
if (ret) { if (ret) {
data = { ...data, ...ret }; data = { ...data, ...ret };
@@ -92,7 +92,8 @@
</h1> </h1>
{#if usu.bio} {#if usu.bio}
<p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground"> <p class="mt-4 rounded-4xl bg-accent p-4 text-center text-muted-foreground">
{@html usu.bio.replaceAll('\n', '<br>')} {usu.bio.replaceAll('\n', '<br>')}
<!-- {@html usu.bio.replaceAll('\n', '<br>')} -->
</p> </p>
{/if} {/if}
{:else} {:else}
+4 -3
View File
@@ -1,7 +1,7 @@
import { writable } from 'svelte/store'; import { writable } from 'svelte/store';
import type { Post } from '../../types'; import type { Post } from '../../types';
export const posts = writable<Post[]>([]); export const posts = writable<Post[] | undefined>(undefined);
export const setPosts = (newPosts: Post[]) => { export const setPosts = (newPosts: Post[]) => {
posts.set(newPosts); posts.set(newPosts);
@@ -20,9 +20,10 @@ export const updatePostStore = (postId: string, updatedData: Partial<Post>) => {
export const removePost = (postId: string) => { export const removePost = (postId: string) => {
posts.update((currentPosts) => { posts.update((currentPosts) => {
const a = currentPosts.filter((post) => post.id !== postId); const a = currentPosts.filter((post) => post.id !== postId);
console.log(a);
return a; return a;
}); });
};
console.log(postId); export const resetPosts = () => {
posts.set(undefined);
}; };
+11 -2
View File
@@ -3,15 +3,17 @@
import { Content } from '@/components/ui/card'; import { Content } from '@/components/ui/card';
import { sesionStore } from '@/stores/usuario'; import { sesionStore } from '@/stores/usuario';
import CrearPost from '@/components/crear-post.svelte'; import CrearPost from '@/components/crear-post.svelte';
import { posts, setPosts, updatePostStore } from '@/stores/posts'; import { posts, resetPosts, setPosts, updatePostStore } from '@/stores/posts';
import PostCard from '@/components/PostCard.svelte'; import PostCard from '@/components/PostCard.svelte';
import type { Post } from '../types'; import type { Post } from '../types';
import ModalEditar from './[perfil]/modalEditar.svelte'; import ModalEditar from './[perfil]/modalEditar.svelte';
import { updatePost } from '@/hooks/updatePost'; import { updatePost } from '@/hooks/updatePost';
import { fade, slide } from 'svelte/transition'; import { fade, slide } from 'svelte/transition';
import { getPosts } from '@/hooks/getPosts'; import { getPosts } from '@/hooks/getPosts';
import Spinner from '@/components/ui/spinner/spinner.svelte';
$effect(() => { $effect(() => {
resetPosts();
(async () => { (async () => {
setPosts(await getPosts()); setPosts(await getPosts());
})(); })();
@@ -49,7 +51,14 @@
{/if} {/if}
<hr /> <hr />
{#if $posts.length <= 0} {#if $posts === undefined}
<Card>
<Content class="flex items-center justify-center gap-2">
<Spinner class="h-10 w-10" />
<p>Cargando</p>
</Content>
</Card>
{:else if $posts.length <= 0}
<Card> <Card>
<Content> <Content>
<p class=" text-center leading-7 not-first:mt-6">No hay Posts que mostrar</p> <p class=" text-center leading-7 not-first:mt-6">No hay Posts que mostrar</p>