Initial commit: Custom Start Page application with authentication and DynamoDB storage

This commit is contained in:
2026-02-18 22:06:43 -05:00
commit 7175ff14ba
47 changed files with 7592 additions and 0 deletions

99
templates/dashboard.html Normal file
View File

@@ -0,0 +1,99 @@
{{template "layouts/base.html" .}}
{{define "title"}}Dashboard - Custom Start Page{{end}}
{{define "content"}}
<div class="min-h-screen flex flex-col">
<!-- Top Toolbar -->
<header class="bg-white shadow-sm border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex items-center justify-between h-16">
<!-- Logo -->
<div class="flex-shrink-0">
<h1 class="text-xl font-bold text-gray-800">Start Page</h1>
</div>
<!-- Search Bar -->
<div class="flex-1 max-w-2xl mx-8">
<form action="/search" method="get" class="relative">
<input type="text"
name="q"
placeholder="Search the web..."
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
<button type="submit" class="absolute right-3 top-2.5 text-gray-400 hover:text-gray-600">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
</button>
</form>
</div>
<!-- User Menu -->
<div class="flex items-center space-x-4">
<button class="text-gray-600 hover:text-gray-800">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
</button>
<form action="/logout" method="post">
<button type="submit" class="text-gray-600 hover:text-gray-800">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/>
</svg>
</button>
</form>
</div>
</div>
<!-- Page Tabs -->
<div id="page-tabs" class="flex space-x-1 -mb-px">
{{range .Pages}}
<button hx-get="/pages/{{.ID}}"
hx-target="#widget-grid"
hx-swap="innerHTML"
class="px-4 py-2 text-sm font-medium {{if .Active}}border-b-2 border-blue-500 text-blue-600{{else}}text-gray-600 hover:text-gray-800{{end}}">
{{.Name}}
</button>
{{end}}
<button class="px-4 py-2 text-sm font-medium text-gray-400 hover:text-gray-600">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
</button>
</div>
</div>
</header>
<!-- Widget Grid -->
<main class="flex-1 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 w-full">
<div id="widget-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Widgets will be loaded here via HTMX -->
<div class="col-span-full text-center text-gray-500 py-12">
<p>No widgets yet. Click the + button to add your first widget.</p>
</div>
</div>
</main>
</div>
{{end}}
{{define "scripts"}}
<script>
// Initialize Sortable.js for drag-and-drop when widgets are loaded
document.body.addEventListener('htmx:afterSwap', function(evt) {
if (evt.detail.target.id === 'widget-grid') {
new Sortable(document.getElementById('widget-grid'), {
animation: 150,
handle: '.widget-handle',
onEnd: function(evt) {
// Send reorder request
const widgetIds = Array.from(evt.to.children).map(el => el.dataset.widgetId);
htmx.ajax('POST', '/widgets/reorder', {
values: { order: widgetIds.join(',') }
});
}
});
}
});
</script>
{{end}}

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{block "title" .}}Custom Start Page{{end}}</title>
<!-- HTMX -->
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Sortable.js for drag-and-drop -->
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
<!-- Prism.js for syntax highlighting -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-javascript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-go.min.js"></script>
<!-- Custom CSS -->
<link rel="stylesheet" href="/static/css/main.css">
{{block "head" .}}{{end}}
</head>
<body class="bg-gray-50 min-h-screen">
{{block "content" .}}{{end}}
<!-- Custom JavaScript -->
<script src="/static/js/main.js"></script>
{{block "scripts" .}}{{end}}
</body>
</html>

45
templates/login.html Normal file
View File

@@ -0,0 +1,45 @@
{{template "layouts/base.html" .}}
{{define "title"}}Login - Custom Start Page{{end}}
{{define "content"}}
<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-500 to-purple-600">
<div class="bg-white p-8 rounded-lg shadow-2xl w-full max-w-md">
<h1 class="text-3xl font-bold text-center mb-2 text-gray-800">Custom Start Page</h1>
<p class="text-center text-gray-600 mb-8">Sign in to access your personalized dashboard</p>
{{if .Error}}
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4" role="alert">
<p>{{.Error}}</p>
</div>
{{end}}
<div class="space-y-4">
<a href="/auth/oauth/google"
class="flex items-center justify-center w-full bg-white border-2 border-gray-300 rounded-lg px-6 py-3 text-gray-700 font-semibold hover:bg-gray-50 hover:border-gray-400 transition duration-200">
<svg class="w-6 h-6 mr-3" viewBox="0 0 24 24">
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
</svg>
Sign in with Google
</a>
<!-- Placeholder for additional OAuth providers -->
{{range .OAuthProviders}}
{{if ne .Name "google"}}
<a href="/auth/oauth/{{.Name}}"
class="flex items-center justify-center w-full bg-gray-800 rounded-lg px-6 py-3 text-white font-semibold hover:bg-gray-700 transition duration-200">
Sign in with {{.DisplayName}}
</a>
{{end}}
{{end}}
</div>
<p class="text-center text-gray-500 text-sm mt-8">
By signing in, you agree to our Terms of Service and Privacy Policy
</p>
</div>
</div>
{{end}}