-
Notifications
You must be signed in to change notification settings - Fork 11
Feat/separate home route #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
018eead
feat: add new home page components and layout
urjitc 9360231
feat: separate home route architecture from workspace view
urjitc 14356af
refactor: remove NoWorkspaceSelected fallback from WorkspaceSection
urjitc 4ecb700
chore: add typewriter-effect dependency for animated placeholders
urjitc 47cc7d5
feat: clear typewriter placeholder on input focus
urjitc b855403
fix: add missing node argument to typewriter pasteString call
urjitc b92225e
fix: resolve typewriter bugs and cleanup issues
urjitc 29ccafc
fix: resolve TypeScript and accessibility issues
urjitc 187dae4
refactor: extract shared session handling components
urjitc 5e0e42b
refactor: extract duplicated toast handler in FeaturedWorkspaces
urjitc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,180 @@ | ||
| "use client"; | ||
|
|
||
| import { ChevronLeft, ChevronRight } from "lucide-react"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { cn } from "@/lib/utils"; | ||
| import { useCallback, useEffect, useRef, useState } from "react"; | ||
| import { toast } from "sonner"; | ||
|
|
||
| // Featured workspace templates with current topics | ||
| const FEATURED_WORKSPACES = [ | ||
| { | ||
| id: "featured-1", | ||
| name: "AI & Machine Learning", | ||
| description: "Explore GPT, LLMs, and AI trends", | ||
| color: "hsl(217, 91%, 60%)", | ||
| }, | ||
| { | ||
| id: "featured-2", | ||
| name: "Climate Science", | ||
| description: "Study climate change and solutions", | ||
| color: "hsl(142, 76%, 36%)", | ||
| }, | ||
| { | ||
| id: "featured-3", | ||
| name: "Web3 & Blockchain", | ||
| description: "Learn crypto, DeFi, and NFTs", | ||
| color: "hsl(280, 100%, 70%)", | ||
| }, | ||
| { | ||
| id: "featured-4", | ||
| name: "Quantum Computing", | ||
| description: "Understand quantum mechanics", | ||
| color: "hsl(24, 95%, 53%)", | ||
| }, | ||
| { | ||
| id: "featured-5", | ||
| name: "Space Exploration", | ||
| description: "Mars missions and astronomy", | ||
| color: "hsl(200, 100%, 50%)", | ||
| }, | ||
| { | ||
| id: "featured-6", | ||
| name: "Neuroscience", | ||
| description: "Brain science and cognition", | ||
| color: "hsl(320, 70%, 60%)", | ||
| }, | ||
| { | ||
| id: "featured-7", | ||
| name: "Sustainable Energy", | ||
| description: "Solar, wind, and green tech", | ||
| color: "hsl(120, 60%, 45%)", | ||
| }, | ||
| { | ||
| id: "featured-8", | ||
| name: "Biotechnology", | ||
| description: "CRISPR, gene therapy, and more", | ||
| color: "hsl(15, 85%, 55%)", | ||
| }, | ||
| ]; | ||
|
|
||
| export function FeaturedWorkspaces() { | ||
| const scrollRef = useRef<HTMLDivElement>(null); | ||
| const [canScrollLeft, setCanScrollLeft] = useState(false); | ||
| const [canScrollRight, setCanScrollRight] = useState(true); | ||
|
|
||
| const checkScrollability = () => { | ||
| if (!scrollRef.current) return; | ||
| const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current; | ||
| setCanScrollLeft(scrollLeft > 0); | ||
| setCanScrollRight(scrollLeft < scrollWidth - clientWidth - 10); | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| checkScrollability(); | ||
| // Check on window resize | ||
| window.addEventListener("resize", checkScrollability); | ||
| return () => window.removeEventListener("resize", checkScrollability); | ||
| }, []); | ||
|
|
||
| const scroll = (direction: "left" | "right") => { | ||
| if (!scrollRef.current) return; | ||
| const scrollAmount = scrollRef.current.clientWidth * 0.8; | ||
| scrollRef.current.scrollBy({ | ||
| left: direction === "left" ? -scrollAmount : scrollAmount, | ||
| behavior: "smooth", | ||
| }); | ||
| }; | ||
|
|
||
| const handleWorkspaceClick = useCallback((workspaceName: string) => { | ||
| toast.info("Coming soon", { | ||
| description: `Template workspace "${workspaceName}" will be available soon!`, | ||
| }); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <div className="w-full"> | ||
| <div className="flex items-center justify-between mb-4"> | ||
| <h2 className="text-lg font-normal text-muted-foreground">Featured workspaces</h2> | ||
| <div className="flex gap-2"> | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| className="h-8 w-8" | ||
| onClick={() => scroll("left")} | ||
| disabled={!canScrollLeft} | ||
| > | ||
| <ChevronLeft className="h-4 w-4" /> | ||
| </Button> | ||
| <Button | ||
| variant="ghost" | ||
| size="icon" | ||
| className="h-8 w-8" | ||
| onClick={() => scroll("right")} | ||
| disabled={!canScrollRight} | ||
| > | ||
| <ChevronRight className="h-4 w-4" /> | ||
| </Button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div | ||
| ref={scrollRef} | ||
| onScroll={checkScrollability} | ||
| className="flex gap-4 overflow-x-auto scrollbar-thin scrollbar-thumb-gray-600 scrollbar-track-transparent pb-2" | ||
| style={{ | ||
| scrollbarWidth: "thin", | ||
| overscrollBehaviorX: "contain", | ||
| overscrollBehaviorY: "auto" | ||
| }} | ||
| > | ||
| {FEATURED_WORKSPACES.map((workspace) => ( | ||
| <div | ||
| key={workspace.id} | ||
| role="button" | ||
| tabIndex={0} | ||
| onClick={() => handleWorkspaceClick(workspace.name)} | ||
| onKeyDown={(e) => { | ||
| if (e.key === "Enter" || e.key === " ") { | ||
| e.preventDefault(); | ||
| handleWorkspaceClick(workspace.name); | ||
| } | ||
| }} | ||
| className={cn( | ||
| "flex-shrink-0 w-64 px-6 py-8 rounded-md border border-sidebar-border/50 backdrop-blur-sm", | ||
| "hover:border-primary/40 hover:shadow-lg hover:shadow-primary/5", | ||
| "transition-all duration-300 cursor-pointer", | ||
| "flex flex-col items-start justify-between", | ||
| "aspect-[3.5/1]" | ||
| )} | ||
| style={{ | ||
| backgroundColor: `${workspace.color}08`, | ||
| }} | ||
| > | ||
| <div className="flex flex-col gap-4 w-full"> | ||
| <div | ||
| className="flex-shrink-0 w-12 h-12 rounded-md flex items-center justify-center" | ||
| style={{ | ||
| backgroundColor: `${workspace.color}20`, | ||
| }} | ||
| > | ||
| <div | ||
| className="w-6 h-6 rounded" | ||
| style={{ | ||
| backgroundColor: workspace.color, | ||
| }} | ||
| /> | ||
| </div> | ||
| <div className="min-w-0 w-full"> | ||
| <h3 className="font-medium text-lg text-foreground truncate w-full mb-1"> | ||
| {workspace.name} | ||
| </h3> | ||
| <p className="text-sm text-muted-foreground">{workspace.description}</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or 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 client"; | ||
|
|
||
| import { HomePromptInput } from "./HomePromptInput"; | ||
| import { FeaturedWorkspaces } from "./FeaturedWorkspaces"; | ||
| import { WorkspaceGrid } from "./WorkspaceGrid"; | ||
|
|
||
| export function HomeContent() { | ||
| return ( | ||
| <div className="flex flex-col h-full w-full overflow-hidden"> | ||
| {/* Main content area */} | ||
| <div className="flex-1 flex flex-col items-center justify-start px-6 pt-[10vh] pb-8 overflow-y-auto"> | ||
| {/* Hero Section */} | ||
| <div className="text-center mb-12 w-full"> | ||
| <h1 className="text-3xl md:text-4xl font-medium text-foreground mb-6"> | ||
| What's on your mind? | ||
| </h1> | ||
| <div className="flex justify-center"> | ||
| <HomePromptInput /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Content Sections */} | ||
| <div className="w-full max-w-6xl space-y-12"> | ||
| {/* Featured Workspaces */} | ||
| <FeaturedWorkspaces /> | ||
|
|
||
| {/* Your Workspaces */} | ||
| <WorkspaceGrid /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.