Skip to content

Commit e6a3380

Browse files
committed
first commit
0 parents  commit e6a3380

32 files changed

+8233
-0
lines changed

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

app/favicon.ico

25.3 KB
Binary file not shown.

app/globals.css

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
body {
6+
font-family: Arial, Helvetica, sans-serif;
7+
}
8+
9+
@layer base {
10+
:root {
11+
--background: 0 0% 100%;
12+
--foreground: 240 10% 3.9%;
13+
--card: 0 0% 100%;
14+
--card-foreground: 240 10% 3.9%;
15+
--popover: 0 0% 100%;
16+
--popover-foreground: 240 10% 3.9%;
17+
--primary: 240 5.9% 10%;
18+
--primary-foreground: 0 0% 98%;
19+
--secondary: 240 4.8% 95.9%;
20+
--secondary-foreground: 240 5.9% 10%;
21+
--muted: 240 4.8% 95.9%;
22+
--muted-foreground: 240 3.8% 46.1%;
23+
--accent: 240 4.8% 95.9%;
24+
--accent-foreground: 240 5.9% 10%;
25+
--destructive: 0 84.2% 60.2%;
26+
--destructive-foreground: 0 0% 98%;
27+
--border: 240 5.9% 90%;
28+
--input: 240 5.9% 90%;
29+
--ring: 240 10% 3.9%;
30+
--chart-1: 12 76% 61%;
31+
--chart-2: 173 58% 39%;
32+
--chart-3: 197 37% 24%;
33+
--chart-4: 43 74% 66%;
34+
--chart-5: 27 87% 67%;
35+
--radius: 0.5rem;
36+
}
37+
.dark {
38+
--background: 240 10% 3.9%;
39+
--foreground: 0 0% 98%;
40+
--card: 240 10% 3.9%;
41+
--card-foreground: 0 0% 98%;
42+
--popover: 240 10% 3.9%;
43+
--popover-foreground: 0 0% 98%;
44+
--primary: 0 0% 98%;
45+
--primary-foreground: 240 5.9% 10%;
46+
--secondary: 240 3.7% 15.9%;
47+
--secondary-foreground: 0 0% 98%;
48+
--muted: 240 3.7% 15.9%;
49+
--muted-foreground: 240 5% 64.9%;
50+
--accent: 240 3.7% 15.9%;
51+
--accent-foreground: 0 0% 98%;
52+
--destructive: 0 62.8% 30.6%;
53+
--destructive-foreground: 0 0% 98%;
54+
--border: 240 3.7% 15.9%;
55+
--input: 240 3.7% 15.9%;
56+
--ring: 240 4.9% 83.9%;
57+
--chart-1: 220 70% 50%;
58+
--chart-2: 160 60% 45%;
59+
--chart-3: 30 80% 55%;
60+
--chart-4: 280 65% 60%;
61+
--chart-5: 340 75% 55%;
62+
}
63+
}
64+
65+
@layer base {
66+
* {
67+
@apply border-border;
68+
}
69+
body {
70+
@apply bg-background text-foreground;
71+
}
72+
}

app/layout.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import "./globals.css"
2+
import { Inter } from "next/font/google"
3+
4+
const inter = Inter({ subsets: ["latin"] })
5+
6+
export const metadata = {
7+
title: "My Note App",
8+
description: "A simple note-taking app",
9+
}
10+
11+
export default function RootLayout({
12+
children,
13+
}: {
14+
children: React.ReactNode
15+
}) {
16+
return (
17+
<html lang="en">
18+
<body className={inter.className}>{children}</body>
19+
</html>
20+
)
21+
}
22+

