@@ -6,15 +6,16 @@ import {
66 faComment ,
77 faEye ,
88 faReply ,
9- faThumbsUp , IconDefinition
9+ faThumbsUp ,
10+ IconDefinition ,
1011} from "@fortawesome/free-solid-svg-icons" ;
1112import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
12- import { Menu , Transition } from ' @headlessui/react' ;
13+ import { Menu , Transition } from " @headlessui/react" ;
1314import clsx from "clsx" ;
14- import { Fragment , useState } from ' react' ;
15+ import { Fragment , useState } from " react" ;
1516import { updatePreferences } from "@/actions/notifications/update-preferences" ;
1617import { toast } from "sonner" ;
17- import { useDashboardContext } from "@/app/(org)/dashboard /Contexts" ;
18+ import { useDashboardContext } from "../.. /Contexts" ;
1819
1920type NotificationOption = {
2021 icon : IconDefinition ;
@@ -26,31 +27,34 @@ const notificationOptions: NotificationOption[] = [
2627 { icon : faComment , label : "Comments" , value : "pauseComments" } ,
2728 { icon : faReply , label : "Replies" , value : "pauseReplies" } ,
2829 { icon : faEye , label : "Views" , value : "pauseViews" } ,
29- { icon : faThumbsUp , label : "Reactions" , value : "pauseReactions" }
30- ]
30+ { icon : faThumbsUp , label : "Reactions" , value : "pauseReactions" } ,
31+ ] ;
3132
3233export const SettingsDropdown = ( ) => {
3334 const [ showPauseSubmenu , setShowPauseSubmenu ] = useState ( false ) ;
3435 const { userPreferences } = useDashboardContext ( ) ;
3536
36-
3737 const updateNotificationPreferences = async ( option : NotificationOption ) => {
3838 try {
3939 const currentPrefs = userPreferences ?. notifications ?? {
4040 pauseComments : false ,
4141 pauseReplies : false ,
4242 pauseViews : false ,
43- pauseReactions : false
43+ pauseReactions : false ,
4444 } ;
4545
4646 await updatePreferences ( {
4747 notifications : {
4848 ...currentPrefs ,
49- [ option . value ] : ! ( currentPrefs [ option . value ] ?? false )
50- }
49+ [ option . value ] : ! ( currentPrefs [ option . value ] ?? false ) ,
50+ } ,
5151 } ) ;
5252
53- toast . success ( `Notifications from ${ option . label } have been ${ ! ( currentPrefs [ option . value ] ?? false ) ? "paused" : "unpaused" } ` ) ;
53+ toast . success (
54+ `Notifications from ${ option . label } have been ${
55+ ! ( currentPrefs [ option . value ] ?? false ) ? "paused" : "unpaused"
56+ } `
57+ ) ;
5458 } catch ( error ) {
5559 console . error ( "Failed to update preferences:" , error ) ;
5660 toast . error ( "Failed to update notification preferences" ) ;
@@ -60,10 +64,7 @@ export const SettingsDropdown = () => {
6064 return (
6165 < Menu as = "div" className = "relative" >
6266 < Menu . Button className = "flex gap-1 items-center transition-opacity duration-200 cursor-pointer hover:opacity-70" >
63- < FontAwesomeIcon
64- icon = { faCog }
65- className = "text-gray-10 size-3"
66- />
67+ < FontAwesomeIcon icon = { faCog } className = "text-gray-10 size-3" />
6768 < p className = "text-[13px] text-gray-10" > Settings</ p >
6869 </ Menu . Button >
6970
@@ -83,16 +84,24 @@ export const SettingsDropdown = () => {
8384 < div
8485 className = { clsx (
8586 "flex flex-1 items-center group justify-between px-2 py-1 min-w-fit text-[13px] text-gray-11 rounded-lg cursor-pointer outline-none" ,
86- active || showPauseSubmenu ? ' bg-gray-3' : ''
87+ active || showPauseSubmenu ? " bg-gray-3" : ""
8788 ) }
8889 onMouseEnter = { ( ) => setShowPauseSubmenu ( true ) }
8990 onMouseLeave = { ( ) => setShowPauseSubmenu ( false ) }
9091 >
9192 < div className = "flex gap-2 items-center" >
92- < FontAwesomeIcon icon = { faBellSlash } className = "text-gray-10 text-[13px] size-3.5 transition-colors group-hover:text-gray-12" />
93- < p className = "text-[13px] transition-colors group-hover:text-gray-12" > Pause notifications</ p >
93+ < FontAwesomeIcon
94+ icon = { faBellSlash }
95+ className = "text-gray-10 text-[13px] size-3.5 transition-colors group-hover:text-gray-12"
96+ />
97+ < p className = "text-[13px] transition-colors group-hover:text-gray-12" >
98+ Pause notifications
99+ </ p >
94100 </ div >
95- < FontAwesomeIcon icon = { faArrowUp } className = "text-gray-10 size-2.5 rotate-90 transition-colors group-hover:text-gray-12" />
101+ < FontAwesomeIcon
102+ icon = { faArrowUp }
103+ className = "text-gray-10 size-2.5 rotate-90 transition-colors group-hover:text-gray-12"
104+ />
96105 </ div >
97106 ) }
98107 </ Menu . Item >
@@ -108,11 +117,18 @@ export const SettingsDropdown = () => {
108117 < div
109118 key = { index }
110119 className = "flex w-full items-center justify-between gap-2 px-2 py-1 text-[13px] text-gray-11 rounded-lg group hover:bg-gray-3 cursor-pointer outline-none"
111- onClick = { async ( ) => await updateNotificationPreferences ( option ) }
120+ onClick = { async ( ) =>
121+ await updateNotificationPreferences ( option )
122+ }
112123 >
113124 < div className = "flex gap-1.5 items-center" >
114- < FontAwesomeIcon icon = { option . icon } className = "text-gray-10 size-3.5 transition-colors group-hover:text-gray-12" />
115- < p className = "text-[13px] transition-colors group-hover:text-gray-12" > { option . label } </ p >
125+ < FontAwesomeIcon
126+ icon = { option . icon }
127+ className = "text-gray-10 size-3.5 transition-colors group-hover:text-gray-12"
128+ />
129+ < p className = "text-[13px] transition-colors group-hover:text-gray-12" >
130+ { option . label }
131+ </ p >
116132 </ div >
117133
118134 { userPreferences ?. notifications [ option . value ] && (
@@ -133,4 +149,3 @@ export const SettingsDropdown = () => {
133149} ;
134150
135151export default SettingsDropdown ;
136-
0 commit comments