feat: select-none

This commit is contained in:
codytseng
2025-04-12 00:00:45 +08:00
parent a10c9d8ffe
commit ea5b50cf0a
7 changed files with 26 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ export default function FavoriteRelaysSetting() {
<TemporaryRelaySet />
<div className="space-y-2">
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="text-muted-foreground font-semibold select-nones shrink-0">
<div className="text-muted-foreground font-semibold select-none shrink-0">
{t('Relay sets')}
</div>
<PullRelaySetsButton />

View File

@@ -25,7 +25,9 @@ export default function RawEventDialog({
<DialogDescription className="hidden" />
</DialogHeader>
<ScrollArea className="h-full">
<pre className="text-sm text-muted-foreground">{JSON.stringify(event, null, 2)}</pre>
<pre className="text-sm text-muted-foreground select-text">
{JSON.stringify(event, null, 2)}
</pre>
<ScrollBar orientation="horizontal" />
</ScrollArea>
</DialogContent>

View File

@@ -20,7 +20,7 @@ export default function RelayInfo({ url }: { url: string }) {
<div className="space-y-2">
<div className="flex gap-2 items-center">
<RelayIcon url={url} className="w-8 h-8" />
<div className="text-2xl font-semibold truncate">
<div className="text-2xl font-semibold truncate select-text">
{relayInfo.name || relayInfo.shortUrl}
</div>
</div>
@@ -33,7 +33,7 @@ export default function RelayInfo({ url }: { url: string }) {
</div>
)}
{relayInfo.description && (
<div className="text-wrap break-words whitespace-pre-wrap mt-2">
<div className="text-wrap break-words whitespace-pre-wrap mt-2 select-text">
{relayInfo.description}
</div>
)}
@@ -67,7 +67,7 @@ export default function RelayInfo({ url }: { url: string }) {
<a
href={normalizeHttpUrl(relayInfo.payments_url)}
target="_blank"
className="hover:underline text-primary"
className="hover:underline text-primary select-text"
>
{relayInfo.payments_url}
</a>
@@ -86,7 +86,7 @@ export default function RelayInfo({ url }: { url: string }) {
{relayInfo.contact && (
<div className="space-y-2 flex-1">
<div className="text-sm font-semibold text-muted-foreground">{t('Contact')}</div>
<div className="flex gap-2 items-center font-semibold">
<div className="flex gap-2 items-center font-semibold select-text">
<Mail />
{relayInfo.contact}
</div>
@@ -95,7 +95,7 @@ export default function RelayInfo({ url }: { url: string }) {
{relayInfo.software && (
<div className="space-y-2 flex-1">
<div className="text-sm font-semibold text-muted-foreground">{t('Software')}</div>
<div className="flex gap-2 items-center font-semibold">
<div className="flex gap-2 items-center font-semibold select-text">
<SquareCode />
{formatSoftware(relayInfo.software)}
</div>
@@ -104,7 +104,7 @@ export default function RelayInfo({ url }: { url: string }) {
{relayInfo.version && (
<div className="space-y-2 flex-1">
<div className="text-sm font-semibold text-muted-foreground">{t('Version')}</div>
<div className="flex gap-2 items-center font-semibold">
<div className="flex gap-2 items-center font-semibold select-text">
<GitBranch />
{relayInfo.version}
</div>

View File

@@ -7,7 +7,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, React.ComponentProps<'tex
return (
<textarea
className={cn(
'flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
'flex min-h-[80px] w-full rounded-md border border-input bg-transparent select-text px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
className
)}
ref={ref}

View File

@@ -30,6 +30,7 @@
-webkit-overflow-scrolling: touch;
text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
user-select: none;
}
.clickable {

View File

@@ -70,7 +70,13 @@ const NotePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref
<ParentNote key={`root-note-${event.id}`} eventId={rootEventId} />
)}
<ParentNote key={`parent-note-${event.id}`} eventId={parentEventId} />
<Note key={`note-${event.id}`} event={event} fetchNoteStats hideParentNotePreview />
<Note
key={`note-${event.id}`}
event={event}
className="select-text"
fetchNoteStats
hideParentNotePreview
/>
</div>
<Separator className="mt-4" />
{event.kind === kinds.ShortTextNote ? (

View File

@@ -98,7 +98,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
</div>
<div className="pt-2">
<div className="flex gap-2 items-center">
<div className="text-xl font-semibold truncate">{username}</div>
<div className="text-xl font-semibold truncate select-text">{username}</div>
{isFollowingYou && (
<div className="text-muted-foreground rounded-full bg-muted text-xs h-fit px-2 shrink-0">
{t('Follows you')}
@@ -107,7 +107,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
</div>
<Nip05 pubkey={pubkey} />
{lightningAddress && (
<div className="text-sm text-yellow-400 flex gap-1 items-center">
<div className="text-sm text-yellow-400 flex gap-1 items-center select-text">
<Zap className="size-4 shrink-0" />
<div className="flex-1 max-w-fit w-0 truncate">{lightningAddress}</div>
</div>
@@ -116,9 +116,12 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
<PubkeyCopy pubkey={pubkey} />
<QrCodePopover pubkey={pubkey} />
</div>
<ProfileAbout about={about} className="text-wrap break-words whitespace-pre-wrap mt-2" />
<ProfileAbout
about={about}
className="text-wrap break-words whitespace-pre-wrap mt-2 select-text"
/>
{website && (
<div className="flex gap-1 items-center text-primary mt-2 truncate">
<div className="flex gap-1 items-center text-primary mt-2 truncate select-text">
<Link size={14} className="shrink-0" />
<a
href={website}