Skip to content

Commit abd4b8b

Browse files
committed
fix mobile shared view - wasn't rendering right side function correctly
1 parent b534f72 commit abd4b8b

File tree

3 files changed

+91
-35
lines changed

3 files changed

+91
-35
lines changed

client/src/app/(main)/paper/share/[id]/page.tsx

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,63 @@ export default function SharedPaperView() {
225225
)}
226226
</div>
227227
) : (
228-
<div
229-
className={`flex flex-row h-full relative pr-[60px]`}
230-
>
231-
<PaperMetadata
232-
paperData={paperData}
233-
hasMessages={false}
234-
readonly={true}
235-
/>
236-
<AnnotationsView
237-
highlights={highlights}
238-
annotations={annotations}
239-
onHighlightClick={handleHighlightClick}
240-
activeHighlight={activeHighlight}
241-
readonly={true}
228+
<div className="w-full h-full flex flex-row relative pr-[60px]">
229+
<div className="flex-grow overflow-y-auto">
230+
{rightSideFunction === 'Annotations' && (
231+
<>
232+
<PaperMetadata
233+
paperData={paperData}
234+
hasMessages={false}
235+
readonly={true}
236+
/>
237+
<AnnotationsView
238+
highlights={highlights}
239+
annotations={annotations}
240+
onHighlightClick={handleHighlightClick}
241+
activeHighlight={activeHighlight}
242+
readonly={true}
243+
/>
244+
</>
245+
)}
246+
{rightSideFunction === 'Overview' && (
247+
<div className={'flex flex-col md:px-2 m-2 relative animate-fade-in'}>
248+
{paperData.summary && (
249+
<div className="prose dark:prose-invert !max-w-full text-sm mt-4">
250+
{memoizedOverviewContent}
251+
{paperData.summary_citations && paperData.summary_citations.length > 0 && (
252+
<div className="mt-0 pt-0 border-t border-gray-300 dark:border-gray-700" id="references-section">
253+
<h4 className="text-sm font-semibold mb-2">References</h4>
254+
<ul className="list-none p-0">
255+
{paperData.summary_citations.map((citation, index) => (
256+
<div
257+
key={index}
258+
className={`flex flex-row gap-2 ${matchesCurrentCitation(`${citation.index}`, 0) ? 'bg-blue-100 dark:bg-blue-900 rounded p-1 transition-colors duration-300' : ''}`}
259+
id={`citation-${citation.index}-${index}`}
260+
onClick={() => handleCitationClickFromSummary(`${citation.index}`, 0)}
261+
>
262+
<div className={'text-xs text-secondary-foreground'}>
263+
<span>{citation.index}</span>
264+
</div>
265+
<div
266+
id={`citation-ref-${citation.index}-${index}`}
267+
className={'text-xs text-secondary-foreground'}
268+
>
269+
{citation.text}
270+
</div>
271+
</div>
272+
))}
273+
</ul>
274+
</div>
275+
)}
276+
</div>
277+
)}
278+
</div>
279+
)}
280+
</div>
281+
<PaperSidebar
282+
rightSideFunction={rightSideFunction}
283+
setRightSideFunction={setRightSideFunction}
284+
PaperToolset={SharedPaperToolset}
242285
/>
243286
</div>
244287
)}
@@ -301,13 +344,20 @@ export default function SharedPaperView() {
301344
<div className="w-2/5 h-full flex flex-row relative pr-[60px]">
302345
<div className="flex-grow">
303346
{rightSideFunction === 'Annotations' && (
304-
<AnnotationsView
305-
highlights={highlights}
306-
annotations={annotations}
307-
onHighlightClick={handleHighlightClick}
308-
activeHighlight={activeHighlight}
309-
readonly={true}
310-
/>
347+
<>
348+
<PaperMetadata
349+
paperData={paperData}
350+
hasMessages={false}
351+
readonly={true}
352+
/>
353+
<AnnotationsView
354+
highlights={highlights}
355+
annotations={annotations}
356+
onHighlightClick={handleHighlightClick}
357+
activeHighlight={activeHighlight}
358+
readonly={true}
359+
/>
360+
</>
311361
)}
312362
{rightSideFunction === 'Overview' && paperData.summary && (
313363
<div className={`flex flex-col ${heightClass} md:px-2 overflow-y-auto m-2 relative animate-fade-in`}>

client/src/components/AnnotationsView.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,16 @@ interface AnnotationsToolbarProps {
201201
selectedHighlightType: string;
202202
showJustMine: boolean;
203203
highlightTypes: string[];
204+
readonly: boolean;
204205
}
205206

206207
function AnnotationsToolbar({
207208
onHighlightTypeFilter,
208209
onShowJustMine,
209210
selectedHighlightType,
210211
showJustMine,
211-
highlightTypes
212+
highlightTypes,
213+
readonly,
212214
}: AnnotationsToolbarProps) {
213215
return (
214216
<div className="flex items-center gap-3 p-3 border-b border-border bg-muted/20">
@@ -225,18 +227,21 @@ function AnnotationsToolbar({
225227
))}
226228
</SelectContent>
227229
</Select>
228-
229-
<div className="flex items-center gap-2">
230-
<Switch
231-
checked={showJustMine}
232-
onCheckedChange={onShowJustMine}
233-
id="just-mine"
234-
/>
235-
<label htmlFor="just-mine" className="text-sm font-medium text-foreground cursor-pointer flex items-center gap-1">
236-
<UserIcon size={14} />
237-
Just mine
238-
</label>
239-
</div>
230+
{
231+
!readonly && (
232+
<div className="flex items-center gap-2">
233+
<Switch
234+
checked={showJustMine}
235+
onCheckedChange={onShowJustMine}
236+
id="just-mine"
237+
/>
238+
<label htmlFor="just-mine" className="text-sm font-medium text-foreground cursor-pointer flex items-center gap-1">
239+
<UserIcon size={14} />
240+
Just mine
241+
</label>
242+
</div>
243+
)
244+
}
240245
</div>
241246
);
242247
}
@@ -350,6 +355,7 @@ export function AnnotationsView(
350355
selectedHighlightType={selectedHighlightType}
351356
showJustMine={showJustMine}
352357
highlightTypes={uniqueHighlightTypes}
358+
readonly={readonly}
353359
/>
354360

355361
<div className="flex-1 overflow-auto" ref={scrollContainerRef}>

client/src/components/PaperMetadata.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function PaperMetadata({ paperData, onClickStarterQuestion, hasMessages, readonl
9797
<Collapsible
9898
open={isOpen}
9999
onOpenChange={setIsOpen}
100-
className="mb-4 border-b-2 border-secondary"
100+
className="border-b-2 border-secondary"
101101
>
102102
<div className="p-2">
103103
<CollapsibleTrigger className="flex flex-row w-full items-center justify-between">

0 commit comments

Comments
 (0)