refactors a imports innesesarios y archivos mal formateados

This commit is contained in:
2025-12-21 22:57:29 -03:00
parent 08e84a1e27
commit 4f3af346e6
6 changed files with 68 additions and 85 deletions

View File

@@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
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 { apiBase } from '@/stores/url';
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, setPosts, updatePostStore } from '@/stores/posts';

View File

@@ -3,12 +3,8 @@
import Ban from '@lucide/svelte/icons/ban'; import Ban from '@lucide/svelte/icons/ban';
import PenLine from '@lucide/svelte/icons/pen-line'; import PenLine from '@lucide/svelte/icons/pen-line';
import Card from '@/components/ui/card/card.svelte'; import Card from '@/components/ui/card/card.svelte';
import Avatar from '@/components/ui/avatar/avatar.svelte';
import AvatarImage from '@/components/ui/avatar/avatar-image.svelte';
import AvatarFallback from '@/components/ui/avatar/avatar-fallback.svelte';
import { CardContent } from '@/components/ui/card'; import { CardContent } from '@/components/ui/card';
import type { Post } from '../../types.js'; import type { Post } from '../../types.js';
import Spinner from '@/components/ui/spinner/spinner.svelte';
import { fade, slide } from 'svelte/transition'; import { fade, slide } from 'svelte/transition';
import PostCard from '@/components/PostCard.svelte'; import PostCard from '@/components/PostCard.svelte';
import { posts, setPosts, updatePostStore } from '@/stores/posts.js'; import { posts, setPosts, updatePostStore } from '@/stores/posts.js';
@@ -19,7 +15,6 @@
import { Dialog } from '@/components/ui/dialog/index.js'; import { Dialog } from '@/components/ui/dialog/index.js';
import CrearPost from '@/components/crear-post.svelte'; import CrearPost from '@/components/crear-post.svelte';
import DialogContent from '@/components/ui/dialog/dialog-content.svelte'; import DialogContent from '@/components/ui/dialog/dialog-content.svelte';
import DialogHeader from '@/components/ui/dialog/dialog-header.svelte';
import DialogTitle from '@/components/ui/dialog/dialog-title.svelte'; import DialogTitle from '@/components/ui/dialog/dialog-title.svelte';
import { sesionStore } from '@/stores/usuario.js'; import { sesionStore } from '@/stores/usuario.js';
import CardHeader from '@/components/ui/card/card-header.svelte'; import CardHeader from '@/components/ui/card/card-header.svelte';

View File

@@ -1,5 +1,5 @@
export function load({ url }) { export function load({ url }) {
return { return {
message: url.searchParams.get('msg') message: url.searchParams.get('msg')
}; };
} }

View File

@@ -1,60 +1,54 @@
<script lang="ts"> <script lang="ts">
import * as Alert from '@/components/ui/alert'; import * as Alert from '@/components/ui/alert';
import LoginForm from '@/components/ui/login-form/login-form.svelte'; import LoginForm from '@/components/ui/login-form/login-form.svelte';
import AlertCircleIcon from "@lucide/svelte/icons/alert-circle"; import AlertCircleIcon from '@lucide/svelte/icons/alert-circle';
import { fade, fly } from 'svelte/transition'; import { fade, fly } from 'svelte/transition';
import Info from '@lucide/svelte/icons/info'; import Info from '@lucide/svelte/icons/info';
let {data} = $props(); let { data } = $props();
let showAlert: boolean = $state(false); let showAlert: boolean = $state(false);
let message = $state(data.message); let message = $state(data.message);
$effect(()=>{ $effect(() => {
resetAlert(); resetAlert();
if (data.message) { if (data.message) {
history.replaceState(history.state, "", "/login"); history.replaceState(history.state, '', '/login');
setTimeout(() => { setTimeout(() => {
message = ""; message = '';
}, 7000); }, 7000);
} }
}); });
async function resetAlert (){
if (showAlert == true){
await new Promise(res => setTimeout(res, 2000));
showAlert=false;
}
}
async function resetAlert() {
if (showAlert == true) {
await new Promise((res) => setTimeout(res, 2000));
showAlert = false;
}
}
</script>
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10"> <div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
<div class="w-full max-w-sm"> <div class="w-full max-w-sm">
<div class="w-full max-w-sm"> {#if message}
{#if message} <div class="mb-2" transition:fly>
<div class="mb-2" transition:fly> <Alert.Root>
<Alert.Root> <Info />
<Info /> <Alert.Title>Info</Alert.Title>
<Alert.Title>Info</Alert.Title> <Alert.Description>Ingrese las credenciales de la cuenta recien creada</Alert.Description>
<Alert.Description> </Alert.Root>
Ingrese las credenciales de la cuenta recien creada </div>
</Alert.Description> {/if}
</Alert.Root> <LoginForm bind:showAlert id="1" />
</div> {#if showAlert}
<div class="mt-2" transition:fade>
{/if} <Alert.Root variant="destructive">
<LoginForm bind:showAlert={showAlert} id="1" /> <AlertCircleIcon />
{#if showAlert} <Alert.Title>No se pudo iniciar sesion</Alert.Title>
<div class="mt-2" transition:fade> <Alert.Description>Revise su usuario o contraseña</Alert.Description>
<Alert.Root variant="destructive"> </Alert.Root>
<AlertCircleIcon /> </div>
<Alert.Title>No se pudo iniciar sesion</Alert.Title> {/if}
<Alert.Description>
Revise su usuario o contraseña
</Alert.Description>
</Alert.Root>
</div>
</div> </div>
</div> </div>

View File

@@ -1,38 +1,34 @@
<script lang="ts"> <script lang="ts">
import SignupForm from '@/components/signup-form.svelte'; import SignupForm from '@/components/signup-form.svelte';
import AlertCircleIcon from '@lucide/svelte/icons/alert-circle';
import AlertCircleIcon from "@lucide/svelte/icons/alert-circle"; import * as Alert from '@/components/ui/alert';
import * as Alert from '@/components/ui/alert';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
let showAlert: boolean = $state(false); let showAlert: boolean = $state(false);
$effect(()=>{ $effect(() => {
resetAlert(); resetAlert();
}); });
async function resetAlert (){
if (showAlert == true){
await new Promise(res => setTimeout(res, 2000));
showAlert=false;
}
}
async function resetAlert() {
if (showAlert == true) {
await new Promise((res) => setTimeout(res, 2000));
showAlert = false;
}
}
</script> </script>
<div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10"> <div class="flex min-h-fit w-full items-center justify-center p-6 md:p-10">
<div class="w-full max-w-sm"> <div class="w-full max-w-sm">
<SignupForm bind:showAlert={showAlert} /> <SignupForm bind:showAlert />
{#if showAlert} {#if showAlert}
<div class="mt-2" transition:fade> <div class="mt-2" transition:fade>
<Alert.Root variant="destructive"> <Alert.Root variant="destructive">
<AlertCircleIcon /> <AlertCircleIcon />
<Alert.Title>No se pudo crear la cuenta</Alert.Title> <Alert.Title>No se pudo crear la cuenta</Alert.Title>
<Alert.Description> <Alert.Description>Intente nuevamente.</Alert.Description>
Intente nuevamente. </Alert.Root>
</Alert.Description> </div>
</Alert.Root> {/if}
</div>
{/if}
</div> </div>
</div> </div>

View File

@@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import UserCard from '@/components/UserCard.svelte'; import UserCard from '@/components/UserCard.svelte';
let { data } = $props(); let { data } = $props();
</script> </script>