**Motivations:** - Keep dependencies up to date for security and features - Automate dependency updates in deployment script - Fix compatibility issues with major version updates (React 19, Next.js 16, nostr-tools 2.x) **Root causes:** - Dependencies were outdated - Deployment script did not update dependencies before deploying - Major version updates introduced breaking API changes **Correctifs:** - Updated all dependencies to latest versions using npm-check-updates - Modified deploy.sh to run npm-check-updates before installing dependencies - Fixed nostr-tools 2.x API changes (generatePrivateKey -> generateSecretKey, signEvent -> finalizeEvent, verifySignature -> verifyEvent) - Fixed React 19 ref types to accept null - Fixed JSX namespace issues (JSX.Element -> React.ReactElement) - Added proper types for event callbacks - Fixed SimplePool.sub typing issues with type assertions **Evolutions:** - Deployment script now automatically updates dependencies to latest versions before deploying - All dependencies updated to latest versions (Next.js 14->16, React 18->19, nostr-tools 1->2, etc.) **Pages affectées:** - package.json - deploy.sh - lib/keyManagement.ts - lib/nostr.ts - lib/nostrRemoteSigner.ts - lib/zapVerification.ts - lib/platformTrackingEvents.ts - lib/sponsoringTracking.ts - lib/articlePublisherHelpersVerification.ts - lib/contentDeliveryVerification.ts - lib/paymentPollingZapReceipt.ts - lib/nostrPrivateMessages.ts - lib/nostrSubscription.ts - lib/nostrZapVerification.ts - lib/markdownRenderer.tsx - components/AuthorFilter.tsx - components/AuthorFilterButton.tsx - components/UserArticlesList.tsx - types/nostr-tools-extended.ts
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { NostrProfile } from '@/types/nostr'
|
|
import { UserProfileHeader } from './UserProfileHeader'
|
|
|
|
interface UserProfileProps {
|
|
profile: NostrProfile
|
|
pubkey: string
|
|
articleCount?: number
|
|
}
|
|
|
|
function ProfileStats({ articleCount }: { articleCount: number }) {
|
|
return (
|
|
<div className="text-center">
|
|
<div className="text-3xl font-bold text-gray-900">{articleCount}</div>
|
|
<div className="text-sm text-gray-500">Article{articleCount !== 1 ? 's' : ''}</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export function UserProfile({ profile, pubkey, articleCount }: UserProfileProps) {
|
|
const displayName = profile.name ?? `${pubkey.slice(0, 16)}...`
|
|
|
|
return (
|
|
<div className="bg-white border border-gray-200 rounded-lg p-6 mb-6">
|
|
<UserProfileHeader
|
|
displayName={displayName}
|
|
{...(profile.picture ? { picture: profile.picture } : {})}
|
|
{...(profile.nip05 ? { nip05: profile.nip05 } : {})}
|
|
/>
|
|
{profile.about && <p className="text-gray-700 mt-2">{profile.about}</p>}
|
|
{articleCount !== undefined && <ProfileStats articleCount={articleCount} />}
|
|
</div>
|
|
)
|
|
}
|