-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: 공지 기능, 상단 공지 노출 기능 추가
- Loading branch information
Showing
37 changed files
with
301 additions
and
125 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 43 additions & 1 deletion
44
src/app/(providers)/(root)/[workspaceId]/chat/[id]/(resource)/notice/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
'use client'; | ||
|
||
import { supabase } from '@/utils/supabase/supabaseClient'; | ||
import { useParams } from 'next/navigation'; | ||
import { useEffect, useState } from 'react'; | ||
import { CHAT_TYPE } from '@/constants/chat'; | ||
import Typography from '@/components/Typography'; | ||
import dayjs from 'dayjs'; | ||
|
||
const NoticeListPage = () => { | ||
return <div>NoticeListPage</div>; | ||
const { id } = useParams(); | ||
const [noticeList, setNoticeList] = useState<any[]>([]); | ||
|
||
useEffect(() => { | ||
const getNoticeList = async () => { | ||
const res = await supabase | ||
.from('chat') | ||
.select('*') | ||
.eq('channel_id', id) | ||
.eq('type', CHAT_TYPE.notice) | ||
.order('created_at', { ascending: false }); | ||
setNoticeList(res.data || []); | ||
}; | ||
|
||
getNoticeList(); | ||
}, []); | ||
|
||
return ( | ||
<ul className="flex flex-col gap-4 py-[22px] px-4"> | ||
{noticeList.map((notice) => ( | ||
<li | ||
key={notice.id} | ||
className="h-[94px] bg-[#F7F7F7] shadow-[0px_1px_8px_0px_rgba(0,0,0,0.15)] rounded-[6px] px-3 py-4 flex flex-col justify-between" | ||
> | ||
<Typography variant="Subtitle14px" color="grey700Black"> | ||
{notice.content} | ||
</Typography> | ||
<Typography variant="Body12px" color="grey300"> | ||
{dayjs(notice.created_at).format('YYYY.MM.DD HH:mm')} | ||
</Typography> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default NoticeListPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/app/(providers)/(root)/[workspaceId]/chat/[id]/_components/ChatNotice/ChatNotice.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useParams } from 'next/navigation'; | ||
import { useGetLatestNotice } from '../../../_hooks/useQueryChat'; | ||
import { BellIcon, ChevronDownIcon } from '@/icons'; | ||
import Typography from '@/components/Typography'; | ||
import Link from 'next/link'; | ||
import useWorkspaceId from '@/hooks/useWorkspaceId'; | ||
import { isEmpty } from '@/utils/isEmpty'; | ||
|
||
const ChatNotice = () => { | ||
const { id } = useParams(); | ||
const workspaceId = useWorkspaceId(); | ||
const stringId = Array.isArray(id) ? id[0] : id; | ||
const { data: latestNotice, isPending: isPendingLatestNotice } = useGetLatestNotice({ id: stringId }); | ||
|
||
if (isEmpty(latestNotice) || isPendingLatestNotice) return null; | ||
|
||
return ( | ||
<> | ||
<Link | ||
href={`/${workspaceId}/chat/${stringId}/notice`} | ||
className="fixed top-0 left-0 right-0 mx-4 h-[34px] shadow-2xl rounded-[4px] flex items-center gap-1 bg-[#F7F7F7] py-2 px-3 z-30" | ||
> | ||
<BellIcon /> | ||
<Typography | ||
variant="Body12px" | ||
color="grey500" | ||
className="flex-grow text-ellipsis whitespace-nowrap overflow-hidden" | ||
> | ||
{latestNotice.content} | ||
</Typography> | ||
<ChevronDownIcon className="w-4 h-4 stroke-grey500" /> | ||
</Link> | ||
<div className="h-[34px] flex-shrink-0" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ChatNotice; |
1 change: 1 addition & 0 deletions
1
src/app/(providers)/(root)/[workspaceId]/chat/[id]/_components/ChatNotice/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ChatNotice'; |
Oops, something went wrong.