Compare commits
15 Commits
33fef93ce0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ea8b3f6b6 | |||
| d52968e697 | |||
| bed7137e43 | |||
| 028e0b11c7 | |||
| 5bf43abab9 | |||
| f96ad4d14f | |||
| a4aff43091 | |||
| 1e20982e00 | |||
| ec7aaf44a9 | |||
| 00a5951654 | |||
| 8dba510a6c | |||
| e66ece71e3 | |||
| b96012f598 | |||
| e50ed261e1 | |||
| 79a09430aa |
@@ -7,6 +7,7 @@ APP_URL=http://localhost
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
APP_TIMEZONE=Asia/Tokyo
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
'timezone' => env('APP_TIMEZONE', 'Asia/Tokyo'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -27,7 +27,30 @@
|
||||
@livewireStyles
|
||||
@stack('styles')
|
||||
</head>
|
||||
<body class="font-sans antialiased" x-data="{ mobileMenuOpen: false }">
|
||||
<body class="font-sans antialiased" x-data="{
|
||||
mobileMenuOpen: false,
|
||||
sidebarWidth: localStorage.getItem('kb_sidebar_width') || 320,
|
||||
isResizing: false,
|
||||
startResize(e) {
|
||||
if (window.innerWidth < 1024) return; // lg breakpoint
|
||||
this.isResizing = true;
|
||||
document.body.style.cursor = 'col-resize';
|
||||
document.body.style.userSelect = 'none';
|
||||
},
|
||||
resize(e) {
|
||||
if (!this.isResizing) return;
|
||||
const newWidth = Math.max(200, Math.min(600, e.clientX));
|
||||
this.sidebarWidth = newWidth;
|
||||
localStorage.setItem('kb_sidebar_width', newWidth);
|
||||
},
|
||||
stopResize() {
|
||||
if (this.isResizing) {
|
||||
this.isResizing = false;
|
||||
document.body.style.cursor = '';
|
||||
document.body.style.userSelect = '';
|
||||
}
|
||||
}
|
||||
}" @mousemove.window="resize($event)" @mouseup.window="stopResize()">
|
||||
<div class="min-h-screen bg-gray-50">
|
||||
<!-- Header -->
|
||||
<header class="bg-white border-b border-gray-200 sticky top-0 z-20">
|
||||
@@ -176,8 +199,21 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
|
||||
<!-- Main Content -->
|
||||
<div class="flex h-[calc(100vh-4rem)]">
|
||||
<!-- Sidebar - Desktop -->
|
||||
<aside class="hidden lg:block w-64 bg-white border-r border-gray-200 overflow-y-auto">
|
||||
<aside
|
||||
id="kb-sidebar"
|
||||
class="hidden lg:block bg-white border-r border-gray-200 overflow-y-auto relative"
|
||||
:style="'width: ' + sidebarWidth + 'px'"
|
||||
>
|
||||
@livewire('sidebar-tree')
|
||||
|
||||
<!-- Resize Handle -->
|
||||
<div
|
||||
@mousedown="startResize($event)"
|
||||
class="absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-indigo-500 transition-colors group"
|
||||
title="ドラッグして幅を変更"
|
||||
>
|
||||
<div class="absolute top-1/2 right-0 transform translate-x-1/2 -translate-y-1/2 w-1.5 h-12 bg-gray-300 rounded-full group-hover:bg-indigo-500 transition-colors"></div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Sidebar - Mobile Overlay -->
|
||||
@@ -223,6 +259,91 @@ class="fixed inset-y-0 left-0 top-16 w-64 bg-white border-r border-gray-200 over
|
||||
|
||||
<!-- Global Keyboard Shortcuts -->
|
||||
<script>
|
||||
// Preserve sidebar scroll position during navigation
|
||||
document.addEventListener('click', function(e) {
|
||||
const sidebar = document.getElementById('kb-sidebar');
|
||||
if (!sidebar) return;
|
||||
|
||||
const link = e.target.closest('a');
|
||||
if (link && sidebar.contains(link)) {
|
||||
const scrollPos = sidebar.scrollTop;
|
||||
sessionStorage.setItem('kb_sidebar_scroll', scrollPos);
|
||||
}
|
||||
}, true);
|
||||
|
||||
// Restore scroll position after page load
|
||||
function restoreSidebarScroll() {
|
||||
const sidebar = document.getElementById('kb-sidebar');
|
||||
if (!sidebar) return;
|
||||
|
||||
const savedPos = sessionStorage.getItem('kb_sidebar_scroll');
|
||||
if (savedPos !== null && savedPos !== '0') {
|
||||
sidebar.scrollTop = parseInt(savedPos, 10);
|
||||
}
|
||||
}
|
||||
|
||||
// Highlight current document in sidebar
|
||||
function highlightCurrentDocument() {
|
||||
const sidebar = document.getElementById('kb-sidebar');
|
||||
if (!sidebar) {
|
||||
console.log('Sidebar not found for highlighting');
|
||||
return;
|
||||
}
|
||||
|
||||
const currentPath = window.location.pathname;
|
||||
const links = sidebar.querySelectorAll('a');
|
||||
|
||||
console.log('Current path:', currentPath);
|
||||
console.log('Found links in sidebar:', links.length);
|
||||
|
||||
links.forEach(link => {
|
||||
const href = link.getAttribute('href');
|
||||
|
||||
// Remove previous highlighting
|
||||
link.classList.remove('bg-indigo-50', 'text-indigo-700', 'font-semibold');
|
||||
link.classList.add('text-gray-700');
|
||||
|
||||
const icon = link.querySelector('svg');
|
||||
if (icon) {
|
||||
icon.classList.remove('text-indigo-600');
|
||||
icon.classList.add('text-gray-400', 'group-hover:text-gray-600');
|
||||
}
|
||||
|
||||
// Check if this is the current page
|
||||
if (href === currentPath || href === window.location.href ||
|
||||
(href && currentPath && href.endsWith(currentPath))) {
|
||||
console.log('Matched link:', href, 'with current path:', currentPath);
|
||||
link.classList.add('bg-indigo-50', 'text-indigo-700', 'font-semibold');
|
||||
link.classList.remove('text-gray-700');
|
||||
|
||||
if (icon) {
|
||||
icon.classList.remove('text-gray-400', 'group-hover:text-gray-600');
|
||||
icon.classList.add('text-indigo-600');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Restore on page load
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
restoreSidebarScroll();
|
||||
highlightCurrentDocument();
|
||||
});
|
||||
} else {
|
||||
restoreSidebarScroll();
|
||||
highlightCurrentDocument();
|
||||
}
|
||||
|
||||
// Also restore on window load (for safety)
|
||||
window.addEventListener('load', () => {
|
||||
restoreSidebarScroll();
|
||||
highlightCurrentDocument();
|
||||
});
|
||||
|
||||
// Update highlight after Alpine navigation
|
||||
document.addEventListener('alpine:navigated', highlightCurrentDocument);
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -21,7 +21,7 @@ class="inline-flex items-center justify-center px-3 sm:px-4 py-2 bg-indigo-600 t
|
||||
|
||||
<div class="flex flex-col sm:flex-row sm:items-center text-xs sm:text-sm text-gray-500 gap-2 sm:gap-4">
|
||||
<span>
|
||||
{{ __('messages.documents.updated') }} {{ $document->updated_at->diffForHumans() }}
|
||||
{{ __('messages.documents.updated') }} {{ $document->updated_at->diffForHumans() }}({{ config('app.timezone') }})
|
||||
</span>
|
||||
|
||||
@if($document->updated_by && $document->updater)
|
||||
@@ -77,7 +77,7 @@ class="block p-4 bg-gray-50 rounded-lg hover:bg-gray-100 transition"
|
||||
</div>
|
||||
<div>
|
||||
<span class="font-medium">{{ __('messages.documents.last_modified') }}:</span>
|
||||
<span class="ml-2">{{ $document->updated_at->format('Y-m-d H:i:s') }}</span>
|
||||
<span class="ml-2">{{ $document->updated_at->format('Y-m-d H:i:s') }}({{ config('app.timezone') }})</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user