-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: ssr search * chore: ssr search * chore: ssr search * chore: 404 page * chore: ssr search * chore: correct rabbit ai feedback
- Loading branch information
1 parent
1bd8b07
commit 39d6372
Showing
30 changed files
with
280 additions
and
319 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
import { ThreadList } from '@/components/shared/thread-list' | ||
import { CategoryTabs } from '@/components/shared/category-tabs/category-tabs' | ||
import { BrowseInput } from '@/components/shared/browse-input' | ||
import { SearchInput } from '@/components/shared/search-input' | ||
import { getBrowseThreads, getCategories } from '@/services/hasura' | ||
import { toSlug } from '@repo/mb-lib' | ||
import { decodeQuery } from '@/lib/url' | ||
|
||
export const revalidate = 3600 // revalidate the data at most every hour | ||
// TODO: dicuss caching | ||
// export const revalidate = 3600 // revalidate the data at most every hour | ||
|
||
export default async function BrowseCategoryPage({ | ||
params | ||
}: { | ||
params: { category: string } | ||
}) { | ||
export default async function CategoryPage({ | ||
params, | ||
searchParams | ||
}: CategoryPageProps) { | ||
const categories = await getCategories() | ||
const categoryId = categories.find( | ||
c => | ||
c.name.toLowerCase().replace(/\s+/g, '_').replace(/\&/g, '_') === | ||
params.category | ||
).categoryId | ||
if (!categoryId) throw new Error('Category id not foud') | ||
c => toSlug(c.name) === params.category | ||
)?.categoryId | ||
if (!categoryId) throw new Error('Category not foud') | ||
|
||
const query = searchParams.query ? decodeQuery(searchParams.query) : null | ||
|
||
const threads = await getBrowseThreads({ | ||
limit: 20, | ||
categoryId | ||
categoryId, | ||
query | ||
}) | ||
|
||
return ( | ||
<div className="container"> | ||
<CategoryTabs categories={categories} initialCategory={params.category} /> | ||
<BrowseInput /> | ||
<ThreadList initialThreads={threads} filter={{ categoryId }} /> | ||
<SearchInput /> | ||
<ThreadList initialThreads={threads} filter={{ categoryId, query }} /> | ||
</div> | ||
) | ||
} | ||
|
||
interface CategoryPageProps { | ||
params: { category: string } | ||
searchParams?: { query: string } | ||
} |
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,18 +1,37 @@ | ||
import { ThreadList } from '@/components/shared/thread-list' | ||
import { CategoryTabs } from '@/components/shared/category-tabs/category-tabs' | ||
import { BrowseInput } from '@/components/shared/browse-input' | ||
import { SearchInput } from '@/components/shared/search-input' | ||
import { getBrowseThreads, getCategories } from '@/services/hasura' | ||
import { Card } from '@/components/ui/card' | ||
import { decodeQuery } from '@/lib/url' | ||
|
||
export default async function BrowsePage() { | ||
export default async function HomePage({ searchParams }: HomePageProps) { | ||
const categories = await getCategories() | ||
const query = searchParams.query ? decodeQuery(searchParams.query) : null | ||
const threads = await getBrowseThreads({ | ||
limit: 20 | ||
limit: 20, | ||
query | ||
}) | ||
|
||
return ( | ||
<div className="container"> | ||
<CategoryTabs categories={categories} /> | ||
<BrowseInput /> | ||
<ThreadList initialThreads={threads} filter={{}} /> | ||
<SearchInput /> | ||
|
||
{threads?.length ? ( | ||
<ThreadList | ||
initialThreads={threads} | ||
filter={{ | ||
query | ||
}} | ||
/> | ||
) : ( | ||
<Card>no results</Card> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
interface HomePageProps { | ||
searchParams?: { query: string } | ||
} |
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,5 @@ | ||
export default async function NotFoudPage() { | ||
return ( | ||
<div className="max-w-[1024px] pb-10 mx-auto w-full mt-10">NOT Found</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
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,23 +1,20 @@ | ||
import { ResponsiveSidebar } from '@/components/routes/c/sidebar/sidebar-responsive' | ||
import FooterCT from '@/components/layout/footer-ct' | ||
import { BrowseProvider } from '@/hooks/use-browse' | ||
|
||
interface ChatLayoutProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export default async function ChatLayout({ children }: ChatLayoutProps) { | ||
return ( | ||
<BrowseProvider> | ||
<main className="relative flex flex-row h-[calc(100vh_-_theme(spacing.16))] overflow-hidden"> | ||
<ResponsiveSidebar /> | ||
<div className="mx-5 flex grow w-full"> | ||
{children} | ||
<div className="block lg:hidden"> | ||
<FooterCT /> | ||
</div> | ||
<main className="relative flex flex-row h-[calc(100vh_-_theme(spacing.16))] overflow-hidden"> | ||
<ResponsiveSidebar /> | ||
<div className="mx-5 flex grow w-full"> | ||
{children} | ||
<div className="block lg:hidden"> | ||
<FooterCT /> | ||
</div> | ||
</main> | ||
</BrowseProvider> | ||
</div> | ||
</main> | ||
) | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
apps/masterbots.ai/components/routes/c/sidebar/sidebar-items.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
Oops, something went wrong.