Merge pull request #123 from plastic-labs/abigail/minor_fixes_mobile_more

Abigail/minor fixes mobile more
This commit is contained in:
Courtland Leer 2025-12-12 15:40:38 -05:00 committed by GitHub
commit cfc09bc780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 13 deletions

View File

@ -116,7 +116,7 @@ const CopyPageMarkdown: QuartzComponent = ({ fileData, displayClass }: QuartzCom
<path d="M59.16 50.47H31.98V56.31H59.16V50.47Z"></path> <path d="M59.16 50.47H31.98V56.31H59.16V50.47Z"></path>
</svg> </svg>
<div class="dropdown-item-content"> <div class="dropdown-item-content">
<span class="dropdown-item-title">{isHomePage ? "Ask Honcho about this blog" : "Ask Honcho about this page"} <span class="external-arrow"></span></span> <span class="dropdown-item-title">{isHomePage ? "Ask Honcho Chat about this blog" : "Ask Honcho Chat about this page"} <span class="external-arrow"></span></span>
</div> </div>
</a> </a>
<a <a

View File

@ -3,20 +3,30 @@ const svgCopy =
const svgCheck = const svgCheck =
'<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>' '<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16"><path fill-rule="evenodd" fill="rgb(63, 185, 80)" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>'
async function copyToClipboard(text: string): Promise<boolean> {
try {
await navigator.clipboard.writeText(text)
return true
} catch {
// Fallback for mobile browsers
const textarea = document.createElement("textarea")
textarea.value = text
textarea.style.cssText = "position:fixed;left:-9999px;top:0"
document.body.appendChild(textarea)
textarea.select()
const ok = document.execCommand("copy")
document.body.removeChild(textarea)
return ok
}
}
async function copyPageMarkdown(slug: string): Promise<boolean> { async function copyPageMarkdown(slug: string): Promise<boolean> {
try { try {
// Use full blog content for home page, individual page content otherwise
const llmsUrl = slug === "index" ? `/llms-full.txt` : `/${slug}/llms.txt` const llmsUrl = slug === "index" ? `/llms-full.txt` : `/${slug}/llms.txt`
const response = await fetch(llmsUrl) const response = await fetch(llmsUrl)
if (!response.ok) { if (!response.ok) return false
console.error("Failed to fetch markdown:", response.statusText) return copyToClipboard(await response.text())
return false } catch {
}
const markdown = await response.text()
await navigator.clipboard.writeText(markdown)
return true
} catch (error) {
console.error("Failed to copy page markdown:", error)
return false return false
} }
} }
@ -48,7 +58,7 @@ document.addEventListener("nav", () => {
// Set the correct hrefs for Honcho, ChatGPT and Claude links // Set the correct hrefs for Honcho, ChatGPT and Claude links
if (honchoLink) { if (honchoLink) {
const prompt = `Read this page and answer questions about it: ${llmsUrl}` const prompt = `Read this page and answer questions about it: ${llmsUrl}`
honchoLink.href = `https://honcho.chat/?q=${encodeURIComponent(prompt)}` honchoLink.href = `https://honcho.chat/?hints=search&q=${encodeURIComponent(prompt)}`
} }
if (chatgptLink) { if (chatgptLink) {
const prompt = `Read this page and answer questions about it: ${llmsUrl}` const prompt = `Read this page and answer questions about it: ${llmsUrl}`
@ -112,3 +122,4 @@ document.addEventListener("nav", () => {
}) })

View File

@ -40,7 +40,7 @@
position: absolute; position: absolute;
top: calc(100% + 4px); top: calc(100% + 4px);
right: 0; right: 0;
width: 280px; width: max-content;
background: var(--light); background: var(--light);
border: 1px solid var(--lightgray); border: 1px solid var(--lightgray);
border-radius: 8px; border-radius: 8px;

View File

@ -94,6 +94,16 @@ body {
font-size: 0.86rem; font-size: 0.86rem;
} }
@media (max-width: 800px) {
.sidebar.left {
flex-direction: column;
}
.explorer .explorer-content {
padding-top: 5rem;
}
}
input[type="search"] { input[type="search"] {
background-color: var(--searchBackground); background-color: var(--searchBackground);
} }