@@ -3,9 +3,15 @@ import {
33 Dialog ,
44 Disclosure ,
55 Menu ,
6+ Popover ,
67 Transition ,
78} from "@headlessui/react" ;
8- import { DocumentPlusIcon , PlusIcon } from "@heroicons/react/20/solid" ;
9+ import {
10+ ArchiveBoxIcon ,
11+ DocumentPlusIcon ,
12+ InboxStackIcon ,
13+ PlusIcon ,
14+ } from "@heroicons/react/20/solid" ;
915import {
1016 Bars3Icon ,
1117 Cog6ToothIcon ,
@@ -312,7 +318,7 @@ function CommandModal() {
312318export default function NewLayout ( { children } : any ) {
313319 const location = useRouter ( ) ;
314320
315- const { loading, user } = useUser ( ) ;
321+ const { loading, user, fetchUserProfile } = useUser ( ) ;
316322 const locale = user ? user . language : "en" ;
317323
318324 const [ queues , setQueues ] = useState ( [ ] ) ;
@@ -432,6 +438,7 @@ export default function NewLayout({ children }: any) {
432438 Authorization : `Bearer ${ getCookie ( "session" ) } ` ,
433439 } ,
434440 } ) . then ( ( res ) => res . json ( ) ) ;
441+ await fetchUserProfile ( ) ;
435442 }
436443
437444 // useEffect(() => {
@@ -442,41 +449,6 @@ export default function NewLayout({ children }: any) {
442449 // getQueues();
443450 // }, [user])
444451
445- // const handleKeyPress = useCallback((event: any, location: any) => {
446- // console.log(location);
447- // if (
448- // document.activeElement!.tagName !== "INPUT" &&
449- // document.activeElement!.tagName !== "TEXTAREA" &&
450- // !document.activeElement!.className.includes("ProseMirror")
451- // ) {
452- // switch (event.key) {
453- // case "c":
454- // location.push("/new");
455- // break;
456- // case "h":
457- // location.push("/");
458- // break;
459- // case "n":
460- // location.push("/notebook");
461- // break;
462- // case "t":
463- // location.push("/tickets");
464- // break;
465- // case "a":
466- // location.push("/admin");
467- // break;
468- // case "o":
469- // location.push("/tickets/open");
470- // break;
471- // case "f":
472- // location.push("/tickets/closed");
473- // break;
474- // default:
475- // break;
476- // }
477- // }
478- // }, []);
479-
480452 function handleKeyPress ( event : any ) {
481453 const pathname = location . pathname ;
482454 console . log ( pathname ) ;
@@ -1007,39 +979,24 @@ export default function NewLayout({ children }: any) {
1007979 < CommandModal />
1008980 </ div >
1009981
1010- { /* <div
1011- className="relative mt-2 hidden sm:flex items-center w-full min-w-[320px] max-w-[360px] hover:cursor-pointer"
1012- onClick={() => {
1013- spotlight.open();
1014- }}
1015- >
1016- <input
1017- type="text"
1018- name="search"
1019- id="search"
1020- readOnly
1021- placeholder="Spotlight Search"
1022- onClick={() => {
1023- spotlight.open();
1024- }}
1025- className="block w-full hover:cursor-pointer rounded-md border-0 py-1.5 pr-14 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
1026- />
1027- <div className="absolute inset-y-0 right-0 flex py-2.5 pr-1">
1028- <kbd className="inline-flex items-center rounded border border-gray-200 px-1.5 font-sans text-xs text-gray-400">
1029- /
1030- </kbd>
1031- </div>
1032- </div> */ }
1033982 < div className = "flex w-full justify-end items-center gap-x-2 lg:gap-x-2 " >
1034- { /* <Popover className="relative">
1035- <Popover.Button className="relative rounded-full p-1 text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">
1036- <BellAlertIcon
1037- className="h-6 w-6 text-white"
1038- aria-hidden="true"
1039- />
983+ < Popover className = "relative" >
984+ < Popover . Button className = "relative border rounded-md p-2 shadow-md text-gray-400 hover:text-gray-500 focus:outline-none" >
985+ < InboxStackIcon className = "h-4 w-4 text-black" />
986+ { user . notifcations . filter (
987+ ( notification ) => ! notification . read
988+ ) . length > 0 && (
989+ < svg
990+ className = "h-2.5 w-2.5 absolute bottom-6 left-6 animate-pulse fill-green-500"
991+ viewBox = "0 0 6 6"
992+ aria-hidden = "true"
993+ >
994+ < circle cx = { 3 } cy = { 3 } r = { 3 } />
995+ </ svg >
996+ ) }
1040997 </ Popover . Button >
1041998
1042- <Popover.Panel className="absolute z-10 sm:min-w-[400px] right-1 overflow-hidden rounded-lg bg-white shadow">
999+ < Popover . Panel className = "absolute z-10 mt-1 sm:min-w-[400px] right-1 overflow-hidden rounded-lg bg-white shadow" >
10431000 < div className = "px-6 p-6" >
10441001 < div className = "border-b border-gray-200" >
10451002 < nav
@@ -1112,8 +1069,8 @@ export default function NewLayout({ children }: any) {
11121069 </ div >
11131070 </ div >
11141071 </ Popover . Panel >
1115- </Popover> */ }
1116- { /* Profile dropdown */ }
1072+ </ Popover >
1073+
11171074 < Link
11181075 href = "https://github.com/Peppermint-Lab/peppermint/discussions"
11191076 target = "_blank"
@@ -1123,6 +1080,8 @@ export default function NewLayout({ children }: any) {
11231080 Send Feedback
11241081 </ Button >
11251082 </ Link >
1083+
1084+ { /* Profile dropdown */ }
11261085 < Menu as = "div" className = "relative" >
11271086 < Menu . Button className = "z-50 flex items-center p-1.5" >
11281087 < span className = "sr-only" > Open user menu</ span >
0 commit comments