mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-10 14:40:46 -03:00
cambiado a runes
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { replaceState } from '$app/navigation';
|
import { replaceState } from '$app/navigation';
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import Card from '@/components/ui/card/card.svelte';
|
import Card from '@/components/ui/card/card.svelte';
|
||||||
import { Content } from '@/components/ui/card';
|
import { Content } from '@/components/ui/card';
|
||||||
import Spinner from '@/components/ui/spinner/spinner.svelte';
|
import Spinner from '@/components/ui/spinner/spinner.svelte';
|
||||||
@@ -11,21 +10,17 @@
|
|||||||
import PostCard from '@/components/PostCard.svelte';
|
import PostCard from '@/components/PostCard.svelte';
|
||||||
import ModalEditar from './[perfil]/modalEditar.svelte';
|
import ModalEditar from './[perfil]/modalEditar.svelte';
|
||||||
import { sesionStore } from '@/stores/usuario';
|
import { sesionStore } from '@/stores/usuario';
|
||||||
import {
|
import { posts, updatePostStore, loadingPosts } from '@/stores/posts';
|
||||||
posts,
|
|
||||||
updatePostStore,
|
|
||||||
loadingPosts
|
|
||||||
} from '@/stores/posts';
|
|
||||||
import { updatePost } from '@/hooks/updatePost';
|
import { updatePost } from '@/hooks/updatePost';
|
||||||
import { loadMorePosts } from '@/hooks/loadMorePosts';
|
import { loadMorePosts } from '@/hooks/loadMorePosts';
|
||||||
import type { Post } from '../types';
|
import type { Post } from '../types';
|
||||||
import { fade, slide } from 'svelte/transition';
|
import { fade, slide } from 'svelte/transition';
|
||||||
|
|
||||||
let postAModificar: Post | null = null;
|
let postAModificar: Post | null = $state(null);
|
||||||
let mensajeError = '';
|
let mensajeError = $state('');
|
||||||
let sentinel: HTMLDivElement;
|
let sentinel: HTMLDivElement;
|
||||||
|
|
||||||
onMount(() => {
|
$effect(() => {
|
||||||
loadMorePosts();
|
loadMorePosts();
|
||||||
|
|
||||||
const observer = new IntersectionObserver(
|
const observer = new IntersectionObserver(
|
||||||
@@ -47,8 +42,7 @@
|
|||||||
|
|
||||||
await updatePost(
|
await updatePost(
|
||||||
postAModificar,
|
postAModificar,
|
||||||
(postNuevo: Post) =>
|
(postNuevo: Post) => updatePostStore(postAModificar!.id, postNuevo),
|
||||||
updatePostStore(postAModificar!.id, postNuevo),
|
|
||||||
mensajeError
|
mensajeError
|
||||||
);
|
);
|
||||||
postAModificar = null;
|
postAModificar = null;
|
||||||
@@ -63,9 +57,7 @@
|
|||||||
|
|
||||||
{#if from === 'cambio_contraseña'}
|
{#if from === 'cambio_contraseña'}
|
||||||
<Dialog open>
|
<Dialog open>
|
||||||
<DialogContent>
|
<DialogContent>Se cambió la contraseña del usuario exitosamente</DialogContent>
|
||||||
Se cambió la contraseña del usuario exitosamente
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
</Dialog>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -92,18 +84,15 @@
|
|||||||
<p>Cargando</p>
|
<p>Cargando</p>
|
||||||
</Content>
|
</Content>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{:else if $posts.length === 0}
|
{:else if $posts.length === 0}
|
||||||
<Card>
|
<Card>
|
||||||
<Content>
|
<Content>
|
||||||
<p class="text-center leading-7">
|
<p class="text-center leading-7">No hay Posts que mostrar</p>
|
||||||
No hay Posts que mostrar
|
|
||||||
</p>
|
|
||||||
</Content>
|
</Content>
|
||||||
</Card>
|
</Card>
|
||||||
{:else}
|
{:else}
|
||||||
{#each $posts as post (post.id)}
|
{#each $posts as post (post.id)}
|
||||||
<div transition:slide>
|
<div animate:slide>
|
||||||
<PostCard {post} bind:postAModificar />
|
<PostCard {post} bind:postAModificar />
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -120,9 +109,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if postAModificar}
|
{#if postAModificar}
|
||||||
<div in:fade>
|
<div in:fade>
|
||||||
<ModalEditar
|
<ModalEditar callbackfn={handleEditar} bind:post={postAModificar} />
|
||||||
callbackfn={handleEditar}
|
|
||||||
bind:post={postAModificar}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
Reference in New Issue
Block a user