Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebefec6

Browse files
refactor: improve markdown rendering on notifications (cherry-pick#17112) (#17197)
Cherry-picked refactor: improve markdown rendering on notifications(#17112)**Before:**<img width="753" alt="Screenshot 2025-03-26 at 11 11 46"src="https://github.com/user-attachments/assets/d4504de9-d007-43bf-9e0b-a8ff1b04da2c"/>**After:**![image](https://github.com/user-attachments/assets/5a249a48-e2ec-4573-97ea-7a978fbe3c9a)Co-authored-by: Bruno Quaresma <bruno@coder.com>
1 parent338439c commitebefec6

File tree

5 files changed

+56
-12
lines changed

5 files changed

+56
-12
lines changed

‎site/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
"@storybook/test":"8.4.6",
141141
"@swc/core":"1.3.38",
142142
"@swc/jest":"0.2.37",
143+
"@tailwindcss/typography":"0.5.16",
143144
"@testing-library/jest-dom":"6.6.3",
144145
"@testing-library/react":"14.3.1",
145146
"@testing-library/react-hooks":"8.0.1",

‎site/pnpm-lock.yaml‎

Lines changed: 36 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎site/src/modules/notifications/NotificationsInbox/InboxItem.stories.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ export const Markdown: Story = {
5353
notification:{
5454
...MockNotification,
5555
read_at:null,
56-
content:"Hello **world**!",
56+
content:
57+
"Template **Write Coder on Coder with AI** has failed to build 1/33 times over the last week.\n\n**Report:**\n\n**sweet_cannon7** failed 1 time:\n\n* [edward / coder-on-coder-claude / #34](https://dev.coder.com/@edward/coder-on-coder-claude/builds/34)\n\nWe recommend reviewing these issues to ensure future builds are successful.",
58+
actions:[
59+
{
60+
label:"View workspaces",
61+
url:"https://dev.coder.com/workspaces?filter=template%3Acoder-with-ai",
62+
},
63+
],
5764
},
5865
},
5966
};

‎site/src/modules/notifications/NotificationsInbox/InboxItem.tsx‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
importtype{InboxNotification}from"api/typesGenerated";
22
import{Avatar}from"components/Avatar/Avatar";
33
import{Button}from"components/Button/Button";
4+
import{Link}from"components/Link/Link";
45
import{SquareCheckBig}from"lucide-react";
56
importtype{FC}from"react";
67
importMarkdownfrom"react-markdown";
@@ -28,14 +29,16 @@ export const InboxItem: FC<InboxItemProps> = ({
2829
</div>
2930

3031
<divclassName="flex flex-col gap-3 flex-1">
31-
<span
32-
className={cn([
33-
"text-content-secondary text-sm font-medium whitespace-break-spaces [overflow-wrap:anywhere]",
34-
"[&_p]:m-0",
35-
])}
32+
<Markdown
33+
className="text-content-secondary prose-sm font-medium [overflow-wrap:anywhere]"
34+
components={{
35+
a:({ node, ...props})=>{
36+
return<Link{...props}/>;
37+
},
38+
}}
3639
>
37-
<Markdown>{notification.content}</Markdown>
38-
</span>
40+
{notification.content}
41+
</Markdown>
3942
<divclassName="flex items-center gap-1">
4043
{notification.actions.map((action)=>{
4144
return(

‎site/tailwind.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ module.exports = {
7575
},
7676
},
7777
},
78-
plugins:[require("tailwindcss-animate")],
78+
plugins:[require("tailwindcss-animate"),require("@tailwindcss/typography")],
7979
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp