Add identity.ts with isSelf() and resolveDisplayIdentity() — pure stateless functions that detect replicated-self using the immutable (username, homeInstance) composite key. No store lookups, no data mutation. Fixes wrong avatar gradient and missing edit/delete on own messages in remote channels. Also includes: optimistic message dedup fix for cross-instance messages (content-only matching), federation toast notifications, Username component with @domain display, invite parser, and deploy script simplification.
26 lines
723 B
TypeScript
26 lines
723 B
TypeScript
import React from 'react';
|
|
import { Tooltip } from './Tooltip';
|
|
|
|
interface UsernameProps {
|
|
username: string;
|
|
className?: string;
|
|
style?: React.CSSProperties;
|
|
}
|
|
|
|
export function Username({ username, className, style }: UsernameProps) {
|
|
const atIndex = username.indexOf('@');
|
|
if (atIndex === -1) {
|
|
return <span className={className} style={style}>{username}</span>;
|
|
}
|
|
const name = username.slice(0, atIndex);
|
|
const domain = username.slice(atIndex + 1);
|
|
return (
|
|
<Tooltip content={username} position="top">
|
|
<span className={className} style={style}>
|
|
{name}
|
|
<span className="text-txt-tertiary text-[0.8em] ml-0.5 font-normal">@{domain}</span>
|
|
</span>
|
|
</Tooltip>
|
|
);
|
|
}
|