Add right-aligned post sharing with chat, copy-link, and native share actions, plus media downloads and mobile-safe action layout.

Hop-State: A_06FPA5BJBEJ930H9MP07GNG
Hop-Proposal: R_06FPA5AQ4HY44EBZAGHH5KG
Hop-Task: T_06FPA3T7TNGR6E7KE0A2ECR
Hop-Attempt: AT_06FPA3T7TN53HDSQHEBWSS8
This commit is contained in:
2026-07-15 02:22:12 -07:00
committed by Hop
parent 6dd3379fb4
commit a7a430a627
3 changed files with 279 additions and 20 deletions
+18
View File
@@ -41,6 +41,7 @@ export default function ChatPage() {
const router = useRouter();
const searchParams = useSearchParams();
const composeHandle = searchParams.get('compose');
const sharedPostUrl = searchParams.get('share');
// Chat Data State
const [conversations, setConversations] = useState<Conversation[]>([]);
@@ -61,6 +62,7 @@ export default function ChatPage() {
const messagesEndRef = useRef<HTMLDivElement>(null);
const messagesContainerRef = useRef<HTMLDivElement>(null);
const [isAtBottom, setIsAtBottom] = useState(true);
const appliedSharedPostRef = useRef<string | null>(null);
// ============================================
// HELPER FUNCTIONS (Defined before useEffects)
@@ -337,6 +339,16 @@ export default function ChatPage() {
}
}, [selectedConversation]);
// A post shared from the timeline waits for the user to choose a conversation,
// then appears in the composer so they remain in control of sending it.
useEffect(() => {
if (!selectedConversation || !sharedPostUrl || appliedSharedPostRef.current === sharedPostUrl) return;
setNewMessage(sharedPostUrl);
appliedSharedPostRef.current = sharedPostUrl;
router.replace('/chat', { scroll: false });
}, [selectedConversation, sharedPostUrl, router]);
// Auto-scroll to bottom of messages only if user was already at bottom
useEffect(() => {
if (messagesEndRef.current && isAtBottom) {
@@ -555,6 +567,12 @@ export default function ChatPage() {
</div>
</header>
{sharedPostUrl && (
<div className="chat-share-intent">
Choose a conversation to share this post.
</div>
)}
<div style={{
padding: '16px', // Reverted from 20px to 16px as requested
borderBottom: '1px solid var(--border)',