diff --git a/.cursor/rules/210.mdc b/.cursor/rules/210.mdc
new file mode 100644
index 00000000..b8bbebc4
--- /dev/null
+++ b/.cursor/rules/210.mdc
@@ -0,0 +1,5 @@
+---
+alwaysApply: true
+---
+
+Keep files below 210 lines.
\ No newline at end of file
diff --git a/.cursor/rules/always-commit.mdc b/.cursor/rules/always-commit.mdc
new file mode 100644
index 00000000..3662e8ad
--- /dev/null
+++ b/.cursor/rules/always-commit.mdc
@@ -0,0 +1,5 @@
+---
+alwaysApply: true
+---
+
+Commit all pending changes. Commit using conventional commits. Always commit after each implementation step or change.
diff --git a/.cursor/rules/dry.mdc b/.cursor/rules/dry.mdc
new file mode 100644
index 00000000..8251ef43
--- /dev/null
+++ b/.cursor/rules/dry.mdc
@@ -0,0 +1,5 @@
+---
+alwaysApply: true
+---
+
+Keep things simple. Strive to keep code DRY.
diff --git a/dist/index.html b/dist/index.html
index c96e1c24..35e5dd00 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -5,7 +5,7 @@
Markr - Nostr Bookmarks
-
+
diff --git a/src/App.tsx b/src/App.tsx
index 80898fdb..6f0299b5 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -8,6 +8,7 @@ function App() {
const [eventStore, setEventStore] = useState(null)
const [isAuthenticated, setIsAuthenticated] = useState(false)
const [userPublicKey, setUserPublicKey] = useState(null)
+ const [userProfile, setUserProfile] = useState<{name?: string, username?: string, nip05?: string} | null>(null)
useEffect(() => {
// Initialize event store
@@ -28,16 +29,19 @@ function App() {
{!isAuthenticated ? (
- {
+ {
setIsAuthenticated(true)
setUserPublicKey(publicKey)
+ setUserProfile(profile)
}} />
) : (
{
setIsAuthenticated(false)
setUserPublicKey(null)
+ setUserProfile(null)
}}
/>
)}
diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx
index 9098f48a..0f00788e 100644
--- a/src/components/Bookmarks.tsx
+++ b/src/components/Bookmarks.tsx
@@ -11,12 +11,19 @@ interface Bookmark {
tags: string[][]
}
+interface UserProfile {
+ name?: string
+ username?: string
+ nip05?: string
+}
+
interface BookmarksProps {
userPublicKey: string | null
+ userProfile: UserProfile | null
onLogout: () => void
}
-const Bookmarks: React.FC = ({ userPublicKey, onLogout }) => {
+const Bookmarks: React.FC = ({ userPublicKey, userProfile, onLogout }) => {
const [bookmarks, setBookmarks] = useState([])
const [loading, setLoading] = useState(true)
const eventStore = useContext(EventStoreContext)
@@ -104,8 +111,23 @@ const Bookmarks: React.FC = ({ userPublicKey, onLogout }) => {
return new Date(timestamp * 1000).toLocaleDateString()
}
- const formatPublicKey = (publicKey: string) => {
- return `${publicKey.slice(0, 8)}...${publicKey.slice(-8)}`
+ const formatUserDisplay = (profile: UserProfile | null, publicKey: string | null) => {
+ if (!profile || (!profile.name && !profile.username && !profile.nip05)) {
+ return publicKey ? `${publicKey.slice(0, 8)}...${publicKey.slice(-8)}` : 'Unknown User'
+ }
+
+ // Priority: NIP-05 > name > username
+ if (profile.nip05) {
+ return profile.nip05
+ }
+ if (profile.name) {
+ return profile.name
+ }
+ if (profile.username) {
+ return `@${profile.username}`
+ }
+
+ return publicKey ? `${publicKey.slice(0, 8)}...${publicKey.slice(-8)}` : 'Unknown User'
}
if (loading) {
@@ -115,7 +137,7 @@ const Bookmarks: React.FC = ({ userPublicKey, onLogout }) => {
Your Bookmarks
{userPublicKey && (
-
Logged in as: {formatPublicKey(userPublicKey)}
+
Logged in as: {formatUserDisplay(userProfile, userPublicKey)}
)}