nav_big.tmpl 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <aside class="w-64 border-r border-zinc-800 bg-zinc-900/50 flex flex-col">
  2. <div class="p-4 flex justify-between items-center border-b border-zinc-800">
  3. <span class="text-xs font-bold uppercase tracking-widest text-zinc-500">Main Vault</span>
  4. <span class="text-[10px] px-1.5 py-0.5 rounded bg-zinc-800 text-zinc-400 border border-zinc-700">v2.4</span>
  5. </div>
  6. <div class="flex-1 overflow-y-auto custom-scrollbar p-2 space-y-0.5">
  7. {{range .Subfoldere}}
  8. {{template "folder" .}}
  9. {{end}}
  10. {{range .Fisiere}}
  11. <a href="/notes/?note={{.Path}}"
  12. class="flex items-center gap-2 px-2 py-1 text-xs rounded hover:bg-zinc-800 text-zinc-500 hover:text-zinc-300 transition-colors">
  13. {{/* File icon */}}
  14. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  15. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
  16. class="shrink-0 text-zinc-600">
  17. <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
  18. <polyline points="14 2 14 8 20 8"/>
  19. </svg>
  20. <span class="truncate">{{.Nume}}</span>
  21. </a>
  22. {{end}}
  23. </div>
  24. {{/* BOTTOM: NEW ROOT FOLDER */}}
  25. <div class="p-2 border-t border-zinc-800">
  26. <form method="POST" action="/api/create_dir" class="flex gap-1 items-center">
  27. <input type="hidden" name="director" value="">
  28. <input
  29. type="text"
  30. name="subdirector"
  31. placeholder="New folder..."
  32. class="flex-1 bg-zinc-800 text-zinc-300 text-xs rounded px-2 py-1 outline-none border border-zinc-700 focus:border-zinc-500 placeholder-zinc-600"
  33. >
  34. <button type="submit"
  35. class="text-zinc-400 hover:text-zinc-100 hover:bg-zinc-700 rounded p-1 transition-colors border border-zinc-700"
  36. title="Create folder">
  37. {{/* Plus icon */}}
  38. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  39. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  40. <line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
  41. </svg>
  42. </button>
  43. </form>
  44. </div>
  45. </aside>
  46. {{define "folder"}}
  47. <details open class="group">
  48. <summary class="flex items-center justify-between px-2 py-1 text-xs rounded hover:bg-zinc-800 cursor-pointer list-none text-zinc-400 group-open:text-zinc-200 transition-colors">
  49. <div class="flex items-center gap-1.5 min-w-0">
  50. {{/* Chevron */}}
  51. <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24"
  52. fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"
  53. class="shrink-0 transition-transform duration-150 group-open:rotate-90">
  54. <polyline points="9 18 15 12 9 6"/>
  55. </svg>
  56. {{/* Folder icon — closed */}}
  57. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  58. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
  59. class="shrink-0 text-zinc-500 group-open:hidden">
  60. <path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/>
  61. </svg>
  62. {{/* Folder icon — open */}}
  63. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  64. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
  65. class="shrink-0 text-zinc-300 hidden group-open:block">
  66. <path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/>
  67. <line x1="2" y1="10" x2="22" y2="10"/>
  68. </svg>
  69. <span class="truncate">{{.Nume}}</span>
  70. </div>
  71. {{/* ACTION BUTTONS — visible on hover only */}}
  72. <div class="flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">
  73. {{/* New note button */}}
  74. <form method="POST" action="/api/save_note">
  75. <input type="hidden" name="director" value="{{.Nume}}">
  76. <input type="hidden" name="titlu" value="Untitled">
  77. <input type="hidden" name="notita" value="">
  78. <button type="submit"
  79. onclick="event.stopPropagation()"
  80. class="text-zinc-500 hover:text-zinc-100 hover:bg-zinc-700 rounded p-0.5 transition-colors"
  81. title="New note">
  82. {{/* File plus icon */}}
  83. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  84. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  85. <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
  86. <polyline points="14 2 14 8 20 8"/>
  87. <line x1="12" y1="18" x2="12" y2="12"/>
  88. <line x1="9" y1="15" x2="15" y2="15"/>
  89. </svg>
  90. </button>
  91. </form>
  92. {{/* New subfolder button */}}
  93. <button
  94. onclick="event.stopPropagation(); var f = this.closest('details').querySelector('.new-folder-form'); f.style.display = f.style.display === 'none' ? 'flex' : 'none'; f.querySelector('input[type=text]').focus();"
  95. class="text-zinc-500 hover:text-zinc-100 hover:bg-zinc-700 rounded p-0.5 transition-colors"
  96. title="New folder">
  97. {{/* Folder plus icon */}}
  98. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  99. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  100. <path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"/>
  101. <line x1="12" y1="13" x2="12" y2="19"/>
  102. <line x1="9" y1="16" x2="15" y2="16"/>
  103. </svg>
  104. </button>
  105. </div>
  106. </summary>
  107. {{/* INLINE FOLDER NAME INPUT */}}
  108. <form method="POST" action="/api/create_dir"
  109. class="new-folder-form gap-1 px-2 py-1 items-center"
  110. style="display:none;">
  111. <input type="hidden" name="director" value="{{.Nume}}">
  112. <input
  113. type="text"
  114. name="subdirector"
  115. placeholder="Folder name..."
  116. class="flex-1 bg-zinc-800 text-zinc-300 text-xs rounded px-2 py-1 outline-none border border-zinc-700 focus:border-zinc-500 placeholder-zinc-600"
  117. >
  118. <button type="submit"
  119. class="text-zinc-400 hover:text-zinc-100 hover:bg-zinc-700 rounded p-1 transition-colors border border-zinc-700">
  120. <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 24 24"
  121. fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
  122. <polyline points="20 6 9 17 4 12"/>
  123. </svg>
  124. </button>
  125. </form>
  126. {{/* CHILDREN */}}
  127. <div class="ml-3 pl-2 border-l border-zinc-800 space-y-0.5 mt-0.5">
  128. {{range .Fisiere}}
  129. <a href="/notes/?note={{.Path}}"
  130. class="flex items-center gap-2 px-2 py-1 text-xs rounded hover:bg-zinc-800 text-zinc-500 hover:text-zinc-300 transition-colors">
  131. <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24"
  132. fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
  133. class="shrink-0 text-zinc-600">
  134. <path d="M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"/>
  135. <polyline points="14 2 14 8 20 8"/>
  136. </svg>
  137. <span class="truncate">{{.Nume}}</span>
  138. </a>
  139. {{end}}
  140. {{range .Subfoldere}}
  141. {{template "folder" .}}
  142. {{end}}
  143. </div>
  144. </details>
  145. {{end}}