|
2 | 2 |
|
3 | 3 | import { useCallback, useEffect, useRef, useState } from "react"; |
4 | 4 | import Image from "next/image"; |
| 5 | +import Link from "next/link"; |
5 | 6 | import { MarkdownRenderer } from "./MarkdownRenderer"; |
6 | 7 | import { HyperBlogInfo } from "@/lib/types/delve-api"; |
7 | 8 | import { calculateReadingTime } from "@/lib/utils"; |
@@ -609,35 +610,34 @@ export const HyperBlogDetail = ({ blog, onBack, showBackButton = true, initialSe |
609 | 610 | )} |
610 | 611 |
|
611 | 612 | {/* Main Content Area */} |
612 | | - <div className="flex-1 overflow-hidden flex flex-col lg:flex-row relative max-w-full"> |
| 613 | + <div className="flex-1 flex flex-col lg:flex-row relative max-w-full"> |
613 | 614 | {/* Table of Contents Sidebar */} |
614 | 615 | {currentBlog.blog_content?.sections && ( |
615 | 616 | <> |
616 | 617 | {/* Desktop TOC */} |
617 | | - <div |
618 | | - ref={tocRef} |
619 | | - className="hidden lg:block lg:w-64 lg:border-r lg:border-base-300 lg:overflow-y-auto lg:h-[calc(100vh-100px)] sticky top-[80px] z-10" |
620 | | - > |
621 | | - <div className="p-4"> |
622 | | - <h4 className="text-sm font-semibold uppercase tracking-wide opacity-70 mb-3">Table of Contents</h4> |
623 | | - <nav className="space-y-1"> |
624 | | - {currentBlog.blog_content.sections |
625 | | - .sort((a, b) => a.order - b.order) |
626 | | - .map((section, index) => ( |
627 | | - <button |
628 | | - key={section.htn_node_id} |
629 | | - onClick={() => handleScrollToSection(section.htn_node_id)} |
630 | | - className={`toc-item w-full text-left text-sm py-2 px-4 rounded transition-all min-h-[44px] flex items-center gap-2 focus:ring-2 focus:ring-primary focus:outline-none ${ |
631 | | - activeSection === section.htn_node_id |
632 | | - ? "toc-item active bg-base-200 border-l-4 border-primary font-semibold" |
633 | | - : "border-l-4 border-transparent hover:bg-base-200" |
634 | | - }`} |
635 | | - > |
636 | | - <span className="text-xs opacity-60 flex-shrink-0">{index + 1}.</span> |
637 | | - <span className="flex-1 line-clamp-2">{section.title}</span> |
638 | | - </button> |
639 | | - ))} |
640 | | - </nav> |
| 618 | + <div ref={tocRef} className="hidden lg:block lg:w-64 lg:flex-shrink-0"> |
| 619 | + <div className="fixed top-[140px] w-64 h-[calc(100vh-160px)] overflow-y-auto border-r border-base-300 bg-base-100 z-10"> |
| 620 | + <div className="p-4"> |
| 621 | + <h4 className="text-sm font-semibold uppercase tracking-wide opacity-70 mb-3">Table of Contents</h4> |
| 622 | + <nav className="space-y-1"> |
| 623 | + {currentBlog.blog_content.sections |
| 624 | + .sort((a, b) => a.order - b.order) |
| 625 | + .map((section, index) => ( |
| 626 | + <button |
| 627 | + key={section.htn_node_id} |
| 628 | + onClick={() => handleScrollToSection(section.htn_node_id)} |
| 629 | + className={`toc-item w-full text-left text-sm py-2 px-4 rounded transition-all min-h-[44px] flex items-center gap-2 focus:ring-2 focus:ring-primary focus:outline-none ${ |
| 630 | + activeSection === section.htn_node_id |
| 631 | + ? "toc-item active bg-base-200 border-l-4 border-primary font-semibold" |
| 632 | + : "border-l-4 border-transparent hover:bg-base-200" |
| 633 | + }`} |
| 634 | + > |
| 635 | + <span className="text-xs opacity-60 flex-shrink-0">{index + 1}.</span> |
| 636 | + <span className="flex-1 line-clamp-2">{section.title}</span> |
| 637 | + </button> |
| 638 | + ))} |
| 639 | + </nav> |
| 640 | + </div> |
641 | 641 | </div> |
642 | 642 | </div> |
643 | 643 |
|
@@ -924,6 +924,20 @@ export const HyperBlogDetail = ({ blog, onBack, showBackButton = true, initialSe |
924 | 924 | </span> |
925 | 925 | </div> |
926 | 926 | </div> |
| 927 | + <div className="bg-base-50 rounded-lg p-3"> |
| 928 | + <Link |
| 929 | + href={`/data-rooms/${currentBlog.dataroom_id}`} |
| 930 | + className="flex items-center gap-2 text-sm hover:text-primary transition-colors group" |
| 931 | + title="Visit this DataRoom to create your own HyperBlog" |
| 932 | + > |
| 933 | + <span className="text-base">🗂️</span> |
| 934 | + <span className="truncate"> |
| 935 | + <strong>DataRoom:</strong>{" "} |
| 936 | + {currentBlog.dataroom_description || truncateAddress(currentBlog.dataroom_id, 8)} |
| 937 | + </span> |
| 938 | + <ExternalLink className="w-3 h-3 opacity-0 group-hover:opacity-60 transition-opacity" /> |
| 939 | + </Link> |
| 940 | + </div> |
927 | 941 | <div className="bg-base-50 rounded-lg p-3"> |
928 | 942 | <div className="flex items-center gap-2 text-sm"> |
929 | 943 | <Calendar className="w-4 h-4 opacity-60" /> |
|
0 commit comments