-
Notifications
You must be signed in to change notification settings - Fork 225
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 #97 from midday-ai/feature/inbox-v1
[Draft] Inbox v1
- Loading branch information
Showing
95 changed files
with
3,409 additions
and
2,137 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 |
---|---|---|
|
@@ -51,4 +51,8 @@ packages/email/public | |
|
||
# Storybook | ||
storybook-static | ||
tailwind.css | ||
tailwind.css | ||
|
||
# Supabase | ||
.branches | ||
.temp |
File renamed without changes.
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 +1 @@ | ||
## Dashboard | ||
## Dashboard |
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,18 @@ | ||
"use server"; | ||
|
||
import { action } from "@/actions/safe-action"; | ||
import { inboxOrder } from "@/actions/schema"; | ||
import { Cookies } from "@/utils/constants"; | ||
import { revalidatePath } from "next/cache"; | ||
import { cookies } from "next/headers"; | ||
|
||
export const inboxOrderAction = action(inboxOrder, async (ascending) => { | ||
cookies().set({ | ||
name: Cookies.InboxOrder, | ||
value: ascending.toString(), | ||
}); | ||
|
||
revalidatePath("/inbox"); | ||
|
||
return ascending; | ||
}); |
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,33 @@ | ||
"use server"; | ||
|
||
import { getUser } from "@midday/supabase/cached-queries"; | ||
import { action } from "./safe-action"; | ||
import { searchSchema } from "./schema"; | ||
|
||
export const searchAction = action(searchSchema, async (params) => { | ||
const user = await getUser(); | ||
|
||
const { query, type, limit = 10, threshold } = params; | ||
|
||
const res = await fetch( | ||
`${process.env.NEXT_PUBLIC_SUPABASE_URL}/functions/v1/search`, | ||
{ | ||
cache: "no-store", | ||
method: "POST", | ||
headers: { | ||
authorization: `Bearer ${process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY}`, | ||
}, | ||
body: JSON.stringify({ | ||
type, | ||
limit, | ||
threshold, | ||
search: query, | ||
team_id: user?.data?.team_id, | ||
}), | ||
} | ||
); | ||
|
||
const { data } = await res.json(); | ||
|
||
return data; | ||
}); |
21 changes: 13 additions & 8 deletions
21
apps/dashboard/src/app/[locale]/(app)/@dashboard/(root)/inbox/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,18 +1,23 @@ | ||
import { Inbox } from "@/components/inbox"; | ||
import { InboxViewSkeleton } from "@/components/inbox-view"; | ||
import { Metadata } from "next"; | ||
import { InboxViewSkeleton } from "@/components/inbox-skeleton"; | ||
import { Cookies } from "@/utils/constants"; | ||
import type { Metadata } from "next"; | ||
import { cookies } from "next/headers"; | ||
import { Suspense } from "react"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Inbox | Midday", | ||
}; | ||
|
||
export default function InboxPage({ searchParams }) { | ||
export default async function InboxPage({ searchParams }) { | ||
const ascending = | ||
cookies().get(Cookies.InboxOrder)?.value === "true" ?? false; | ||
|
||
return ( | ||
<div className="flex-col flex"> | ||
<Suspense fallback={<InboxViewSkeleton />}> | ||
<Inbox selectedId={searchParams?.id} /> | ||
</Suspense> | ||
</div> | ||
<Suspense | ||
fallback={<InboxViewSkeleton key={ascending.toString()} ascending />} | ||
> | ||
<Inbox ascending={ascending} query={searchParams?.q} /> | ||
</Suspense> | ||
); | ||
} |
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.