Margin
@{session.handle}
{showSettings && (
{Icons.settings}
Settings
{(['system', 'light', 'dark'] as const).map((t) => (
))}
Page Overlay
Show highlights on pages
)}
{(['page', 'bookmarks', 'highlights', 'collections'] as Tab[]).map((tab) => {
const icons = {
page: Icons.globe,
bookmarks: Icons.bookmark,
highlights: Icons.highlighter,
collections: Icons.folder,
};
const labels = {
page: 'Page',
bookmarks: 'Bookmarks',
highlights: 'Highlights',
collections: 'Collections',
};
return (
);
})}
{activeTab === 'page' && (
{currentUrl ? (

{
(e.target as HTMLImageElement).style.display = 'none';
(e.target as HTMLImageElement).nextElementSibling?.classList.remove(
'hidden'
);
}}
/>
) : null}
{Icons.globe}
{currentTitle || 'Untitled'}
{currentUrl ? new URL(currentUrl).hostname : ''}
{annotations.length} annotation{annotations.length !== 1 ? 's' : ''}
{loadingAnnotations ? (
) : annotations.length === 0 ? (
{Icons.sparkles}
No annotations yet
Be the first to annotate
) : (
{annotations.map((item) => (
openCollectionModal(item.uri || item.id || '')}
/>
))}
)}
)}
{activeTab === 'bookmarks' && (
{loadingBookmarks ? (
) : bookmarks.length === 0 ? (
{Icons.bookmark}
No bookmarks yet
Save pages to read later
) : (
{bookmarks.map((item) => (
))}
)}
)}
{activeTab === 'highlights' && (
{loadingHighlights ? (
) : highlights.length === 0 ? (
{Icons.highlighter}
No highlights yet
Select text on any page to highlight
) : (
{highlights.map((item) => (
{item.target?.selector?.exact && (
{
if (item.target?.source) {
browser.tabs.create({ url: item.target.source });
}
}}
>
"
{item.target.selector.exact.length > 150
? item.target.selector.exact.slice(0, 150) + '...'
: item.target.selector.exact}
"
)}
{Icons.globe}{' '}
{item.target?.source ? new URL(item.target.source).hostname : ''}
))}
)}
)}
{activeTab === 'collections' && (
{loadingCollections ? (
) : collections.length === 0 ? (
{Icons.folder}
No collections yet
Organize your bookmarks into collections
) : (
{collections.map((item) => (
))}
)}
)}
{collectionModalItem && (
setCollectionModalItem(null)}
>
e.stopPropagation()}
>
Add to Collection
{collections.length === 0 ? (
No collections yet
Create a collection on the web app first
) : (
collections.map((col) => {
const colUri = col.uri || col.id || '';
const isAdding = addingToCollection === colUri;
const isInCollection = containingCollections.has(colUri);
return (
);
})
)}
)}
);
}
function AnnotationCard({
item,
formatDate,
onAddToCollection,
}: {
item: Annotation;
formatDate: (d?: string) => string;
onAddToCollection?: () => void;
}) {
const author = item.author || item.creator || {};
const handle = author.handle || 'User';
const text = item.body?.value || item.text || '';
const selector = item.target?.selector;
const quote = selector?.exact || '';
const isHighlight = (item as any).type === 'Highlight';
return (