diff --git a/src/lib/components/CardCargando.svelte b/src/lib/components/CardCargando.svelte new file mode 100644 index 0000000..aabba17 --- /dev/null +++ b/src/lib/components/CardCargando.svelte @@ -0,0 +1,15 @@ + + +
+ + + +

Cargando

+
+
+
diff --git a/src/lib/components/CardError.svelte b/src/lib/components/CardError.svelte new file mode 100644 index 0000000..3c3cbe6 --- /dev/null +++ b/src/lib/components/CardError.svelte @@ -0,0 +1,19 @@ + + +
+ + + +

+ {mensajeError} +

+
+
+
diff --git a/src/lib/components/CardPerfil.svelte b/src/lib/components/CardPerfil.svelte new file mode 100644 index 0000000..2a49fcb --- /dev/null +++ b/src/lib/components/CardPerfil.svelte @@ -0,0 +1,111 @@ + + + + + + {#if cargando} +
+ + + +
+ {:else if $sesionStore?.isAdmin || $sesionStore?.username == data.username} + +

+ {data.displayName} +

@{data.username}

+

+

+ {data.bio} +

+ {:else} +
+ + + + {data.displayName?.[0]?.toUpperCase() || ''} + + +
+

+ {data.displayName} +

+

+ {data.bio} +

+ {/if} +
+
diff --git a/src/lib/components/PostCard.svelte b/src/lib/components/PostCard.svelte index 1decfe9..bd9ab80 100644 --- a/src/lib/components/PostCard.svelte +++ b/src/lib/components/PostCard.svelte @@ -44,6 +44,16 @@ let cargandoLike = $state(false); let errorLike = $state(false); + let contenido = $derived(() => { + let t = post.content.replaceAll('\n', '
'); + t = t.replace( + /#\w*/gm, + (match) => + `${match}` + ); + return t; + }); + async function handleBorrar() { await deletePost( post, @@ -85,7 +95,7 @@
- + {post.authorDisplayName[0].toUpperCase()} @@ -126,12 +136,17 @@
- -

{post.content}

- {#if post.imageUrl} - Post - {/if} + +

{@html contenido()}

+ + {#if post.imageUrl} +
+ + Post + +
+ {/if}