Skip to content

Commit

Permalink
fix: comment content title cell
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jan 10, 2024
1 parent c5bae13 commit 2fdf655
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/components/modules/dashboard/comments/CommentContentCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { CommentModel } from '@mx-space/api-client'

import { CollectionRefTypes } from '@mx-space/api-client'

import { MotionButtonBase } from '~/components/ui/button'
import { RelativeTime } from '~/components/ui/relative-time'
import { EllipsisHorizontalTextWithTooltip } from '~/components/ui/typography'
import { clsxm } from '~/lib/helper'
Expand Down Expand Up @@ -34,25 +33,28 @@ export const CommentContentCell: Component<{ comment: CommentModel }> = (
if (refType === CollectionRefTypes.Recently)
return `${ref.text.slice(0, 20)}...`
return (
<MotionButtonBase
className="inline-flex grow"
onClick={async () => {
const url = await apiClient.proxy.helper('url-builder')(ref.id).get<{
data: string
}>()
window.open(url?.data, '_blank')
}}
>
<EllipsisHorizontalTextWithTooltip wrapperClassName="text-left text-accent inline-block !w-0 flex-grow">
{ref.title}
</EllipsisHorizontalTextWithTooltip>
</MotionButtonBase>
<div className="flex w-0 grow items-center">
<a
href={`${apiClient.proxy
.helper('url-builder')(ref.id)
.toString(true)}?redirect=true`}
className="inline-flex overflow-hidden"
target="_blank"
rel="noreferrer"
>
<EllipsisHorizontalTextWithTooltip wrapperClassName="text-left text-accent inline-block flex-shrink">
{ref.title}
</EllipsisHorizontalTextWithTooltip>
</a>
<div className="ml-2">{isWhispers && '悄悄说'}</div>
<div className="grow" />
</div>
)
}, [ref, refType])
}, [isWhispers, ref, refType])
return (
<div className={clsxm('flex flex-col gap-2 py-2 text-sm', className)}>
<div className="flex gap-2 whitespace-nowrap text-sm">
<RelativeTime date={created} />{TitleEl} {isWhispers && '悄悄说'}
<RelativeTime date={created} />{TitleEl}
</div>

<p className="break-words">{text}</p>
Expand Down

1 comment on commit 2fdf655

@vercel
Copy link

@vercel vercel bot commented on 2fdf655 Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-git-main-innei.vercel.app
innei.in
shiro-innei.vercel.app
springtide.vercel.app

Please sign in to comment.