refactor: remove bookshelf route, consolidate to dashboard
- Update header navigation to link to /dashboard instead of /bookshelf - Update index page auto-redirect to use /dashboard - Remove duplicate route, keeping full-featured dashboard with filters
This commit is contained in:
@@ -6,11 +6,11 @@ templ Header(user User, currentPath string) {
|
|||||||
<div class="flex justify-between items-center h-16">
|
<div class="flex justify-between items-center h-16">
|
||||||
<!-- Left: App Title & Navigation -->
|
<!-- Left: App Title & Navigation -->
|
||||||
<div class="flex items-center space-x-6">
|
<div class="flex items-center space-x-6">
|
||||||
<a href="/bookshelf" class="text-xl font-bold hover:opacity-80 transition-opacity" style="color: var(--text-primary); text-decoration: none;">
|
<a href="/dashboard" class="text-xl font-bold hover:opacity-80 transition-opacity" style="color: var(--text-primary); text-decoration: none;">
|
||||||
📚 Bookhoard
|
📚 Bookhoard
|
||||||
</a>
|
</a>
|
||||||
<div class="hidden md:flex items-center space-x-4">
|
<div class="hidden md:flex items-center space-x-4">
|
||||||
<a href="/bookshelf" class="text-sm hover:opacity-80 transition-opacity" style="color: var(--text-secondary); text-decoration: none;">
|
<a href="/dashboard" class="text-sm hover:opacity-80 transition-opacity" style="color: var(--text-secondary); text-decoration: none;">
|
||||||
Library
|
Library
|
||||||
</a>
|
</a>
|
||||||
<a href="/collections" class="text-sm hover:opacity-80 transition-opacity" style="color: var(--text-secondary); text-decoration: none;">
|
<a href="/collections" class="text-sm hover:opacity-80 transition-opacity" style="color: var(--text-secondary); text-decoration: none;">
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -128,7 +128,7 @@ templ Index(loggedIn bool) {
|
|||||||
|
|
||||||
<script src="/static/theme.js"></script>
|
<script src="/static/theme.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// Auto-redirect to bookshelf if user is logged in
|
// Auto-redirect to dashboard if user is logged in
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
if (token) {
|
if (token) {
|
||||||
@@ -140,8 +140,8 @@ templ Index(loggedIn bool) {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
// Token is valid, redirect to bookshelf
|
// Token is valid, redirect to dashboard
|
||||||
window.location.href = '/bookshelf';
|
window.location.href = '/dashboard';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func Index(loggedIn bool) templ.Component {
|
|||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<script src=\"/static/theme.js\"></script><script>\n // Auto-redirect to bookshelf if user is logged in\n document.addEventListener('DOMContentLoaded', function() {\n const token = localStorage.getItem('token');\n if (token) {\n // Validate token by checking profile\n fetch('/api/auth/profile', {\n headers: {\n 'Authorization': `Bearer ${token}`\n }\n })\n .then(response => {\n if (response.ok) {\n // Token is valid, redirect to bookshelf\n window.location.href = '/bookshelf';\n }\n })\n .catch(error => {\n // Silently fail - user stays on homepage\n console.log('Not logged in');\n });\n }\n });\n </script></body></html>")
|
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<script src=\"/static/theme.js\"></script><script>\n // Auto-redirect to dashboard if user is logged in\n document.addEventListener('DOMContentLoaded', function() {\n const token = localStorage.getItem('token');\n if (token) {\n // Validate token by checking profile\n fetch('/api/auth/profile', {\n headers: {\n 'Authorization': `Bearer ${token}`\n }\n })\n .then(response => {\n if (response.ok) {\n // Token is valid, redirect to dashboard\n window.location.href = '/dashboard';\n }\n })\n .catch(error => {\n // Silently fail - user stays on homepage\n console.log('Not logged in');\n });\n }\n });\n </script></body></html>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user