diff --git a/components/ProfileSeriesBlock.tsx b/components/ProfileSeriesBlock.tsx index 52aa399..194d3df 100644 --- a/components/ProfileSeriesBlock.tsx +++ b/components/ProfileSeriesBlock.tsx @@ -1,5 +1,9 @@ +import { useState } from 'react' import Link from 'next/link' import { SeriesSection } from './SeriesSection' +import { CreateSeriesModal } from './CreateSeriesModal' +import { useNostrAuth } from '@/hooks/useNostrAuth' +import { t } from '@/lib/i18n' interface ProfileSeriesBlockProps { currentPubkey: string @@ -8,12 +12,22 @@ interface ProfileSeriesBlockProps { } export function ProfileSeriesBlock({ currentPubkey, onSelectSeries, selectedSeriesId }: ProfileSeriesBlockProps): React.ReactElement { + const { pubkey, isUnlocked } = useNostrAuth() + const [showCreateModal, setShowCreateModal] = useState(false) + const [refreshKey, setRefreshKey] = useState(0) + const isAuthor = pubkey === currentPubkey && isUnlocked + + const handleSeriesCreated = (): void => { + setRefreshKey((prev) => prev + 1) + } + return (
Chargement des séries...
@@ -83,7 +84,7 @@ function SeriesAggregatesList({ ) } -function useSeriesData(authorPubkey: string): [ +function useSeriesData(authorPubkey: string, refreshKey?: number | undefined): [ { series: Series[] loading: boolean @@ -113,7 +114,7 @@ function useSeriesData(authorPubkey: string): [ useEffect(() => { void load() - }, [load]) + }, [load, refreshKey]) return [{ series, loading, error, aggregates }, load] }