feat: Add logo and enhance login functionality

- Introduce a new logo asset for branding.
- Update LoginDialog.vue to include routing for successful login and registration.
- Modify Navbar.vue to integrate LoginDialog and manage its visibility.
- Revise Login.vue to update the logo and welcome title, along with routing enhancements post-login and registration.
This commit is contained in:
padreug 2025-07-29 23:49:17 +02:00
parent be4ab13b32
commit 90c2b445bd
4 changed files with 26 additions and 4 deletions

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
@ -18,6 +19,7 @@ interface Emits {
(e: 'success'): void (e: 'success'): void
} }
const router = useRouter()
defineProps<Props>() defineProps<Props>()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
@ -64,6 +66,8 @@ async function handleLogin() {
toast.success('Login successful!') toast.success('Login successful!')
emit('success') emit('success')
handleClose() handleClose()
// Redirect to home page after successful login
router.push('/')
} catch (err) { } catch (err) {
error.value = err instanceof Error ? err.message : 'Login failed' error.value = err instanceof Error ? err.message : 'Login failed'
toast.error('Login failed. Please check your credentials.') toast.error('Login failed. Please check your credentials.')
@ -89,6 +93,8 @@ async function handleRegister() {
toast.success('Registration successful!') toast.success('Registration successful!')
emit('success') emit('success')
handleClose() handleClose()
// Redirect to home page after successful registration
router.push('/')
} catch (err) { } catch (err) {
error.value = err instanceof Error ? err.message : 'Registration failed' error.value = err instanceof Error ? err.message : 'Registration failed'
toast.error('Registration failed. Please try again.') toast.error('Registration failed. Please try again.')

View file

@ -7,6 +7,7 @@ import { Badge } from '@/components/ui/badge'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'
import { Sun, Moon, Menu, X, User, LogOut } from 'lucide-vue-next' import { Sun, Moon, Menu, X, User, LogOut } from 'lucide-vue-next'
import LanguageSwitcher from '@/components/LanguageSwitcher.vue' import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
import LoginDialog from '@/components/auth/LoginDialog.vue'
import { auth } from '@/composables/useAuth' import { auth } from '@/composables/useAuth'
interface NavigationItem { interface NavigationItem {
@ -17,6 +18,7 @@ interface NavigationItem {
const { t } = useI18n() const { t } = useI18n()
const { theme, setTheme } = useTheme() const { theme, setTheme } = useTheme()
const isOpen = ref(false) const isOpen = ref(false)
const showLoginDialog = ref(false)
const navigation = computed<NavigationItem[]>(() => [ const navigation = computed<NavigationItem[]>(() => [
{ name: t('nav.home'), href: '/' }, { name: t('nav.home'), href: '/' },
@ -32,6 +34,11 @@ const toggleTheme = () => {
setTheme(theme.value === 'dark' ? 'light' : 'dark') setTheme(theme.value === 'dark' ? 'light' : 'dark')
} }
const openLoginDialog = () => {
showLoginDialog.value = true
isOpen.value = false // Close mobile menu
}
const handleLogout = async () => { const handleLogout = async () => {
try { try {
await auth.logout() await auth.logout()
@ -89,7 +96,7 @@ const handleLogout = async () => {
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
<Button v-else variant="outline" size="sm" class="gap-2"> <Button v-else variant="outline" size="sm" @click="openLoginDialog" class="gap-2">
<User class="h-4 w-4" /> <User class="h-4 w-4" />
Login Login
</Button> </Button>
@ -124,6 +131,7 @@ const handleLogout = async () => {
<!-- Authentication in mobile menu --> <!-- Authentication in mobile menu -->
<div class="mb-4 px-2"> <div class="mb-4 px-2">
<Button v-if="!auth.isAuthenticated.value" variant="outline" size="sm" <Button v-if="!auth.isAuthenticated.value" variant="outline" size="sm"
@click="openLoginDialog"
class="w-full gap-2 min-h-[44px] touch-manipulation"> class="w-full gap-2 min-h-[44px] touch-manipulation">
<User class="h-4 w-4" /> <User class="h-4 w-4" />
Login Login
@ -168,5 +176,7 @@ const handleLogout = async () => {
</div> </div>
</div> </div>
<!-- Login Dialog -->
<LoginDialog v-model:is-open="showLoginDialog" />
</nav> </nav>
</template> </template>

View file

@ -4,9 +4,9 @@
<!-- Welcome Section --> <!-- Welcome Section -->
<div class="text-center space-y-4"> <div class="text-center space-y-4">
<div class="flex justify-center"> <div class="flex justify-center">
<img src="@/assets/logo-72px.png" alt="Logo" class="h-24 w-24" /> <img src="@/assets/logo.png" alt="Logo" class="h-36 w-36" />
</div> </div>
<h1 class="text-4xl font-bold tracking-tight">Welcome to Ario</h1> <h1 class="text-4xl font-bold tracking-tight">Welcome to the Virtual Realm</h1>
<p class="text-xl text-muted-foreground max-w-md"> <p class="text-xl text-muted-foreground max-w-md">
Your secure platform for events and community management Your secure platform for events and community management
</p> </p>
@ -137,6 +137,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
@ -144,6 +145,7 @@ import { Label } from '@/components/ui/label'
import { auth } from '@/composables/useAuth' import { auth } from '@/composables/useAuth'
import { toast } from 'vue-sonner' import { toast } from 'vue-sonner'
const router = useRouter()
const showRegister = ref(false) const showRegister = ref(false)
const isLoading = ref(false) const isLoading = ref(false)
const error = ref('') const error = ref('')
@ -184,6 +186,8 @@ async function handleLogin() {
}) })
toast.success('Login successful!') toast.success('Login successful!')
// Redirect to home page after successful login
router.push('/')
} catch (err) { } catch (err) {
error.value = err instanceof Error ? err.message : 'Login failed' error.value = err instanceof Error ? err.message : 'Login failed'
toast.error('Login failed. Please check your credentials.') toast.error('Login failed. Please check your credentials.')
@ -207,6 +211,8 @@ async function handleRegister() {
}) })
toast.success('Registration successful!') toast.success('Registration successful!')
// Redirect to home page after successful registration
router.push('/')
} catch (err) { } catch (err) {
error.value = err instanceof Error ? err.message : 'Registration failed' error.value = err instanceof Error ? err.message : 'Registration failed'
toast.error('Registration failed. Please try again.') toast.error('Registration failed. Please try again.')