261015_01_ENH: 메인 화면·헤더 모바일 UI 개선 #51
@@ -1,7 +1,10 @@
|
||||
'use client'
|
||||
import {useMemo, useState} from "react";
|
||||
import {ChevronDown} from "lucide-react";
|
||||
import AppPageTitle from "@/components/app-shell/AppPageTitle";
|
||||
import {Badge} from "@/components/ui/badge";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {cn} from "@/lib/utils";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {getProjectColumns} from "@/components/table-column/ProjectTableColumn";
|
||||
import {
|
||||
@@ -100,6 +103,9 @@ const MainPage = () => {
|
||||
const [searchStatus, setSearchStatus] = useState<string[]>([]);
|
||||
const [searchDept, setSearchDept] = useState<string[]>([]);
|
||||
const [searchFw, setSearchFw] = useState<string[]>([]);
|
||||
// 모바일(md 미만)에서만 필터 영역을 접고 펼친다. md 이상에서는 항상 노출된다.
|
||||
const [filtersOpen, setFiltersOpen] = useState(false);
|
||||
const hasActiveFilters = searchStatus.length > 0 || searchDept.length > 0 || searchFw.length > 0;
|
||||
|
||||
const userId = auth.user?.userId ?? "";
|
||||
const userRole = auth.user?.userRole;
|
||||
@@ -155,53 +161,84 @@ const MainPage = () => {
|
||||
<div className="space-y-6 text-sm">
|
||||
<AppPageTitle titleText={"프로젝트"}/>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2">
|
||||
<Input
|
||||
placeholder="프로젝트 코드 Or 프로젝트 명"
|
||||
className="w-120 h-9 bg-white"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
handleSearchClick();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{
|
||||
isManager(userRole) &&
|
||||
<KriMultiSelect
|
||||
items={statusArray}
|
||||
value={searchStatus}
|
||||
onChange={setSearchStatus}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="진행 상태"
|
||||
widthClassName="w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
}
|
||||
<KriMultiSelect
|
||||
items={deptArray}
|
||||
value={searchDept}
|
||||
onChange={setSearchDept}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="담당 그룹"
|
||||
widthClassName="w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<KriMultiSelect
|
||||
items={fwArray}
|
||||
value={searchFw}
|
||||
onChange={setSearchFw}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="담당 실사"
|
||||
widthClassName="w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<div className="flex flex-col gap-2 md:flex-row md:flex-wrap md:items-center">
|
||||
<div className="flex flex-col gap-2 md:flex-1 md:flex-row md:flex-wrap md:items-center">
|
||||
<div className="flex items-center gap-2">
|
||||
<Input
|
||||
placeholder="프로젝트 코드 Or 프로젝트 명"
|
||||
className="h-9 flex-1 bg-white md:w-120 md:flex-none"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter") {
|
||||
handleSearchClick();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className="md:hidden"
|
||||
onClick={handleSearchClick}
|
||||
>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full justify-between md:hidden"
|
||||
aria-expanded={filtersOpen}
|
||||
aria-controls="project-search-filters"
|
||||
onClick={() => setFiltersOpen((prev) => !prev)}
|
||||
>
|
||||
<span className="flex items-center gap-2">
|
||||
필터
|
||||
{hasActiveFilters ? <Badge>적용 중</Badge> : null}
|
||||
</span>
|
||||
<ChevronDown className={cn("h-4 w-4 transition-transform", filtersOpen && "rotate-180")} />
|
||||
</Button>
|
||||
<div
|
||||
id="project-search-filters"
|
||||
className={cn(
|
||||
"flex flex-col gap-2 md:flex-row md:flex-wrap md:items-center",
|
||||
!filtersOpen && "hidden md:flex",
|
||||
)}
|
||||
>
|
||||
{
|
||||
isManager(userRole) &&
|
||||
<KriMultiSelect
|
||||
items={statusArray}
|
||||
value={searchStatus}
|
||||
onChange={setSearchStatus}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="진행 상태"
|
||||
widthClassName="w-full md:w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
}
|
||||
<KriMultiSelect
|
||||
items={deptArray}
|
||||
value={searchDept}
|
||||
onChange={setSearchDept}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="담당 그룹"
|
||||
widthClassName="w-full md:w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<KriMultiSelect
|
||||
items={fwArray}
|
||||
value={searchFw}
|
||||
onChange={setSearchFw}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="담당 실사"
|
||||
widthClassName="w-full md:w-60"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
className="hidden md:inline-flex"
|
||||
onClick={handleSearchClick}
|
||||
>
|
||||
검색
|
||||
@@ -209,6 +246,7 @@ const MainPage = () => {
|
||||
</div>
|
||||
{isInternal && (
|
||||
<Button
|
||||
className="w-full md:w-auto"
|
||||
onClick={handleCreateClick}
|
||||
>
|
||||
프로젝트 등록
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import { CalendarClock, LogOut, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import { CalendarClock, LogOut, UserRound, ZoomIn, ZoomOut } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { KriHeader } from "@/components/layout/KriHeader";
|
||||
import type { TopMenuItem } from "@/config/menu.types";
|
||||
import type { LoginUser } from "@kri/common";
|
||||
@@ -54,13 +62,13 @@ export function AppHeader({
|
||||
<>
|
||||
<KriHeader
|
||||
logo={
|
||||
<div className="flex h-10 w-20 items-center justify-center">
|
||||
<div className="flex h-10 w-16 items-center justify-center sm:w-20">
|
||||
<Image
|
||||
src="/kri_logo.png"
|
||||
alt="KRI 로고"
|
||||
width={120}
|
||||
height={40}
|
||||
className="object-contain"
|
||||
className="h-full w-full object-contain"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
@@ -73,7 +81,8 @@ export function AppHeader({
|
||||
onToggleMenu={onToggleMenu}
|
||||
onNavigate={(path) => {if(!isContactPage) onNavigate(path)}}
|
||||
className="border-gray-200 bg-white"
|
||||
innerClassName="h-16 px-4"
|
||||
// 모바일(sm 미만)은 헤더 폭이 좁아 로고와 우측 버튼이 겹치지 않도록 간격을 줄인다.
|
||||
innerClassName="h-16 gap-2 px-2 sm:gap-4 sm:px-4"
|
||||
center={
|
||||
showProjectTitle ? (
|
||||
<h1 className="ml-3 hidden truncate text-2xl font-bold lg:block" title={projectName}>{projectName}</h1>
|
||||
@@ -81,16 +90,16 @@ export function AppHeader({
|
||||
}
|
||||
right={
|
||||
<>
|
||||
<div className="flex items-center gap-1 border-r pr-4">
|
||||
<Button variant="ghost" size="icon" onClick={decreaseFontSize} title="폰트 작게">
|
||||
<div className="flex items-center gap-1 border-r pr-2 sm:pr-4">
|
||||
<Button variant="ghost" size="icon" className="size-8 sm:size-9" onClick={decreaseFontSize} title="폰트 작게">
|
||||
<ZoomOut className="h-4 w-4" />
|
||||
</Button>
|
||||
<span className="min-w-[3rem] text-center text-xs text-gray-500">{fontSize}px</span>
|
||||
<Button variant="ghost" size="icon" onClick={increaseFontSize} title="폰트 크게">
|
||||
<span className="min-w-6 text-center text-xs text-gray-500" title={`글자 크기 ${fontSize}px`}>{fontSize}</span>
|
||||
<Button variant="ghost" size="icon" className="size-8 sm:size-9" onClick={increaseFontSize} title="폰트 크게">
|
||||
<ZoomIn className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon-lg" onClick={onOpenReserveSearch} title="예약 내역 조회">
|
||||
<Button variant="ghost" size="icon-lg" className="size-8 sm:size-10" onClick={onOpenReserveSearch} title="예약 내역 조회">
|
||||
<CalendarClock className="size-6" />
|
||||
</Button>
|
||||
<span className="hidden items-center gap-1.5 text-sm text-gray-600 sm:inline-flex">
|
||||
@@ -108,10 +117,30 @@ export function AppHeader({
|
||||
</span>
|
||||
) : null}
|
||||
</span>
|
||||
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
|
||||
<Button variant="ghost" size="sm" className="hidden gap-2 sm:inline-flex" onClick={() => onNavigate("/logout")}>
|
||||
<LogOut className="h-4 w-4" />
|
||||
<span className="hidden sm:inline">로그아웃</span>
|
||||
<span>로그아웃</span>
|
||||
</Button>
|
||||
{/* 모바일(sm 미만)은 헤더 폭이 좁아 이름과 로그아웃을 사용자 메뉴로 묶는다. CTI는 모바일에서 사용하지 않아 표시하지 않는다. */}
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="size-8 sm:hidden" title="사용자 메뉴" aria-label="사용자 메뉴">
|
||||
<UserRound className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
{userInfo?.userName ? (
|
||||
<>
|
||||
<DropdownMenuLabel>{`${userInfo.userName} 님`}</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
</>
|
||||
) : null}
|
||||
<DropdownMenuItem onSelect={() => onNavigate("/logout")}>
|
||||
<LogOut className="h-4 w-4" />
|
||||
로그아웃
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -200,7 +200,7 @@ export default function AppMainLayout({ children, initialFontSize }: AppMainLayo
|
||||
bodyClassName={cn(!isMain && isContactPage && "min-h-0")}
|
||||
mainClassName={cn("p-4", "min-h-0")}
|
||||
mainStyle={{ fontSize: `var(--content-font-size, ${initialFontSize}px)` }}
|
||||
sidebarOpen={!isMain && isContactPage && menuOpen}
|
||||
sidebarOpen={!isMain && !isContactPage && menuOpen}
|
||||
onSidebarOpenChange={setMenuOpen}
|
||||
header={
|
||||
<AppHeader
|
||||
|
||||
Reference in New Issue
Block a user