Page MenuHomeDevCentral

D3971.diff
No OneTemporary

D3971.diff

diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js
--- a/frontend/src/router/index.js
+++ b/frontend/src/router/index.js
@@ -31,6 +31,11 @@
component: () => import('@/views/AdminDashboard.vue'),
meta: { requiresAuth: true },
},
+ {
+ path: '/:pathMatch(.*)*',
+ name: 'not-found',
+ component: () => import('@/views/NotFound.vue'),
+ },
],
})
diff --git a/frontend/src/views/NotFound.vue b/frontend/src/views/NotFound.vue
new file mode 100644
--- /dev/null
+++ b/frontend/src/views/NotFound.vue
@@ -0,0 +1,25 @@
+<template>
+ <div class="min-h-[70vh] flex items-center justify-center px-4">
+ <div class="card p-8 w-full max-w-md text-center">
+
+ <!-- 404 number -->
+ <p class="text-6xl font-bold text-brand-500 mb-4">404</p>
+
+ <!-- Headline -->
+ <h1 class="text-lg font-bold text-gray-900 dark:text-gray-100 mb-2">
+ The page you're looking for can't be found.
+ </h1>
+
+ <!-- Subtext -->
+ <p class="text-sm text-gray-500 dark:text-gray-400 mb-6">
+ It may have been moved or deleted.
+ </p>
+
+ <!-- Actions -->
+ <RouterLink to="/" class="btn-primary flex items-center justify-center w-full">
+ Back to Home
+ </RouterLink>
+
+ </div>
+ </div>
+</template>
diff --git a/frontend/src/views/__tests__/NotFound.test.js b/frontend/src/views/__tests__/NotFound.test.js
new file mode 100644
--- /dev/null
+++ b/frontend/src/views/__tests__/NotFound.test.js
@@ -0,0 +1,29 @@
+import { mount } from '@vue/test-utils'
+import { describe, it, expect } from 'vitest'
+import NotFound from '../NotFound.vue'
+
+describe('NotFound.vue', () => {
+ it('renders the 404 message correctly and links to home', () => {
+ const RouterLinkStub = {
+ name: 'RouterLink',
+ template: '<a><slot /></a>',
+ props: ['to'],
+ }
+
+ const wrapper = mount(NotFound, {
+ global: {
+ stubs: {
+ RouterLink: RouterLinkStub,
+ },
+ },
+ })
+
+ expect(wrapper.text()).toContain('404')
+ expect(wrapper.text()).toContain("The page you're looking for can't be found.")
+
+ const link = wrapper.findComponent(RouterLinkStub)
+ expect(link.exists()).toBe(true)
+ expect(link.props('to')).toBe('/')
+ })
+})
+

File Metadata

Mime Type
text/plain
Expires
Thu, Feb 26, 19:18 (19 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3475338
Default Alt Text
D3971.diff (2 KB)

Event Timeline