fix: codex review — compact across midnight, typed msg badges, URL punct
- Don't compact after date separator (show full header on new day) - Don't compact typed messages (result/error/plan keep their badges) - URL regex stops before trailing ),. so links don't grab punctuation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -210,10 +210,12 @@ export default function App() {
|
|||||||
const prev = i > 0 ? messages[i - 1] : null;
|
const prev = i > 0 ? messages[i - 1] : null;
|
||||||
const sameSender = prev && prev.user.username === msg.user.username;
|
const sameSender = prev && prev.user.username === msg.user.username;
|
||||||
const withinWindow = prev && (new Date(msg.created_at).getTime() - new Date(prev.created_at).getTime()) < 5 * 60 * 1000;
|
const withinWindow = prev && (new Date(msg.created_at).getTime() - new Date(prev.created_at).getTime()) < 5 * 60 * 1000;
|
||||||
const compact = !!(sameSender && withinWindow && !msg.reply_to);
|
|
||||||
const prevDate = prev ? new Date(prev.created_at).toDateString() : null;
|
const prevDate = prev ? new Date(prev.created_at).toDateString() : null;
|
||||||
const thisDate = new Date(msg.created_at).toDateString();
|
const thisDate = new Date(msg.created_at).toDateString();
|
||||||
const showDate = prevDate !== thisDate;
|
const showDate = prevDate !== thisDate;
|
||||||
|
// Don't compact: after date break, typed messages (non-text), or replies
|
||||||
|
const isTyped = msg.type !== "text";
|
||||||
|
const compact = !!(sameSender && withinWindow && !msg.reply_to && !showDate && !isTyped);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={msg.id}>
|
<div key={msg.id}>
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ function timeAgo(dateStr: string): string {
|
|||||||
|
|
||||||
function renderContent(text: string) {
|
function renderContent(text: string) {
|
||||||
// Split on @mentions and URLs
|
// Split on @mentions and URLs
|
||||||
const parts = text.split(/((?:https?:\/\/)[^\s]+|@[\w-]+)/g);
|
// URL regex: stop before trailing punctuation like ),. etc
|
||||||
|
const parts = text.split(/((?:https?:\/\/)[^\s),.\]}>]+|@[\w-]+)/g);
|
||||||
return parts.map((part, i) => {
|
return parts.map((part, i) => {
|
||||||
if (part.startsWith("@")) {
|
if (part.startsWith("@")) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user