forked from matijagrcic/azurechatgpt
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from giuliohome-org/main
AzureChatGPT Mobile View
- Loading branch information
Showing
4 changed files
with
73 additions
and
22 deletions.
There are no files selected for viewing
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,16 @@ | ||
'use client' | ||
|
||
import { useState } from 'react'; | ||
|
||
import { ChatMenu } from "@/features/chat/chat-menu/chat-menu"; | ||
import { MainMenu } from "@/features/menu/menu"; | ||
|
||
export const Context = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
return ( | ||
<> | ||
<MainMenu isOpen={isOpen} setIsOpen={setIsOpen} /> | ||
<ChatMenu isOpen={isOpen} setIsOpen={setIsOpen} /> | ||
</> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,54 @@ | ||
'use client' | ||
|
||
import { useState, useEffect } from 'react'; | ||
import { Menu, MenuContent, MenuFooter, MenuHeader } from "@/components/menu"; | ||
import { FindAllChatThreadForCurrentUser } from "@/features/chat/chat-services/chat-thread-service"; | ||
import { ThemeToggle } from "@/features/theme/theme-toggle"; | ||
import { MenuItems } from "./menu-items"; | ||
import { NewChat } from "./new-chat"; | ||
import { ChatThreadModel } from '../chat-services/models'; | ||
import { Button } from '@/components/ui/button'; | ||
|
||
interface Prop { | ||
isOpen: boolean; | ||
setIsOpen: Function; | ||
} | ||
|
||
export const ChatMenu = (prop:Prop) => { | ||
const [items, setItems] = useState<ChatThreadModel[]>([]); | ||
|
||
// Fetch data when the component mounts | ||
useEffect(() => { | ||
const fetchData = async () => { | ||
const data = await FindAllChatThreadForCurrentUser(); | ||
setItems(data); | ||
}; | ||
|
||
export const ChatMenu = async () => { | ||
const items = await FindAllChatThreadForCurrentUser(); | ||
fetchData(); | ||
}, []); | ||
|
||
return ( | ||
<Menu> | ||
<MenuHeader className="justify-end"> | ||
<NewChat /> | ||
</MenuHeader> | ||
<MenuContent> | ||
<MenuItems menuItems={items} /> | ||
</MenuContent> | ||
<MenuFooter> | ||
<div className="flex flex-col gap-3"> | ||
<ThemeToggle /> | ||
</div> | ||
</MenuFooter> | ||
</Menu> | ||
<div> | ||
<Button size={"icon"} onClick={() => prop.setIsOpen(!prop.isOpen)} > | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" width="12" height="12" stroke="currentColor"> | ||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" /> | ||
</svg> | ||
</Button> | ||
{prop.isOpen ? | ||
<Menu> | ||
<MenuHeader className="justify-end"> | ||
<NewChat /> | ||
</MenuHeader> | ||
<MenuContent> | ||
<MenuItems menuItems={items} /> | ||
</MenuContent> | ||
<MenuFooter> | ||
<div className="flex flex-col gap-3"> | ||
<ThemeToggle /> | ||
</div> | ||
</MenuFooter> | ||
</Menu> | ||
: ''} | ||
</div> | ||
); | ||
}; |
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