-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
167 additions
and
211 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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"use client"; | ||
|
||
import { Icons } from "@midday/ui/icons"; | ||
import { Input } from "@midday/ui/input"; | ||
import { motion } from "framer-motion"; | ||
import { useState } from "react"; | ||
|
||
type Props = { | ||
value: string; | ||
}; | ||
|
||
export function CopyInput({ value }: Props) { | ||
const [isCopied, setCopied] = useState(false); | ||
|
||
const handleClipboard = async () => { | ||
try { | ||
setCopied(true); | ||
|
||
await navigator.clipboard.writeText(value); | ||
|
||
setTimeout(() => { | ||
setCopied(false); | ||
}, 2000); | ||
} catch {} | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center relative"> | ||
<Input value="inbox.23rwef@midday.ai" className="pr-10 text-[#878787]" /> | ||
<button type="button" onClick={handleClipboard}> | ||
<motion.div | ||
className="absolute right-4 top-2.5" | ||
initial={{ opacity: 1, scale: 1 }} | ||
animate={{ opacity: isCopied ? 0 : 1, scale: isCopied ? 0 : 1 }} | ||
> | ||
<Icons.Copy /> | ||
</motion.div> | ||
|
||
<motion.div | ||
className="absolute right-4 top-2.5" | ||
initial={{ opacity: 0, scale: 0 }} | ||
animate={{ opacity: isCopied ? 1 : 0, scale: isCopied ? 1 : 0 }} | ||
> | ||
<Icons.Check /> | ||
</motion.div> | ||
</button> | ||
</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
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,52 @@ | ||
"use client"; | ||
|
||
import { InboxDetails } from "@/components/inbox-details"; | ||
import { InboxList } from "@/components/inbox-list"; | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@midday/ui/tabs"; | ||
import { TooltipProvider } from "@midday/ui/tooltip"; | ||
import { useSearchParams } from "next/navigation"; | ||
import { CopyInput } from "./copy-input"; | ||
|
||
export function InboxView({ items }) { | ||
const searchParams = useSearchParams(); | ||
const selectedId = searchParams.has("id") | ||
? searchParams.get("id") | ||
: items.at(0).id; | ||
|
||
const selectedItems = items.find((item) => item.id === selectedId); | ||
|
||
return ( | ||
<TooltipProvider delayDuration={0}> | ||
<Tabs defaultValue="all"> | ||
<div className="flex items-center justify-between py-2 mb-4 mt-2"> | ||
<TabsList className="p-0 h-auto space-x-4 bg-transparent"> | ||
<TabsTrigger className="p-0" value="all"> | ||
All | ||
</TabsTrigger> | ||
<TabsTrigger className="p-0" value="completed"> | ||
Completed | ||
</TabsTrigger> | ||
</TabsList> | ||
|
||
<CopyInput value="inbox.23rwef@midday.ai" /> | ||
</div> | ||
|
||
<div className="flex flex-row space-x-8"> | ||
<div className="w-full"> | ||
<TabsContent value="all" className="m-0"> | ||
<InboxList items={items} selectedId={selectedId} /> | ||
</TabsContent> | ||
<TabsContent value="completed" className="m-0"> | ||
<InboxList | ||
items={items.filter((item) => item.status === "completed")} | ||
selectedId={selectedId} | ||
/> | ||
</TabsContent> | ||
</div> | ||
|
||
<InboxDetails mail={selectedItems} /> | ||
</div> | ||
</Tabs> | ||
</TooltipProvider> | ||
); | ||
} |
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,53 +1,8 @@ | ||
"use client"; | ||
import { getInbox } from "@midday/supabase/cached-queries"; | ||
import { InboxView } from "./inbox-view"; | ||
|
||
import { InboxDetails } from "@/components/inbox-details"; | ||
import { InboxList } from "@/components/inbox-list"; | ||
import { Icons } from "@midday/ui/icons"; | ||
import { Input } from "@midday/ui/input"; | ||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@midday/ui/tabs"; | ||
import { TooltipProvider } from "@midday/ui/tooltip"; | ||
import { useSearchParams } from "next/navigation"; | ||
export async function Inbox() { | ||
const inbox = await getInbox(); | ||
|
||
export function Inbox({ mails }) { | ||
const searchParams = useSearchParams(); | ||
const selectedId = searchParams.get("id"); | ||
const selectedMail = mails.find((mail) => mail.id === selectedId); | ||
|
||
return ( | ||
<TooltipProvider delayDuration={0}> | ||
<Tabs defaultValue="all"> | ||
<div className="flex items-center justify-between py-2 mb-4 mt-2"> | ||
<TabsList className="p-0 h-auto space-x-4 bg-transparent"> | ||
<TabsTrigger className="p-0" value="all"> | ||
All | ||
</TabsTrigger> | ||
<TabsTrigger className="p-0" value="completed"> | ||
Completed | ||
</TabsTrigger> | ||
</TabsList> | ||
|
||
<div className="flex items-center relative"> | ||
<Input | ||
value="inbox.23rwef@midday.ai" | ||
className="pr-10 text-[#878787]" | ||
/> | ||
<Icons.Copy className="absolute right-4" /> | ||
</div> | ||
</div> | ||
|
||
<div className="flex flex-row space-x-8"> | ||
<div> | ||
<TabsContent value="all" className="m-0"> | ||
<InboxList items={mails} /> | ||
</TabsContent> | ||
<TabsContent value="completed" className="m-0"> | ||
<InboxList items={mails.filter((item) => !item.read)} /> | ||
</TabsContent> | ||
</div> | ||
|
||
<InboxDetails mail={selectedMail} /> | ||
</div> | ||
</Tabs> | ||
</TooltipProvider> | ||
); | ||
return <InboxView items={inbox?.data} />; | ||
} |
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
Oops, something went wrong.