From 2e9ff6c832a7eeb8561e3df845609c6d6b8d55cc Mon Sep 17 00:00:00 2001 From: sky121113 Date: Fri, 13 Feb 2026 14:46:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=A6=E7=8F=BE=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=99=9F=E8=87=AA=E5=8B=95=E5=8C=96=E6=9B=B4=E6=96=B0=E8=88=87?= =?UTF-8?q?=E4=BF=AE=E5=BE=A9=E5=81=B4=E9=82=8A=E6=AC=84=20RWD=20=E5=95=8F?= =?UTF-8?q?=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yaml | 8 + app/Http/Middleware/HandleInertiaRequests.php | 1 + config/app.php | 2 + resources/js/Layouts/AuthenticatedLayout.tsx | 32 +-- .../js/Pages/Admin/ActivityLog/Index.tsx | 209 ++++++++---------- resources/js/types/global.d.ts | 1 + 6 files changed, 123 insertions(+), 130 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index b99df99..82e6644 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -92,6 +92,10 @@ jobs: key: ${{ secrets.DEMO_SSH_KEY }} script: | docker exec -u 1000:1000 -w /var/www/html star-erp-laravel sh -c " + # 0. 更新版本號 (使用 Git Hash) + VERSION=\"v1.0-\$(git rev-parse --short HEAD)\" + sed -i \"s/^APP_VERSION=.*/APP_VERSION=\$VERSION/\" .env || echo \"APP_VERSION=\$VERSION\" >> .env + # 1. 後端依賴 (Demo 環境建議加上 --no-interaction 避免卡住) composer install --no-dev --optimize-autoloader --no-interaction && @@ -191,6 +195,10 @@ jobs: echo "容器狀態:" && docker ps --filter "name=star-erp-laravel" docker exec -u 1000:1000 -w /var/www/html star-erp-laravel sh -c " + # 0. 更新版本號 + VERSION=\"v1.0-\$(git rev-parse --short HEAD)\" + sed -i \"s/^APP_VERSION=.*/APP_VERSION=\$VERSION/\" .env || echo \"APP_VERSION=\$VERSION\" >> .env + composer install --no-dev --optimize-autoloader && npm install && npm run build diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 7783949..381e27f 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -46,6 +46,7 @@ class HandleInertiaRequests extends Middleware return [ ...parent::share($request), 'appName' => $appName, + 'app_version' => config('app.version'), 'auth' => [ 'user' => $user ? [ 'id' => $user->id, diff --git a/config/app.php b/config/app.php index cb0ed2d..fef8216 100644 --- a/config/app.php +++ b/config/app.php @@ -15,6 +15,8 @@ return [ 'name' => env('APP_NAME', 'Laravel'), + 'version' => env('APP_VERSION', '1.0.0'), + /* |-------------------------------------------------------------------------- | Application Environment diff --git a/resources/js/Layouts/AuthenticatedLayout.tsx b/resources/js/Layouts/AuthenticatedLayout.tsx index 348be2d..d85dc61 100644 --- a/resources/js/Layouts/AuthenticatedLayout.tsx +++ b/resources/js/Layouts/AuthenticatedLayout.tsx @@ -386,13 +386,15 @@ export default function AuthenticatedLayout({ }); }; - const renderMenuItem = (item: MenuItem, level: number = 0) => { + const renderMenuItem = (item: MenuItem, level: number = 0, forceExpand: boolean = false) => { const hasChildren = item.children && item.children.length > 0; const isExpanded = expandedItems.includes(item.id); const isActive = item.route ? (item.route === '/' ? url === '/' : url.startsWith(item.route)) : false; + const effectivelyCollapsed = isCollapsed && !forceExpand; + return (
{hasChildren ? ( @@ -401,21 +403,21 @@ export default function AuthenticatedLayout({ className={cn( "w-full flex items-center transition-all rounded-lg group", level === 0 ? "px-3 py-2.5" : "px-3 py-2 pl-10", - level === 0 && !isCollapsed && "hover:bg-slate-100", - isCollapsed && level === 0 && "justify-center px-0 h-10 w-10 mx-auto hover:bg-slate-100" + level === 0 && !effectivelyCollapsed && "hover:bg-slate-100", + effectivelyCollapsed && level === 0 && "justify-center px-0 h-10 w-10 mx-auto hover:bg-slate-100" )} - title={isCollapsed ? item.label : ""} + title={effectivelyCollapsed ? item.label : ""} > {level === 0 && ( {item.icon} )} - {!isCollapsed && ( + {!effectivelyCollapsed && ( <> {item.label} @@ -438,22 +440,22 @@ export default function AuthenticatedLayout({ className={cn( "w-full flex items-center transition-all rounded-lg group", level === 0 ? "px-3 py-2.5" : "px-3 py-2", - level > 0 && !isCollapsed && "pl-11", + level > 0 && !effectivelyCollapsed && "pl-11", isActive ? "bg-primary-lightest text-primary-main" : "text-slate-600 hover:bg-slate-100 hover:text-slate-900", - isCollapsed && level === 0 && "justify-center px-0 h-10 w-10 mx-auto" + effectivelyCollapsed && level === 0 && "justify-center px-0 h-10 w-10 mx-auto" )} - title={isCollapsed ? item.label : ""} + title={effectivelyCollapsed ? item.label : ""} > {item.icon && ( {item.icon} )} - {!isCollapsed && ( + {!effectivelyCollapsed && ( {item.label} @@ -461,9 +463,9 @@ export default function AuthenticatedLayout({ )} - {hasChildren && isExpanded && !isCollapsed && ( + {hasChildren && isExpanded && !effectivelyCollapsed && (
- {item.children?.map((child) => renderMenuItem(child, level + 1))} + {item.children?.map((child) => renderMenuItem(child, level + 1, forceExpand))}
)}
@@ -573,7 +575,7 @@ export default function AuthenticatedLayout({
- {!isCollapsed &&

Version 1.0.0

} + {!isCollapsed &&

Version {props.app_version || '1.0.0'}

}
diff --git a/resources/js/Pages/Admin/ActivityLog/Index.tsx b/resources/js/Pages/Admin/ActivityLog/Index.tsx index 01c2248..0ef4a07 100644 --- a/resources/js/Pages/Admin/ActivityLog/Index.tsx +++ b/resources/js/Pages/Admin/ActivityLog/Index.tsx @@ -4,7 +4,7 @@ import { Head, router } from '@inertiajs/react'; import { PageProps } from '@/types/global'; import Pagination from '@/Components/shared/Pagination'; import { SearchableSelect } from "@/Components/ui/searchable-select"; -import { FileText, Search, RotateCcw, Calendar, ChevronDown, ChevronUp } from 'lucide-react'; +import { FileText, Search, RotateCcw, Calendar } from 'lucide-react'; import LogTable, { Activity } from '@/Components/ActivityLog/LogTable'; import ActivityDetailDialog from '@/Components/ActivityLog/ActivityDetailDialog'; import { Button } from '@/Components/ui/button'; @@ -57,10 +57,7 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u const [causer, setCauser] = useState(filters.causer_id || 'all'); const [dateRangeType, setDateRangeType] = useState('custom'); - // Advanced Filter Toggle - const [showAdvancedFilter, setShowAdvancedFilter] = useState( - !!(filters.date_start || filters.date_end) - ); + const handleDateRangeChange = (type: string) => { setDateRangeType(type); @@ -161,75 +158,12 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u {/* 篩選區塊 */} -
-
- {/* 關鍵字搜尋 */} -
- -
- - setSearch(e.target.value)} - className="pl-10 h-9 block" - onKeyDown={(e) => e.key === 'Enter' && handleFilter()} - /> -
-
- - {/* 事件類型 */} -
- - -
- - {/* 操作對象 */} -
- - -
- - {/* 操作人員 */} -
- - -
-
- - {/* Row 2: Date Filters (Collapsible) */} - {showAdvancedFilter && ( -
-
- +
+
+ {/* Top Config: Date Range & Quick Buttons */} +
+
+
{[ { label: "今日", value: "today" }, @@ -254,10 +188,11 @@ export default function ActivityLogIndex({ activities, filters, subject_types, u
-
-
+ {/* Date Inputs */} +
+
- +
- +
- )} - {/* Action Bar */} -
- - - + {/* Detailed Filters row */} +
+ {/* 事件類型 */} +
+ + +
+ + {/* 操作對象 */} +
+ + +
+ + {/* 操作人員 */} +
+ + +
+ + {/* 關鍵字搜尋 */} +
+ +
+ + setSearch(e.target.value)} + className="pl-10 h-9 block bg-white" + onKeyDown={(e) => e.key === 'Enter' && handleFilter()} + /> +
+
+ + {/* Action Buttons Integrated */} +
+ + +
+
diff --git a/resources/js/types/global.d.ts b/resources/js/types/global.d.ts index c7330af..1f362b3 100644 --- a/resources/js/types/global.d.ts +++ b/resources/js/types/global.d.ts @@ -28,6 +28,7 @@ export interface PageProps { error?: string; }; branding?: Branding | null; + app_version?: string; [key: string]: unknown; }