-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🗑️ chore: Remove and reorganize bookmark-related components
- Deleted `bookmark-sidebar-content.tsx`, `bookmark-sidebar.tsx`, and `bookmarks-list.tsx` - Renamed and moved `content-reader.tsx` to `bookmarks/bookmark-content.tsx` - Updated imports in `bookmark-detail.tsx` to use new paths - Created new `bookmarks-list-page.tsx` component - Renamed and moved `bookmarks-sidebar-content.tsx` and `bookmarks-sidebar.tsx` to `bookmarks` directory - Updated `index.lazy.tsx` to import from new `bookmarks-list-page.tsx`
- Loading branch information
Showing
10 changed files
with
150 additions
and
313 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,76 @@ | ||
import BookmarkList from "@/components/bookmarks/bookmarks-list"; | ||
import { BookmarksSidebar } from "@/components/bookmarks/bookmarks-sidebar"; | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from "@/components/ui/dialog"; | ||
import { Input } from "@/components/ui/input"; | ||
import { | ||
SidebarInset, | ||
SidebarProvider, | ||
SidebarTrigger, | ||
} from "@/components/ui/sidebar"; | ||
import { useBookmarkMutations, useBookmarks } from "@/lib/apis/bookmarks"; | ||
import { PlusCircle } from "lucide-react"; | ||
import { useState } from "react"; | ||
|
||
export default function BookmarksListView() { | ||
const { data: bookmarks = [] } = useBookmarks(); | ||
const { createBookmark } = useBookmarkMutations(); | ||
const [open, setOpen] = useState(false); | ||
const [url, setUrl] = useState(""); | ||
|
||
const handleSubmit = async (e: React.FormEvent) => { | ||
e.preventDefault(); | ||
if (!url) return; | ||
await createBookmark({ url }); | ||
setUrl(""); | ||
setOpen(false); | ||
}; | ||
|
||
const AddBookmarkModal = () => { | ||
return ( | ||
<Dialog open={open} onOpenChange={setOpen}> | ||
<DialogTrigger asChild> | ||
<Button variant="ghost" size="icon" className="h-7 w-7"> | ||
<PlusCircle className="size-6" /> | ||
</Button> | ||
</DialogTrigger> | ||
<DialogContent> | ||
<DialogHeader> | ||
<DialogTitle>Add New Bookmark</DialogTitle> | ||
</DialogHeader> | ||
<form onSubmit={handleSubmit} className="space-y-4"> | ||
<Input | ||
placeholder="Enter URL" | ||
value={url} | ||
onChange={(e) => setUrl(e.target.value)} | ||
/> | ||
<Button type="submit">Add Bookmark</Button> | ||
</form> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
return ( | ||
<SidebarProvider> | ||
<BookmarksSidebar /> | ||
<SidebarInset> | ||
<div className="flex flex-col h-full"> | ||
<header className="flex h-16 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12"> | ||
<div className="flex items-center gap-1 px-4"> | ||
<SidebarTrigger className="-ml-1" /> | ||
<AddBookmarkModal /> | ||
</div> | ||
</header> | ||
<BookmarkList bookmarks={bookmarks} /> | ||
</div> | ||
</SidebarInset> | ||
</SidebarProvider> | ||
); | ||
} |
Oops, something went wrong.