406 lines
14 KiB
HTML
406 lines
14 KiB
HTML
{{ define "base" }}
|
|
<!DOCTYPE html>
|
|
<html lang="en" class="dark">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{block "title" .}}{{.app_name}}{{end}}</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<script>
|
|
tailwind.config = {
|
|
darkMode: 'class',
|
|
theme: {
|
|
extend: {
|
|
colors: {
|
|
'obsidian': {
|
|
'50': '#f8fafc',
|
|
'100': '#f1f5f9',
|
|
'200': '#e2e8f0',
|
|
'300': '#cbd5e1',
|
|
'400': '#94a3b8',
|
|
'500': '#64748b',
|
|
'600': '#475569',
|
|
'700': '#334155',
|
|
'800': '#1e293b',
|
|
'900': '#0f172a',
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/python.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/javascript.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/markdown.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/json.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/yaml.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/xml.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/sql.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/bash.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/css.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
|
|
<style>
|
|
/* Custom scrollbar for dark theme */
|
|
::-webkit-scrollbar {
|
|
width: 8px;
|
|
height: 8px;
|
|
}
|
|
::-webkit-scrollbar-track {
|
|
background: #1e293b;
|
|
}
|
|
::-webkit-scrollbar-thumb {
|
|
background: #475569;
|
|
border-radius: 4px;
|
|
}
|
|
::-webkit-scrollbar-thumb:hover {
|
|
background: #64748b;
|
|
}
|
|
|
|
/* Content markdown styles */
|
|
.prose-dark {
|
|
color: #d1d5db;
|
|
}
|
|
.prose-dark h1, .prose-dark h2, .prose-dark h3, .prose-dark h4, .prose-dark h5, .prose-dark h6 {
|
|
color: white;
|
|
}
|
|
.prose-dark a {
|
|
color: #60a5fa;
|
|
}
|
|
.prose-dark a:hover {
|
|
color: #93c5fd;
|
|
}
|
|
.prose-dark code {
|
|
background-color: #1f2937;
|
|
color: #10b981;
|
|
padding: 0.125rem 0.25rem;
|
|
border-radius: 0.25rem;
|
|
}
|
|
.prose-dark pre {
|
|
background-color: #111827;
|
|
border: 1px solid #374151;
|
|
}
|
|
.prose-dark blockquote {
|
|
border-left: 4px solid #3b82f6;
|
|
background-color: #1f2937;
|
|
padding-left: 1rem;
|
|
padding-top: 0.5rem;
|
|
padding-bottom: 0.5rem;
|
|
margin: 1rem 0;
|
|
font-style: italic;
|
|
}
|
|
.prose-dark table {
|
|
border-collapse: collapse;
|
|
border: 1px solid #4b5563;
|
|
}
|
|
.prose-dark th, .prose-dark td {
|
|
border: 1px solid #4b5563;
|
|
padding: 0.75rem;
|
|
}
|
|
.prose-dark th {
|
|
background-color: #1f2937;
|
|
font-weight: 600;
|
|
}
|
|
.prose-dark img {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 0.5rem;
|
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* Sidebar styles */
|
|
.sidebar-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0.5rem 0.75rem;
|
|
border-radius: 0.5rem;
|
|
transition: background-color 0.2s;
|
|
cursor: pointer;
|
|
}
|
|
.sidebar-item:hover {
|
|
background-color: #374151;
|
|
}
|
|
.sidebar-item.active {
|
|
background-color: #2563eb;
|
|
color: white;
|
|
}
|
|
|
|
/* Custom button styles */
|
|
.btn-primary {
|
|
background-color: #2563eb;
|
|
color: white;
|
|
font-weight: 500;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.5rem;
|
|
transition: background-color 0.2s;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
}
|
|
.btn-primary:hover {
|
|
background-color: #1d4ed8;
|
|
}
|
|
.btn-secondary {
|
|
background-color: #4b5563;
|
|
color: white;
|
|
font-weight: 500;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.5rem;
|
|
transition: background-color 0.2s;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
}
|
|
.btn-secondary:hover {
|
|
background-color: #374151;
|
|
}
|
|
.btn-danger {
|
|
background-color: #dc2626;
|
|
color: white;
|
|
font-weight: 500;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 0.5rem;
|
|
transition: background-color 0.2s;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
}
|
|
.btn-danger:hover {
|
|
background-color: #b91c1c;
|
|
}
|
|
|
|
/* Modal styles */
|
|
.modal-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 50;
|
|
}
|
|
.modal-content {
|
|
background-color: #1f2937;
|
|
border-radius: 0.5rem;
|
|
padding: 1.5rem;
|
|
max-width: 32rem;
|
|
width: 100%;
|
|
margin: 1rem;
|
|
max-height: 24rem;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* Editor styles */
|
|
.editor-textarea {
|
|
width: 100%;
|
|
min-height: 24rem;
|
|
background-color: #1f2937;
|
|
color: #d1d5db;
|
|
border: 1px solid #4b5563;
|
|
border-radius: 0.5rem;
|
|
padding: 1rem;
|
|
font-family: monospace;
|
|
font-size: 0.875rem;
|
|
resize: vertical;
|
|
}
|
|
.editor-textarea:focus {
|
|
outline: none;
|
|
border-color: #3b82f6;
|
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
}
|
|
|
|
/* Form input styles */
|
|
.form-input, .form-textarea {
|
|
width: 100%;
|
|
background-color: #374151;
|
|
border: 1px solid #4b5563;
|
|
border-radius: 0.5rem;
|
|
padding: 0.5rem 0.75rem;
|
|
color: white;
|
|
}
|
|
.form-input:focus, .form-textarea:focus {
|
|
outline: none;
|
|
border-color: #3b82f6;
|
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
}
|
|
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
|
|
.rotate-90 {
|
|
transform: rotate(90deg);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="bg-slate-900 text-gray-300 min-h-screen">
|
|
<div class="flex h-screen">
|
|
<!-- Sidebar -->
|
|
<div id="sidebar" class="w-80 bg-slate-800 border-r border-gray-700 flex flex-col">
|
|
<!-- Header -->
|
|
<div class="p-4 border-b border-gray-700">
|
|
<div class="flex items-center justify-between">
|
|
<h1 class="text-xl font-bold text-white">{{.app_name}}</h1>
|
|
<div class="flex items-center space-x-2">
|
|
<a href="/settings" class="text-gray-400 hover:text-white transition-colors" title="Settings">
|
|
<i class="fas fa-cog"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Navigation -->
|
|
<div class="px-4 py-4">
|
|
<a href="/create" class="btn-primary text-sm w-full text-center">
|
|
<i class="fas fa-plus mr-2"></i>New Note
|
|
</a>
|
|
</div>
|
|
|
|
<!-- File Tree -->
|
|
<div class="flex-1 overflow-y-auto px-4 pb-4">
|
|
{{if .notes_tree}}
|
|
{{template "tree_node" dict "node" .notes_tree "active_path" .active_path "current_note" .current_note}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="flex-1 flex flex-col overflow-hidden">
|
|
<!-- Breadcrumbs -->
|
|
{{if .breadcrumbs}}
|
|
<div class="bg-slate-800 border-b border-gray-700 px-6 py-3">
|
|
<nav class="flex items-center space-x-2 text-sm">
|
|
{{range $i, $crumb := .breadcrumbs}}
|
|
{{if $i}}<i class="fas fa-chevron-right text-gray-500 text-xs"></i>{{end}}
|
|
{{if $crumb.URL}}
|
|
<a href="{{$crumb.URL}}" class="text-blue-400 hover:text-blue-300 transition-colors">{{$crumb.Name}}</a>
|
|
{{else}}
|
|
<span class="text-gray-300">{{$crumb.Name}}</span>
|
|
{{end}}
|
|
{{end}}
|
|
</nav>
|
|
</div>
|
|
{{end}}
|
|
|
|
<!-- Content Area -->
|
|
<div class="flex-1 overflow-y-auto">
|
|
{{block "content" .}}{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Scripts -->
|
|
<script>
|
|
// Initialize syntax highlighting
|
|
hljs.highlightAll();
|
|
|
|
// Tree functionality
|
|
document.addEventListener('click', function(e) {
|
|
if (e.target.closest('.tree-toggle')) {
|
|
const toggle = e.target.closest('.tree-toggle');
|
|
const children = toggle.nextElementSibling;
|
|
const chevron = toggle.querySelector('.tree-chevron');
|
|
|
|
if (children && children.classList.contains('tree-children')) {
|
|
children.classList.toggle('hidden');
|
|
if (chevron) {
|
|
chevron.classList.toggle('rotate-90');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// Auto-expand active path
|
|
function expandActivePath() {
|
|
const activeItem = document.querySelector('.sidebar-item.active');
|
|
if (activeItem) {
|
|
let parent = activeItem.parentElement;
|
|
while (parent) {
|
|
if (parent.classList.contains('tree-children')) {
|
|
parent.classList.remove('hidden');
|
|
const toggle = parent.previousElementSibling;
|
|
if (toggle && toggle.classList.contains('tree-toggle')) {
|
|
const chevron = toggle.querySelector('.tree-chevron');
|
|
if (chevron) {
|
|
chevron.classList.add('rotate-90');
|
|
}
|
|
}
|
|
}
|
|
parent = parent.parentElement;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Notification system
|
|
function showNotification(message, type = 'info', duration = 3000) {
|
|
const notification = document.createElement('div');
|
|
notification.className = `fixed top-4 right-4 z-50 px-6 py-3 rounded-lg shadow-lg max-w-sm`;
|
|
|
|
if (type === 'success') {
|
|
notification.className += ' bg-green-600 text-white';
|
|
} else if (type === 'error') {
|
|
notification.className += ' bg-red-600 text-white';
|
|
} else {
|
|
notification.className += ' bg-blue-600 text-white';
|
|
}
|
|
|
|
notification.innerHTML = `
|
|
<div class="flex items-center justify-between">
|
|
<span>${message}</span>
|
|
<button class="ml-4 text-white hover:text-gray-300" onclick="this.closest('div').remove()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
`;
|
|
|
|
document.body.appendChild(notification);
|
|
|
|
setTimeout(() => {
|
|
if (notification.parentElement) {
|
|
notification.remove();
|
|
}
|
|
}, duration);
|
|
}
|
|
|
|
// Initialize on page load
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
expandActivePath();
|
|
});
|
|
</script>
|
|
|
|
{{block "scripts" .}}{{end}}
|
|
</body>
|
|
</html>
|
|
{{end}}
|
|
<!-- Tree Node Template -->
|
|
{{define "tree_node"}}
|
|
<div class="tree-node">
|
|
{{if .node.Children}}
|
|
<div class="tree-toggle flex items-center py-1 hover:bg-gray-700 rounded px-2 cursor-pointer" data-path="{{.node.Path}}">
|
|
<i class="fas fa-chevron-right transform transition-transform duration-200 mr-2 text-xs tree-chevron"></i>
|
|
<span class="mr-2">📁</span>
|
|
<span class="flex-1">{{.node.Name}}</span>
|
|
</div>
|
|
<div class="tree-children ml-4 hidden">
|
|
{{range .node.Children}}
|
|
{{template "tree_node" dict "node" . "active_path" $.active_path "current_note" $.current_note}}
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
{{if eq .node.Type "md"}}
|
|
<a href="/note/{{.node.Path}}" class="sidebar-item {{if eq .current_note .node.Path}}active{{end}}">
|
|
<span class="mr-2">📝</span>
|
|
<span>{{.node.Name}}</span>
|
|
</a>
|
|
{{else}}
|
|
<a href="/view_text/{{.node.Path}}" class="sidebar-item">
|
|
<span class="mr-2">📄</span>
|
|
<span>{{.node.Name}}</span>
|
|
</a>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{end}} |