File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ function handleTweetClick() {
110110 class =" border-b-border flex w-full max-w-[700px] cursor-pointer gap-3 border-b-1 p-2"
111111 @click.prevent.stop =" handleTweetClick"
112112 >
113- <NuxtLink :to =" ` /profile/${props .tweet .author .username } ` " >
113+ <NuxtLink :to =" ` /profile/${props .tweet .author .username } ` " @ click . stop >
114114 <Avatar
115115 :img =" props .tweet .author .avatarUrl || ' /default_profile.png' "
116116 size="sm"
@@ -122,7 +122,7 @@ function handleTweetClick() {
122122 <div class =" min-w-0 flex-1" >
123123 <!-- Header: display name, username, time -->
124124 <div class =" flex flex-wrap items-center gap-x-1 text-sm" >
125- <NuxtLink :to =" ` /profile/${props .tweet .author .username } ` " >
125+ <NuxtLink :to =" ` /profile/${props .tweet .author .username } ` " @ click . stop >
126126 <span class =" cursor-pointer font-semibold hover:underline" >{{
127127 props.tweet.author.displayName
128128 }}</span >
@@ -143,7 +143,12 @@ function handleTweetClick() {
143143 <span v-if =" seg.type === 'text'" class =" inline" >
144144 {{ seg.text }}
145145 </span >
146- <a v-else :href =" seg.href" class =" text-primary inline font-medium hover:underline" >
146+ <a
147+ v-else
148+ :href =" seg.href"
149+ class =" text-primary inline font-medium hover:underline"
150+ @click.stop
151+ >
147152 {{ seg.text }}
148153 </a >
149154 </template >
Original file line number Diff line number Diff line change 11export function buildTweetLink ( username : string , id : string , origin ?: string ) : string {
22 const base =
33 origin !== undefined ? origin : typeof window !== 'undefined' ? window . location . origin : '' ;
4- return `${ base } /${ username } /status/${ id } ` ;
4+ return `${ base } /profile/ ${ username } /status/${ id } ` ;
55}
Original file line number Diff line number Diff line change @@ -10,21 +10,21 @@ describe('buildTweetLink', () => {
1010
1111 it ( 'uses provided origin when given' , ( ) => {
1212 const link = buildTweetLink ( 'user' , '1' , 'https://example.com' ) ;
13- expect ( link ) . toBe ( 'https://example.com/user/status/1' ) ;
13+ expect ( link ) . toBe ( 'https://example.com/profile/ user/status/1' ) ;
1414 } ) ;
1515
1616 it ( 'falls back to window.location.origin when origin not provided and window exists' , ( ) => {
1717 ( globalThis as unknown as { window ?: { location : { origin : string } } } ) . window = {
1818 location : { origin : 'https://site.test' } ,
1919 } ;
2020 const link = buildTweetLink ( 'me' , '2' ) ;
21- expect ( link ) . toBe ( 'https://site.test/me/status/2' ) ;
21+ expect ( link ) . toBe ( 'https://site.test/profile/ me/status/2' ) ;
2222 } ) ;
2323
2424 it ( 'uses relative link when no origin provided and window is undefined' , ( ) => {
2525 // eslint-disable-next-line @typescript-eslint/no-explicit-any
2626 delete ( globalThis as any ) . window ;
2727 const link = buildTweetLink ( 'ssr' , '3' ) ;
28- expect ( link ) . toBe ( '/ssr/status/3' ) ;
28+ expect ( link ) . toBe ( '/profile/ ssr/status/3' ) ;
2929 } ) ;
3030} ) ;
You can’t perform that action at this time.
0 commit comments