mirror of
https://github.com/dergigi/boris.git
synced 2025-12-19 07:34:28 +01:00
fix: pass relayPool as prop instead of using non-existent hook
- Fixed crash when opening bookmark bar - Removed non-existent Hooks.useRelayPool() call - Added relayPool prop to SidebarHeader, BookmarkList, and ThreePaneLayout - Threaded relayPool through component hierarchy from Bookmarks down - Web bookmark creation now works correctly
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
import { faChevronLeft, faBookmark, faSpinner, faList, faThLarge, faImage } from '@fortawesome/free-solid-svg-icons'
|
import { faChevronLeft, faBookmark, faSpinner, faList, faThLarge, faImage } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
import { RelayPool } from 'applesauce-relay'
|
||||||
import { Bookmark, IndividualBookmark } from '../types/bookmarks'
|
import { Bookmark, IndividualBookmark } from '../types/bookmarks'
|
||||||
import { BookmarkItem } from './BookmarkItem'
|
import { BookmarkItem } from './BookmarkItem'
|
||||||
import SidebarHeader from './SidebarHeader'
|
import SidebarHeader from './SidebarHeader'
|
||||||
@@ -21,6 +22,7 @@ interface BookmarkListProps {
|
|||||||
onRefresh?: () => void
|
onRefresh?: () => void
|
||||||
isRefreshing?: boolean
|
isRefreshing?: boolean
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
|
relayPool: RelayPool | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BookmarkList: React.FC<BookmarkListProps> = ({
|
export const BookmarkList: React.FC<BookmarkListProps> = ({
|
||||||
@@ -35,7 +37,8 @@ export const BookmarkList: React.FC<BookmarkListProps> = ({
|
|||||||
onOpenSettings,
|
onOpenSettings,
|
||||||
onRefresh,
|
onRefresh,
|
||||||
isRefreshing,
|
isRefreshing,
|
||||||
loading = false
|
loading = false,
|
||||||
|
relayPool
|
||||||
}) => {
|
}) => {
|
||||||
// Helper to check if a bookmark has either content or a URL
|
// Helper to check if a bookmark has either content or a URL
|
||||||
const hasContentOrUrl = (ib: IndividualBookmark) => {
|
const hasContentOrUrl = (ib: IndividualBookmark) => {
|
||||||
@@ -98,6 +101,7 @@ export const BookmarkList: React.FC<BookmarkListProps> = ({
|
|||||||
onOpenSettings={onOpenSettings}
|
onOpenSettings={onOpenSettings}
|
||||||
onRefresh={onRefresh}
|
onRefresh={onRefresh}
|
||||||
isRefreshing={isRefreshing}
|
isRefreshing={isRefreshing}
|
||||||
|
relayPool={relayPool}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ const Bookmarks: React.FC<BookmarksProps> = ({ relayPool, onLogout }) => {
|
|||||||
setIsHighlightsCollapsed(true)
|
setIsHighlightsCollapsed(true)
|
||||||
}}
|
}}
|
||||||
onRefresh={handleRefreshAll}
|
onRefresh={handleRefreshAll}
|
||||||
|
relayPool={relayPool}
|
||||||
readerLoading={readerLoading}
|
readerLoading={readerLoading}
|
||||||
readerContent={readerContent}
|
readerContent={readerContent}
|
||||||
selectedUrl={selectedUrl}
|
selectedUrl={selectedUrl}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Hooks } from 'applesauce-react'
|
|||||||
import { useEventModel } from 'applesauce-react/hooks'
|
import { useEventModel } from 'applesauce-react/hooks'
|
||||||
import { Models } from 'applesauce-core'
|
import { Models } from 'applesauce-core'
|
||||||
import { Accounts } from 'applesauce-accounts'
|
import { Accounts } from 'applesauce-accounts'
|
||||||
|
import { RelayPool } from 'applesauce-relay'
|
||||||
import IconButton from './IconButton'
|
import IconButton from './IconButton'
|
||||||
import AddBookmarkModal from './AddBookmarkModal'
|
import AddBookmarkModal from './AddBookmarkModal'
|
||||||
import { createWebBookmark } from '../services/webBookmarkService'
|
import { createWebBookmark } from '../services/webBookmarkService'
|
||||||
@@ -17,15 +18,15 @@ interface SidebarHeaderProps {
|
|||||||
onOpenSettings: () => void
|
onOpenSettings: () => void
|
||||||
onRefresh?: () => void
|
onRefresh?: () => void
|
||||||
isRefreshing?: boolean
|
isRefreshing?: boolean
|
||||||
|
relayPool: RelayPool | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const SidebarHeader: React.FC<SidebarHeaderProps> = ({ onToggleCollapse, onLogout, onOpenSettings, onRefresh, isRefreshing }) => {
|
const SidebarHeader: React.FC<SidebarHeaderProps> = ({ onToggleCollapse, onLogout, onOpenSettings, onRefresh, isRefreshing, relayPool }) => {
|
||||||
const [isConnecting, setIsConnecting] = useState(false)
|
const [isConnecting, setIsConnecting] = useState(false)
|
||||||
const [showAddModal, setShowAddModal] = useState(false)
|
const [showAddModal, setShowAddModal] = useState(false)
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const activeAccount = Hooks.useActiveAccount()
|
const activeAccount = Hooks.useActiveAccount()
|
||||||
const accountManager = Hooks.useAccountManager()
|
const accountManager = Hooks.useAccountManager()
|
||||||
const relayPool = Hooks.useRelayPool()
|
|
||||||
const profile = useEventModel(Models.ProfileModel, activeAccount ? [activeAccount.pubkey] : null)
|
const profile = useEventModel(Models.ProfileModel, activeAccount ? [activeAccount.pubkey] : null)
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { RelayPool } from 'applesauce-relay'
|
||||||
import { BookmarkList } from './BookmarkList'
|
import { BookmarkList } from './BookmarkList'
|
||||||
import ContentPanel from './ContentPanel'
|
import ContentPanel from './ContentPanel'
|
||||||
import { HighlightsPanel } from './HighlightsPanel'
|
import { HighlightsPanel } from './HighlightsPanel'
|
||||||
@@ -30,6 +31,7 @@ interface ThreePaneLayoutProps {
|
|||||||
onViewModeChange: (mode: ViewMode) => void
|
onViewModeChange: (mode: ViewMode) => void
|
||||||
onOpenSettings: () => void
|
onOpenSettings: () => void
|
||||||
onRefresh: () => void
|
onRefresh: () => void
|
||||||
|
relayPool: RelayPool | null
|
||||||
|
|
||||||
// Content pane
|
// Content pane
|
||||||
readerLoading: boolean
|
readerLoading: boolean
|
||||||
@@ -86,6 +88,7 @@ const ThreePaneLayout: React.FC<ThreePaneLayoutProps> = (props) => {
|
|||||||
onRefresh={props.onRefresh}
|
onRefresh={props.onRefresh}
|
||||||
isRefreshing={props.isRefreshing}
|
isRefreshing={props.isRefreshing}
|
||||||
loading={props.bookmarksLoading}
|
loading={props.bookmarksLoading}
|
||||||
|
relayPool={props.relayPool}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="pane main">
|
<div className="pane main">
|
||||||
|
|||||||
Reference in New Issue
Block a user