mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-18 15:57:31 -03:00
añadido soporte de seguir usuarios en pagina de perfil y search
This commit is contained in:
@@ -15,7 +15,8 @@
|
|||||||
import DialogContent from './ui/dialog/dialog-content.svelte';
|
import DialogContent from './ui/dialog/dialog-content.svelte';
|
||||||
import Dialog from './ui/dialog/dialog.svelte';
|
import Dialog from './ui/dialog/dialog.svelte';
|
||||||
|
|
||||||
let { post }: { post: Post } = $props();
|
let { post }: { post: Omit<Partial<Post>, 'authorId'> & { authorId: string } } = $props();
|
||||||
|
|
||||||
let seguido: Boolean | null = $state(null);
|
let seguido: Boolean | null = $state(null);
|
||||||
|
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
@@ -56,10 +57,9 @@
|
|||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button
|
<Button
|
||||||
variant={seguido == true ? 'destructive' : 'default'}
|
variant={seguido == true ? 'destructive' : 'outline'}
|
||||||
disabled={seguido == null}
|
disabled={seguido == null}
|
||||||
size="icon-sm"
|
size="icon-lg"
|
||||||
class="ml-auto rounded-full p-1 text-sm"
|
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
if (seguido == null) return;
|
if (seguido == null) return;
|
||||||
const anteriorEstado = seguido;
|
const anteriorEstado = seguido;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import type { UserResponseDto } from '../../types';
|
import type { UserResponseDto } from '../../types';
|
||||||
|
import BotonSeguir from './BotonSeguir.svelte';
|
||||||
import AvatarFallback from './ui/avatar/avatar-fallback.svelte';
|
import AvatarFallback from './ui/avatar/avatar-fallback.svelte';
|
||||||
import AvatarImage from './ui/avatar/avatar-image.svelte';
|
import AvatarImage from './ui/avatar/avatar-image.svelte';
|
||||||
import Avatar from './ui/avatar/avatar.svelte';
|
import Avatar from './ui/avatar/avatar.svelte';
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
<p class="text-sm text-muted-foreground">@{usu.username}</p>
|
<p class="text-sm text-muted-foreground">@{usu.username}</p>
|
||||||
</a>
|
</a>
|
||||||
<div>
|
<div>
|
||||||
<Button variant="outline">Seguir</Button>
|
<BotonSeguir post={{ authorId: usu.id }} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if usu.bio}
|
{#if usu.bio}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
import CardError from '@/components/CardError.svelte';
|
import CardError from '@/components/CardError.svelte';
|
||||||
import CardPerfil from '@/components/CardPerfil.svelte';
|
import CardPerfil from '@/components/CardPerfil.svelte';
|
||||||
import DialogModificarUsuario from '@/components/DialogModificarUsuario.svelte';
|
import DialogModificarUsuario from '@/components/DialogModificarUsuario.svelte';
|
||||||
|
import BotonSeguir from '@/components/BotonSeguir.svelte';
|
||||||
|
|
||||||
let { params } = $props();
|
let { params } = $props();
|
||||||
|
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
{#if params.perfil == $sesionStore?.username}
|
{#if params.perfil == $sesionStore?.username}
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
size="icon-sm"
|
||||||
class="m-1 rounded-full bg-blue-600"
|
class="m-1 rounded-full bg-blue-600"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
showCrearPost = true;
|
showCrearPost = true;
|
||||||
@@ -86,6 +88,8 @@
|
|||||||
>
|
>
|
||||||
<PenLine />
|
<PenLine />
|
||||||
</Button>
|
</Button>
|
||||||
|
{:else if $posts?.length == 0}
|
||||||
|
<BotonSeguir post={{ authorId: data.id }} />
|
||||||
{/if}
|
{/if}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user