feat: scroll to post bubble from recommended card + back-to-top button
Some checks failed
Deploy to Frontend Servers / deploy (push) Failing after 14s
Some checks failed
Deploy to Frontend Servers / deploy (push) Failing after 14s
Recommended cards already routed to /browse#post-<id>, but the stream had no logic to scroll to the target bubble — and the post might not be paged in yet. MessageStream now resolves the #post-<id> hash, auto-loads more pages until the bubble renders, scrolls to it, and gives it a brief gold highlight. Bubbles get scroll-mt so they clear the sticky header. Also adds a global floating back-to-top button (BackToTop) mounted in PublicLayout, shown after scrolling past 400px. Bundles related staging UI work already present in the working tree. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { useI18n } from "../../i18n";
|
||||
import type { Attachment } from "../../types/post";
|
||||
import { downloadAttachment } from "./utils/downloadFile";
|
||||
import { formatBytes } from "./utils/formatBytes";
|
||||
import { useToast } from "../Toast";
|
||||
|
||||
type AttachmentDownloadPillProps = {
|
||||
postId: string;
|
||||
@@ -20,15 +21,21 @@ export function AttachmentDownloadPill({
|
||||
className = "absolute left-2 top-2",
|
||||
}: AttachmentDownloadPillProps) {
|
||||
const { t } = useI18n();
|
||||
const { showToast } = useToast();
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
|
||||
const handleDownload = (e: MouseEvent<HTMLButtonElement>) => {
|
||||
const handleDownload = async (e: MouseEvent<HTMLButtonElement>) => {
|
||||
e.stopPropagation();
|
||||
if (isDownloading) return;
|
||||
setIsDownloading(true);
|
||||
void downloadAttachment(postId, attachment.id, attachment.filename)
|
||||
.finally(() => setIsDownloading(false))
|
||||
.catch(() => {});
|
||||
try {
|
||||
await downloadAttachment(postId, attachment.id, attachment.filename);
|
||||
showToast(t("downloadOk"));
|
||||
} catch {
|
||||
showToast(t("downloadFail"), "error");
|
||||
} finally {
|
||||
setIsDownloading(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user