Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/api/alerts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// src/api/alerts.ts
import axios from '@/lib/axios';
import type { ApiResponse, PaginatedResponse } from '@/types/api';
import type { Notice } from '@/types/notice';
Expand Down
56 changes: 21 additions & 35 deletions src/components/layout/header/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const Nav = () => {
});
};

// βœ… role이 초기 undefined일 수 μžˆμ–΄ λ°©μ–΄
// role이 초기 undefined일 수 μžˆμ–΄ λ°©μ–΄
const currentRole: UserRole = (role ?? 'guest') as UserRole;

// βœ… μ•„μ΄μ½˜μ€ "νŒ¨λ„ μ—΄λ¦Ό μƒνƒœ"둜만 ν† κΈ€
// μ•„μ΄μ½˜μ€ "νŒ¨λ„ μ—΄λ¦Ό μƒνƒœ"둜만 ν† κΈ€
const bellIcon: 'notificationOn' | 'notificationOff' = open
? 'notificationOn'
: 'notificationOff';
Expand All @@ -69,17 +69,18 @@ const Nav = () => {
))}

{isLogin && (
<>
<button
type='button'
onClick={e => {
e.preventDefault();
logout('/');
}}
>
λ‘œκ·Έμ•„μ›ƒ
</button>

<button
type='button'
onClick={e => {
e.preventDefault();
logout('/');
}}
>
λ‘œκ·Έμ•„μ›ƒ
</button>
)}
{role === 'employee' && (
<div className='relative'>
{/* μ•Œλ¦Ό λ²„νŠΌ: ν† κΈ€ */}
<button
type='button'
Expand All @@ -101,29 +102,14 @@ const Nav = () => {

{/* νŒ¨λ„: 열릴 λ•Œλ§Œ λ Œλ” + μ‚¬μ΄μ¦ˆ κ³ μ •(ν”Όκ·Έλ§ˆ) */}
{open && (
<div
id='notification-panel'
role='dialog'
aria-modal='true'
className={cn(
'absolute right-2 top-[64px] z-[50]',
// λͺ¨λ°”일 κΈ°λ³Έ 375 x 812
'h-[812px] w-[375px]',
// νƒœλΈ”λ¦Ώ/λ°μŠ€ν¬νƒ‘ 368 x 419
'tablet:h-[419px] tablet:w-[368px]',
'desktop:h-[419px] desktop:w-[368px]',
'overflow-auto rounded-xl'
)}
>
<Notification
alerts={alerts}
onRead={handleRead}
isOpen={open}
onClose={() => setOpen(false)} // λ‚΄λΆ€ 닫기와 연동
/>
</div>
<Notification
alerts={alerts}
onRead={handleRead}
isOpen={open}
onClose={() => setOpen(false)} // λ‚΄λΆ€ 닫기와 연동
/>
)}
</>
</div>
)}
</nav>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/ui/dropdown/dropdown.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// src/components/ui/dropdown/dropdown.stories.tsx
import { ADDRESS_CODE, CATEGORY_CODE, SORT_CODE } from '@/constants/dropdown';
import type { Meta, StoryObj } from '@storybook/nextjs';
import { useState } from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/components/ui/input/input.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// src/components/ui/input/input.stories.tsx
import Button from '@/components/ui/button/button';
import type { Meta, StoryObj } from '@storybook/nextjs';
import { useState } from 'react';
Expand Down
32 changes: 19 additions & 13 deletions src/components/ui/modal/notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { Shop } from '@/types/shop';
import { useState } from 'react';
import NotificationMessage from './NotificationMessage';

const NOTI_STYLE = {
controlled: '',
uncontrolled: '',
};
export interface Alert {
id: string;
createdAt: string;
Expand Down Expand Up @@ -49,28 +53,30 @@ export default function Notification({ alerts, onRead, isOpen, onClose }: Notifi
)}

<div
role='dialog'
aria-modal='true'
className={cn(
'scroll-bar mt-2 w-full overflow-hidden bg-red-100 transition-all duration-300',
open ? 'max-h-[700px] px-5 py-6 opacity-100' : 'max-h-0 opacity-0',
'md:absolute md:right-0 md:top-1 md:max-h-[400px] md:rounded-xl md:border md:border-gray-300 md:py-6',
'fixed left-0 top-0 z-50 h-screen'
'w-full overflow-hidden bg-red-100',
'fixed right-0 top-0 z-10 h-dvh max-h-dvh border border-gray-300',
open ? 'px-5 py-6 opacity-100 md:max-h-[700px]' : 'max-h-0 opacity-0',
'md:absolute md:top-[calc(100%+8px)] md:max-h-[460px] md:w-[368px] md:rounded-xl'
)}
>
<div className='flex justify-between'>
<div className='text-[20px] font-bold'>μ•Œλ¦Ό {notificationCount}개</div>
<div>
<button onClick={() => (controlled ? onClose?.() : setInternalOpen(false))}>
<Icon iconName='close' iconSize='lg' ariaLabel='λ‹«κΈ°' />
</button>
</div>
<div className='mb-4 flex items-center justify-between'>
<div className='text-heading-s font-bold'>μ•Œλ¦Ό {notificationCount}개</div>
<button
className='icon-btn'
onClick={() => (controlled ? onClose?.() : setInternalOpen(false))}
>
<Icon iconName='close' iconSize='lg' ariaLabel='λ‹«κΈ°' />
</button>
</div>
<div></div>
{SORTED_ALERTS.length === 0 ? (
<div className='flex flex-1 items-center justify-center'>
<p className='font-medium'>μ•Œλ¦Όμ΄ μ—†μŠ΅λ‹ˆλ‹€.</p>
</div>
) : (
<div className='flex w-full flex-col items-center gap-4 overflow-y-auto md:max-h-[368px] md:flex-1'>
<div className='scroll-bar flex h-full w-full flex-col items-center gap-4 max-h-[calc(100%-48px)] md:max-h-[calc(460px-96px)]'>
{SORTED_ALERTS.map(alert => (
<NotificationMessage key={alert.id} alert={alert} onRead={onRead} />
))}
Expand Down
2 changes: 1 addition & 1 deletion src/context/userApplicationsProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// context/UserApplicationsProvider.tsx

import { getAllUserApplications, postApplication, putApplication } from '@/api/applications';
import useAuth from '@/hooks/useAuth';
import { ApiResponse } from '@/types/api';
Expand Down
Loading