Skip to content

Commit 97c603e

Browse files
SoullessCaatpolina.t
andauthored
front-fix-small-bugs (#15)
Co-authored-by: polina.t <polina.t@ati.su>
1 parent 002d29f commit 97c603e

File tree

4 files changed

+40
-19
lines changed

4 files changed

+40
-19
lines changed

frontend/src/components/Autosuggest/Autosuggest.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.dropdown {
2-
flex-grow: 1;
3-
}
4-
51
.dropdown-content.menu .user-option {
62
display: flex;
73
flex-direction: row;
@@ -18,7 +14,6 @@ ul.users-list {
1814
width: max-content;
1915
}
2016

21-
.clear-button.btn :active:not(.btn-active) {
17+
.clear-button.btn:active:not(.btn-active) {
2218
transform: none;
23-
translate: none;
2419
}

frontend/src/components/Autosuggest/Autosuggest.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const Autosuggest = ({ externalString, onSelect, autocompleteFn }: Props) => {
8888
/>
8989
{searchString && (
9090
<button
91-
className="clear-button btn btn-square btn-ghost bg-transparent hover:bg-transparent absolute right-1 top-1/2 transform -translate-y-1/2 shadow-none border-none"
91+
className="clear-button btn btn-square btn-ghost bg-transparent hover:bg-transparent absolute right-2 top-1 shadow-none border-none h-6 w-6"
9292
onClick={clearInput}
9393
aria-label="Очистить"
9494
>
@@ -98,18 +98,16 @@ const Autosuggest = ({ externalString, onSelect, autocompleteFn }: Props) => {
9898
{!!filteredItems?.length && (
9999
<ul
100100
tabIndex={0}
101-
className="users-list dropdown-content z-[2] menu p-2 shadow bg-base-200 rounded-box w-52 flex-nowrap overflow-auto"
101+
className="users-list dropdown-content z-[2] menu p-2 shadow bg-base-200 rounded-box w-52 flex-nowrap overflow-auto absolute left-1/2 -translate-x-1/2"
102102
>
103-
{filteredItems.map((user) => {
104-
return (
105-
<li key={user.id} className="user-option">
106-
<Avatar width={2} />
107-
<a onClick={(event) => handleItemClick(event, user)}>
108-
{user.display}
109-
</a>
110-
</li>
111-
);
112-
})}
103+
{filteredItems.map((user) => (
104+
<li key={user.id} className="user-option">
105+
<Avatar width={2} />
106+
<a onClick={(event) => handleItemClick(event, user)}>
107+
{user.display}
108+
</a>
109+
</li>
110+
))}
113111
</ul>
114112
)}
115113
</div>

frontend/src/components/Layout/Layout.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ main {
22
max-width: 1440px;
33
margin: 20px auto 60px;
44
}
5+
6+
@media (max-width: 1460px) {
7+
main {
8+
margin: 20px 10px 60px;
9+
}
10+
}

frontend/src/pages/Report/components/Bug/components/Chat/Chat.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ export const Chat = ({ reportId, bugId }: BugChatProps) => {
4646
}
4747
}, [newCommentText]);
4848

49+
const parseMessage = (text: string) => {
50+
const urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
51+
52+
return text.split(urlRegex).map((part, index) => {
53+
if (part.match(urlRegex)) {
54+
const href = part.startsWith("http") ? part : `https://${part}`;
55+
return (
56+
<a
57+
key={index}
58+
href={href}
59+
target="_blank"
60+
rel="noopener noreferrer"
61+
className="text-blue-500 underline"
62+
>
63+
{part}
64+
</a>
65+
);
66+
}
67+
return part; // Оставляем обычный текст
68+
});
69+
};
70+
4971
return (
5072
<div className="flex flex-col w-full h-full">
5173
<div className="flex-1 overflow-auto mb-4 space-y-2">
@@ -55,7 +77,7 @@ export const Chat = ({ reportId, bugId }: BugChatProps) => {
5577
className="border bg-base-100 border-gray-300 p-2 rounded flex flex-col"
5678
>
5779
<div className="font-semibold text-sm">{comment.creator?.name}</div>
58-
<div className="text-sm whitespace-pre-wrap">{comment.text}</div>
80+
<div className="text-sm whitespace-pre-wrap">{parseMessage(comment.text)}</div>
5981
</div>
6082
))}
6183
</div>

0 commit comments

Comments
 (0)