|
| 1 | +'use client'; |
| 2 | + |
| 3 | +import { useAtom, useSetAtom } from 'jotai'; |
| 4 | +import { useEffect, useState } from 'react'; |
| 5 | +import { activeCodinationAtom, panelAtom } from '@/atoms/chatAtoms'; |
| 6 | +import LucideIcon from '@/components/ui/icons/LucideIcon'; |
| 7 | +import SettingsPanel from '@/components/chat/settings/SettingsPanel'; |
| 8 | + |
| 9 | +export default function ChatMenu() { |
| 10 | + const [panel, setPanel] = useAtom(panelAtom); |
| 11 | + const setActiveCodination = useSetAtom(activeCodinationAtom); |
| 12 | + const [isClient, setIsClient] = useState(false); |
| 13 | + |
| 14 | + useEffect(() => { |
| 15 | + setIsClient(true); |
| 16 | + }, []); |
| 17 | + |
| 18 | + const handleChat = () => { |
| 19 | + setPanel('chat'); |
| 20 | + }; |
| 21 | + |
| 22 | + const handleCloset = () => { |
| 23 | + setPanel('closet'); |
| 24 | + setActiveCodination(null); |
| 25 | + }; |
| 26 | + |
| 27 | + const handleCodination = () => { |
| 28 | + setPanel('codination'); |
| 29 | + setActiveCodination(null); |
| 30 | + }; |
| 31 | + |
| 32 | + const handleFitting = () => { |
| 33 | + setPanel('fitting'); |
| 34 | + setActiveCodination(null); |
| 35 | + }; |
| 36 | + |
| 37 | + return ( |
| 38 | + <> |
| 39 | + {/* Bottom fixed nav: visible under 1440px */} |
| 40 | + <nav className="fixed bottom-0 left-0 right-0 z-50 bg-white dark:bg-slate-800 border-t border-slate-200 dark:border-slate-600 max-[1439px]:flex min-[1440px]:hidden"> |
| 41 | + <div className="flex items-center justify-around h-16 w-full"> |
| 42 | + <button |
| 43 | + aria-label="Chat" |
| 44 | + className={`w-16 flex flex-col items-center gap-1 ${isClient && panel == 'chat' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 45 | + onClick={handleChat} |
| 46 | + > |
| 47 | + <span className="inline-flex"> |
| 48 | + <LucideIcon name={'MessageSquare'} size={24} /> |
| 49 | + </span> |
| 50 | + <span className="text-xs">채팅</span> |
| 51 | + </button> |
| 52 | + <button |
| 53 | + aria-label="Closet" |
| 54 | + className={`w-16 flex flex-col items-center gap-1 ${isClient && panel == 'closet' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 55 | + onClick={handleCloset} |
| 56 | + > |
| 57 | + <span className="inline-flex"> |
| 58 | + <LucideIcon name={'Shirt'} size={24} /> |
| 59 | + </span> |
| 60 | + <span className="text-xs">옷장</span> |
| 61 | + </button> |
| 62 | + <button |
| 63 | + aria-label="Codination" |
| 64 | + className={`w-16 flex flex-col items-center gap-1 ${isClient && panel == 'codination' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 65 | + onClick={handleCodination} |
| 66 | + > |
| 67 | + <span className="inline-flex"> |
| 68 | + <LucideIcon name={'Layers'} size={24} /> |
| 69 | + </span> |
| 70 | + <span className="text-xs">코디</span> |
| 71 | + </button> |
| 72 | + <button |
| 73 | + aria-label="Fitting" |
| 74 | + className={`w-16 flex flex-col items-center gap-1 ${isClient && panel == 'fitting' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 75 | + onClick={handleFitting} |
| 76 | + > |
| 77 | + <span className="inline-flex"> |
| 78 | + <LucideIcon name={'ScanLine'} size={24} /> |
| 79 | + </span> |
| 80 | + <span className="text-xs">피팅</span> |
| 81 | + </button> |
| 82 | + <SettingsPanel> |
| 83 | + <button |
| 84 | + aria-label="Settings" |
| 85 | + className="w-16 flex flex-col items-center gap-1 text-slate-400 dark:text-slate-600" |
| 86 | + > |
| 87 | + <span className="inline-flex"> |
| 88 | + <LucideIcon name={'Settings'} size={24} /> |
| 89 | + </span> |
| 90 | + <span className="text-xs">설정</span> |
| 91 | + </button> |
| 92 | + </SettingsPanel> |
| 93 | + </div> |
| 94 | + </nav> |
| 95 | + |
| 96 | + {/* Left vertical sidebar: visible at 1440px and above */} |
| 97 | + <aside className="fixed top-0 left-0 bottom-0 z-50 w-28 bg-white dark:bg-slate-800 border-r border-slate-200 dark:border-slate-600 min-[1440px]:flex max-[1439px]:hidden"> |
| 98 | + <div className="flex flex-col items-center justify-center gap-10 w-full h-full"> |
| 99 | + <button |
| 100 | + aria-label="Chat" |
| 101 | + className={`w-full flex flex-col items-center gap-1 ${isClient && panel == 'chat' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 102 | + onClick={handleChat} |
| 103 | + > |
| 104 | + <span className="inline-flex"> |
| 105 | + <LucideIcon name={'MessageSquare'} size={24} /> |
| 106 | + </span> |
| 107 | + <span className="text-[10px]">채팅</span> |
| 108 | + </button> |
| 109 | + <button |
| 110 | + aria-label="Closet" |
| 111 | + className={`w-full flex flex-col items-center gap-1 ${isClient && panel == 'closet' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 112 | + onClick={handleCloset} |
| 113 | + > |
| 114 | + <span className="inline-flex"> |
| 115 | + <LucideIcon name={'Shirt'} size={24} /> |
| 116 | + </span> |
| 117 | + <span className="text-[10px]">옷장</span> |
| 118 | + </button> |
| 119 | + <button |
| 120 | + aria-label="Codination" |
| 121 | + className={`w-full flex flex-col items-center gap-1 ${isClient && panel == 'codination' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 122 | + onClick={handleCodination} |
| 123 | + > |
| 124 | + <span className="inline-flex"> |
| 125 | + <LucideIcon name={'Layers'} size={24} /> |
| 126 | + </span> |
| 127 | + <span className="text-[10px]">코디</span> |
| 128 | + </button> |
| 129 | + <button |
| 130 | + aria-label="Fitting" |
| 131 | + className={`w-full flex flex-col items-center gap-1 ${isClient && panel == 'fitting' ? 'font-bold text-blue-600 dark:text-blue-400' : 'text-slate-400 dark:text-slate-600'}`} |
| 132 | + onClick={handleFitting} |
| 133 | + > |
| 134 | + <span className="inline-flex"> |
| 135 | + <LucideIcon name={'ScanLine'} size={24} /> |
| 136 | + </span> |
| 137 | + <span className="text-[10px]">피팅</span> |
| 138 | + </button> |
| 139 | + <SettingsPanel> |
| 140 | + <button |
| 141 | + aria-label="Settings" |
| 142 | + className="w-full flex flex-col items-center gap-1 text-slate-400 dark:text-slate-600" |
| 143 | + > |
| 144 | + <span className="inline-flex"> |
| 145 | + <LucideIcon name={'Settings'} size={24} /> |
| 146 | + </span> |
| 147 | + <span className="text-[10px]">설정</span> |
| 148 | + </button> |
| 149 | + </SettingsPanel> |
| 150 | + </div> |
| 151 | + </aside> |
| 152 | + </> |
| 153 | + ); |
| 154 | +} |
0 commit comments