app/page.tsx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"use client"
2+
3+
import { useState, useEffect } from "react"
4+
import { useMediaQuery } from "@/hooks/useMediaQuery"
5+
import DesktopLayout from "@/components/DesktopLayout"
6+
import MobileLayout from "@/components/MobileLayout"
7+
import type { Note } from "@/types"
8+
9+
export default function Home() {
10+
const [notes, setNotes] = useState<Note[]>([])
11+
const [selectedNote, setSelectedNote] = useState<Note | null>(null)
12+
const isDesktop = useMediaQuery("(min-width: 768px)")
13+
14+
useEffect(() => {
15+
const savedNotes = localStorage.getItem("notes")
16+
if (savedNotes) {
17+
setNotes(JSON.parse(savedNotes))
18+
}
19+
}, [])
20+
21+
useEffect(() => {
22+
localStorage.setItem("notes", JSON.stringify(notes))
23+
}, [notes])
24+
25+
const addNote = () => {
26+
const newNote: Note = {
27+
id: Date.now(),
28+
title: "New Note",
29+
content: "",
30+
tags: [],
31+
}
32+
setNotes([...notes, newNote])
33+
setSelectedNote(newNote)
34+
}
35+
36+
const updateNote = (updatedNote: Note) => {
37+
const updatedNotes = notes.map((note) => (note.id === updatedNote.id ? updatedNote : note))
38+
setNotes(updatedNotes)
39+
setSelectedNote(updatedNote)
40+
}
41+
42+
const deleteNote = (id: number) => {
43+
const updatedNotes = notes.filter((note) => note.id !== id)
44+
setNotes(updatedNotes)
45+
setSelectedNote(null)
46+
}
47+
48+
return isDesktop ? (
49+
<DesktopLayout
50+
notes={notes}
51+
selectedNote={selectedNote}
52+
setSelectedNote={setSelectedNote}
53+
addNote={addNote}
54+
updateNote={updateNote}
55+
deleteNote={deleteNote}
56+
/>
57+
) : (
58+
<MobileLayout
59+
notes={notes}
60+
selectedNote={selectedNote}
61+
setSelectedNote={setSelectedNote}
62+
addNote={addNote}
63+
updateNote={updateNote}
64+
deleteNote={deleteNote}
65+
/>
66+
)
67+
}
68+

components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "app/globals.css",
9+
"baseColor": "zinc",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

components/DesktopLayout.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Note } from "@/types"
2+
import NoteList from "./NoteList"
3+
import NoteEditor from "./NoteEditor"
4+
5+
interface DesktopLayoutProps {
6+
notes: Note[]
7+
selectedNote: Note | null
8+
setSelectedNote: (note: Note | null) => void
9+
addNote: () => void
10+
updateNote: (note: Note) => void
11+
deleteNote: (id: number) => void
12+
}
13+
14+
export default function DesktopLayout({
15+
notes,
16+
selectedNote,
17+
setSelectedNote,
18+
addNote,
19+
updateNote,
20+
deleteNote,
21+
}: DesktopLayoutProps) {
22+
return (
23+
<div className="flex h-screen bg-white">
24+
<div className="w-64 border-r">
25+
<NoteList
26+
notes={notes}
27+
selectedNote={selectedNote}
28+
setSelectedNote={setSelectedNote}
29+
addNote={addNote}
30+
deleteNote={deleteNote}
31+
/>
32+
</div>
33+
<div className="flex-1">
34+
{selectedNote ? (
35+
<NoteEditor note={selectedNote} updateNote={updateNote} />
36+
) : (
37+
<div className="h-full flex items-center justify-center text-gray-400">Select a note or create a new one</div>
38+
)}
39+
</div>
40+
</div>
41+
)
42+
}
43+

components/FileUpload.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"use client"
2+
3+
import { useState } from "react"
4+
import { uploadFile } from "../utils/blobStorageService"
5+
import { Button } from "./ui/button"
6+
7+
export default function FileUpload({ userId }: { userId: string | null }) {
8+
const [file, setFile] = useState<File | null>(null)
9+
10+
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
11+
if (e.target.files) {
12+
setFile(e.target.files[0])
13+
}
14+
}
15+
16+
const handleUpload = async () => {
17+
if (file) {
18+
const url = await uploadFile(userId, file)
19+
console.log("File uploaded:", url)
20+
// Here you can add the file URL to your note content
21+
}
22+
}
23+
24+
return (
25+
<div className="mt-4">
26+
<input type="file" onChange={handleFileChange} className="mb-2" />
27+
<Button onClick={handleUpload} disabled={!file}>
28+
Upload File
29+
</Button>
30+
</div>
31+
)
32+
}
33+

components/MobileLayout.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { Note } from "@/types"
2+
import NoteList from "./NoteList"
3+
import NoteEditor from "./NoteEditor"
4+
5+
interface MobileLayoutProps {
6+
notes: Note[]
7+
selectedNote: Note | null
8+
setSelectedNote: (note: Note | null) => void
9+
addNote: () => void
10+
updateNote: (note: Note) => void
11+
deleteNote: (id: number) => void
12+
}
13+
14+
export default function MobileLayout({
15+
notes,
16+
selectedNote,
17+
setSelectedNote,
18+
addNote,
19+
updateNote,
20+
deleteNote,
21+
}: MobileLayoutProps) {
22+
return (
23+
<div className="h-screen bg-white">
24+
{selectedNote ? (
25+
<NoteEditor note={selectedNote} updateNote={updateNote} onBack={() => setSelectedNote(null)} />
26+
) : (
27+
<NoteList
28+
notes={notes}
29+
selectedNote={selectedNote}
30+
setSelectedNote={setSelectedNote}
31+
addNote={addNote}
32+
deleteNote={deleteNote}
33+
/>
34+
)}
35+
</div>
36+
)
37+
}
38+

0 commit comments

Comments
 (0)