mirror of
https://github.com/dergigi/boris.git
synced 2026-02-16 12:34:41 +01:00
- Remove unused lastFetchTime parameter from BookmarkList - Remove unused loading and onRefresh parameters from HighlightsPanelHeader - Update HighlightsPanel to not pass removed props - All linting and type checking now passing
111 lines
4.0 KiB
TypeScript
111 lines
4.0 KiB
TypeScript
import React from 'react'
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
import { faChevronRight, faEye, faEyeSlash, faUser, faUserGroup, faNetworkWired } from '@fortawesome/free-solid-svg-icons'
|
|
import { HighlightVisibility } from '../HighlightsPanel'
|
|
import IconButton from '../IconButton'
|
|
|
|
interface HighlightsPanelHeaderProps {
|
|
hasHighlights: boolean
|
|
showHighlights: boolean
|
|
highlightVisibility: HighlightVisibility
|
|
currentUserPubkey?: string
|
|
onToggleHighlights: () => void
|
|
onToggleCollapse: () => void
|
|
onHighlightVisibilityChange?: (visibility: HighlightVisibility) => void
|
|
isMobile?: boolean
|
|
}
|
|
|
|
const HighlightsPanelHeader: React.FC<HighlightsPanelHeaderProps> = ({
|
|
hasHighlights,
|
|
showHighlights,
|
|
highlightVisibility,
|
|
currentUserPubkey,
|
|
onToggleHighlights,
|
|
onToggleCollapse,
|
|
onHighlightVisibilityChange,
|
|
isMobile = false
|
|
}) => {
|
|
return (
|
|
<div className="highlights-header">
|
|
<div className="highlights-actions">
|
|
<div className="highlights-actions-left">
|
|
{!isMobile && (
|
|
<button
|
|
onClick={onToggleCollapse}
|
|
className="toggle-highlights-btn"
|
|
title="Collapse highlights panel"
|
|
aria-label="Collapse highlights panel"
|
|
>
|
|
<FontAwesomeIcon icon={faChevronRight} style={{ transform: 'rotate(180deg)' }} />
|
|
</button>
|
|
)}
|
|
{onHighlightVisibilityChange && (
|
|
<div className="highlight-level-toggles">
|
|
<IconButton
|
|
icon={faNetworkWired}
|
|
onClick={() => onHighlightVisibilityChange({
|
|
...highlightVisibility,
|
|
nostrverse: !highlightVisibility.nostrverse
|
|
})}
|
|
title="Toggle nostrverse highlights"
|
|
ariaLabel="Toggle nostrverse highlights"
|
|
variant="ghost"
|
|
style={{
|
|
color: highlightVisibility.nostrverse ? 'var(--highlight-color-nostrverse, #9333ea)' : undefined,
|
|
opacity: highlightVisibility.nostrverse ? 1 : 0.4
|
|
}}
|
|
/>
|
|
{currentUserPubkey && (
|
|
<>
|
|
<IconButton
|
|
icon={faUserGroup}
|
|
onClick={() => onHighlightVisibilityChange({
|
|
...highlightVisibility,
|
|
friends: !highlightVisibility.friends
|
|
})}
|
|
title="Toggle friends highlights"
|
|
ariaLabel="Toggle friends highlights"
|
|
variant="ghost"
|
|
style={{
|
|
color: highlightVisibility.friends ? 'var(--highlight-color-friends, #f97316)' : undefined,
|
|
opacity: highlightVisibility.friends ? 1 : 0.4
|
|
}}
|
|
/>
|
|
<IconButton
|
|
icon={faUser}
|
|
onClick={() => onHighlightVisibilityChange({
|
|
...highlightVisibility,
|
|
mine: !highlightVisibility.mine
|
|
})}
|
|
title="Toggle my highlights"
|
|
ariaLabel="Toggle my highlights"
|
|
variant="ghost"
|
|
style={{
|
|
color: highlightVisibility.mine ? 'var(--highlight-color-mine, #eab308)' : undefined,
|
|
opacity: highlightVisibility.mine ? 1 : 0.4
|
|
}}
|
|
/>
|
|
</>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<div className="highlights-actions-right">
|
|
{hasHighlights && (
|
|
<IconButton
|
|
icon={showHighlights ? faEye : faEyeSlash}
|
|
onClick={onToggleHighlights}
|
|
title={showHighlights ? 'Hide highlights' : 'Show highlights'}
|
|
ariaLabel={showHighlights ? 'Hide highlights' : 'Show highlights'}
|
|
variant="ghost"
|
|
/>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default HighlightsPanelHeader
|
|
|