Compare commits
2
Commits
4f0d2da876
...
9591c67478
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9591c67478 | ||
|
|
d65c5613d3 |
No files matched your search
@@ -42,16 +42,16 @@ function PreBlock({ children, ...props }: React.HTMLAttributes<HTMLPreElement>)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative group my-5 rounded-xl overflow-hidden border border-[var(--border-code)] bg-[var(--code-block-bg)] shadow-xs">
|
||||
<div className="code-block-wrapper relative group my-5 rounded-xl overflow-hidden border border-[var(--border-code)] bg-[var(--code-block-bg)] shadow-xs print:my-3 print:rounded-md print:border-slate-300 print:bg-slate-50">
|
||||
{/* Code block header bar */}
|
||||
<div className="flex items-center justify-between px-4 py-2 bg-[var(--code-header-bg)] border-b border-[var(--border-code)] text-xs font-mono select-none">
|
||||
<div className="code-block-header flex items-center justify-between px-4 py-2 bg-[var(--code-header-bg)] border-b border-[var(--border-code)] text-xs font-mono select-none print:px-3 print:py-1 print:bg-slate-100 print:border-slate-300">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<div className="flex items-center gap-1.5 opacity-75 group-hover:opacity-100 transition-opacity">
|
||||
<div className="no-print flex items-center gap-1.5 opacity-75 group-hover:opacity-100 transition-opacity">
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-rose-400/80 dark:bg-rose-500/60 inline-block" />
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-amber-400/80 dark:bg-amber-500/60 inline-block" />
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-emerald-400/80 dark:bg-emerald-500/60 inline-block" />
|
||||
</div>
|
||||
<span className="text-[11px] font-medium uppercase tracking-wider text-[var(--text-muted)] group-hover:text-[var(--text-secondary)] transition-colors">
|
||||
<span className="text-[11px] font-medium uppercase tracking-wider text-[var(--text-muted)] print:text-slate-700 group-hover:text-[var(--text-secondary)] transition-colors">
|
||||
{language}
|
||||
</span>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@ function PreBlock({ children, ...props }: React.HTMLAttributes<HTMLPreElement>)
|
||||
onClick={handleCopy}
|
||||
type="button"
|
||||
aria-label="Copy code to clipboard"
|
||||
className="flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] bg-[var(--code-button-bg)] hover:bg-[var(--code-button-hover-bg)] px-2.5 py-1 rounded-md border border-[var(--border-code)] transition-all font-sans shadow-xs cursor-pointer"
|
||||
className="no-print flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] bg-[var(--code-button-bg)] hover:bg-[var(--code-button-hover-bg)] px-2.5 py-1 rounded-md border border-[var(--border-code)] transition-all font-sans shadow-xs cursor-pointer"
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
@@ -80,7 +80,7 @@ function PreBlock({ children, ...props }: React.HTMLAttributes<HTMLPreElement>)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<pre className="!m-0 !bg-transparent p-4 overflow-x-auto text-[13.5px] text-[var(--pre-text)] font-mono leading-relaxed" {...props}>
|
||||
<pre className="!m-0 !bg-transparent p-4 print:p-3 overflow-x-auto text-[13.5px] print:text-[8.5pt] text-[var(--pre-text)] print:text-slate-900 font-mono leading-relaxed" {...props}>
|
||||
{children}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,6 @@ export default function PdfExportView({
|
||||
const [copiedMd, setCopiedMd] = useState(false);
|
||||
|
||||
const sectionMeta = getSectionMeta(summary.section);
|
||||
const authorsList = summary.authors || [];
|
||||
|
||||
// Available categories for filtering
|
||||
const allCategories = useMemo(() => {
|
||||
@@ -285,20 +284,16 @@ export default function PdfExportView({
|
||||
<main className="print-container bg-white text-slate-900 max-w-4xl mx-auto px-4 sm:px-8 py-6 print:p-0 print:max-w-none">
|
||||
|
||||
{/* Document Header */}
|
||||
<header className="mb-8 pb-4 border-b border-slate-300">
|
||||
<header className="mb-8 pb-3 border-b border-slate-300">
|
||||
<h1 className="text-3xl sm:text-4xl font-bold text-slate-950 tracking-tight mb-2">
|
||||
{summary.title}
|
||||
</h1>
|
||||
<div className="text-xs text-slate-600 font-mono flex flex-wrap gap-x-4 gap-y-1">
|
||||
<span><strong>Scope:</strong> {summary.scope}</span>
|
||||
<span><strong>Total Challenges:</strong> {filteredAndSortedDocs.length}</span>
|
||||
<div className="text-xs text-slate-500 font-mono flex flex-wrap items-center gap-x-2 gap-y-1">
|
||||
<span>{filteredAndSortedDocs.length} Challenges</span>
|
||||
{currentTotalPoints > 0 && (
|
||||
<span><strong>Total Points:</strong> {currentTotalPoints.toLocaleString()} pts</span>
|
||||
<span>· {currentTotalPoints.toLocaleString()} Total Points</span>
|
||||
)}
|
||||
{authorsList.length > 0 && (
|
||||
<span><strong>Author(s):</strong> {authorsList.map((a) => `@${a}`).join(", ")}</span>
|
||||
)}
|
||||
<span><strong>Date:</strong> {new Date(summary.generatedAt).toLocaleDateString(undefined, { dateStyle: "long" })}</span>
|
||||
<span>· {new Date(summary.generatedAt).toLocaleDateString(undefined, { dateStyle: "long" })}</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -357,10 +352,8 @@ export default function PdfExportView({
|
||||
<span><strong>Category:</strong> {cat}</span>
|
||||
{pts > 0 && <span><strong>Points:</strong> {pts} pts</span>}
|
||||
{diff && <span><strong>Difficulty:</strong> {diff}</span>}
|
||||
{doc.author && <span><strong>Author:</strong> @{doc.author}</span>}
|
||||
{doc.slug && <span><strong>Slug:</strong> {doc.slug}</span>}
|
||||
|
||||
{/* Extra fields */}
|
||||
{/* Extra fields (excluding author, slug, scope, etc.) */}
|
||||
{Object.entries(extra).map(([k, v]) => {
|
||||
const lowerKey = k.toLowerCase();
|
||||
if (
|
||||
@@ -372,8 +365,12 @@ export default function PdfExportView({
|
||||
"difficulty",
|
||||
"solved",
|
||||
"author",
|
||||
"authors",
|
||||
"scope",
|
||||
"slug",
|
||||
"event",
|
||||
"challenge",
|
||||
"path",
|
||||
].includes(lowerKey) ||
|
||||
v === null ||
|
||||
v === undefined ||
|
||||
|
||||
@@ -442,8 +442,9 @@ body {
|
||||
}
|
||||
|
||||
.avoid-break-inside,
|
||||
.challenge-header-card,
|
||||
.badge-container,
|
||||
.code-block-wrapper,
|
||||
.code-block-container,
|
||||
.challenge-entry,
|
||||
table,
|
||||
tr,
|
||||
img,
|
||||
@@ -459,6 +460,32 @@ body {
|
||||
}
|
||||
|
||||
/* Code block wrapping and styling in print */
|
||||
.code-block-wrapper,
|
||||
.code-block-container {
|
||||
break-inside: avoid !important;
|
||||
page-break-inside: avoid !important;
|
||||
border: 1px solid #cbd5e1 !important;
|
||||
background-color: #f8fafc !important;
|
||||
border-radius: 4px !important;
|
||||
margin: 8pt 0 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.code-block-header {
|
||||
border-bottom: 1px solid #cbd5e1 !important;
|
||||
background-color: #f1f5f9 !important;
|
||||
padding: 3pt 8pt !important;
|
||||
color: #334155 !important;
|
||||
}
|
||||
|
||||
.code-block-wrapper pre {
|
||||
border: none !important;
|
||||
background-color: transparent !important;
|
||||
padding: 6pt 8pt !important;
|
||||
margin: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
pre,
|
||||
pre code,
|
||||
code {
|
||||
|
||||
@@ -416,8 +416,6 @@ export function compileExportMarkdown(exportData: ExportData): string {
|
||||
if (cat) badges.push(`**Category:** \`${cat}\``);
|
||||
if (pts > 0) badges.push(`**Points:** \`${pts} pts\``);
|
||||
if (diff) badges.push(`**Difficulty:** \`${diff}\``);
|
||||
if (doc.author) badges.push(`**Author:** @${doc.author}`);
|
||||
if (doc.slug) badges.push(`**Slug:** \`${doc.slug}\``);
|
||||
|
||||
if (badges.length > 0) {
|
||||
lines.push(badges.join(" · "));
|
||||
|
||||
Reference in new issue
Block a user