-
Notifications
You must be signed in to change notification settings - Fork 415
new note button + daily note structure #1558
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
5 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { format } from "date-fns"; | ||
| import { CalendarIcon, CheckSquare, Mail, Sun } from "lucide-react"; | ||
|
|
||
| import { type Tab } from "../../../store/zustand/tabs"; | ||
| import { type TabItem, TabItemBase } from "./shared"; | ||
|
|
||
| export const TabItemDaily: TabItem = ({ tab, handleClose, handleSelect }) => { | ||
| return ( | ||
| <TabItemBase | ||
| icon={<Sun className="w-4 h-4" />} | ||
| title={tab.type === "daily" ? format(tab.date, "MMM d, yyyy") : "Daily Note"} | ||
| active={tab.active} | ||
| handleClose={() => handleClose(tab)} | ||
| handleSelect={() => handleSelect(tab)} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export function TabContentDaily({ tab }: { tab: Tab }) { | ||
| if (tab.type !== "daily") { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="h-full rounded-lg border bg-white p-6"> | ||
| <h1 className="text-2xl font-semibold mb-6">{format(tab.date, "MMM d, yyyy")}</h1> | ||
|
|
||
| <div className="grid grid-cols-2 gap-6"> | ||
| <div> | ||
| <h2 className="text-lg font-semibold mb-4">Task</h2> | ||
| <div className="space-y-2"> | ||
| {[1, 2, 3].map((i) => ( | ||
| <div key={i} className="flex items-center gap-2 p-2 hover:bg-neutral-50 rounded"> | ||
| <CheckSquare className="w-4 h-4 text-neutral-400" /> | ||
| <span className="text-sm">task {i}</span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div> | ||
| <h2 className="text-lg font-semibold mb-4">Email</h2> | ||
| <div className="space-y-2"> | ||
| {[1, 2, 3].map((i) => ( | ||
| <div key={i} className="flex items-center gap-2 p-2 hover:bg-neutral-50 rounded"> | ||
| <Mail className="w-4 h-4 text-neutral-400" /> | ||
| <span className="text-sm">email {i}</span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="col-span-2"> | ||
| <h2 className="text-lg font-semibold mb-4">Event</h2> | ||
| <div className="space-y-2"> | ||
| {[1, 2, 3].map((i) => ( | ||
| <div key={i} className="flex items-center gap-2 p-2 hover:bg-neutral-50 rounded"> | ||
| <CalendarIcon className="w-4 h-4 text-neutral-400" /> | ||
| <span className="text-sm">event {i}</span> | ||
| </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
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
34 changes: 34 additions & 0 deletions
34
apps/desktop2/src/components/main/sidebar/new-note-button.tsx
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,34 @@ | ||
| import { PencilIcon } from "lucide-react"; | ||
| import { useCallback } from "react"; | ||
|
|
||
| import { Button } from "@hypr/ui/components/ui/button"; | ||
| import { cn } from "@hypr/ui/lib/utils"; | ||
| import { useTabs } from "../../../store/zustand/tabs"; | ||
|
|
||
| export function NewNoteButton() { | ||
| const { openNew } = useTabs(); | ||
|
|
||
| const handleCreateNote = useCallback(() => { | ||
| openNew({ | ||
| type: "sessions", | ||
| id: crypto.randomUUID(), | ||
| active: true, | ||
| state: { editor: "raw" }, | ||
| }); | ||
| }, [openNew]); | ||
|
|
||
| return ( | ||
| <Button | ||
| className={cn( | ||
| "w-full", | ||
| "rounded-lg py-3", | ||
| "flex items-center justify-center gap-2", | ||
| "text-white bg-gray-900 hover:bg-gray-900/90", | ||
| )} | ||
| onClick={handleCreateNote} | ||
| > | ||
| <PencilIcon className="w-4 h-4" /> | ||
| Create new note | ||
| </Button> | ||
| ); | ||
| } |
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
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.