@buerokratt-ria/common-gui-components 0.0.29 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ All changes to this project will be documented in this file.
4
4
 
5
5
  ## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
6
6
 
7
+ ## [0.0.32] - 19-11-2025
8
+
9
+ - Fixed isTest Mark.
10
+ - Fixed Columns Spacing in Firefox
11
+
12
+ ## [0.0.31] - 18-11-2025
13
+
14
+ - Added chat id to URL params in chats history page.
15
+
16
+ ## [0.0.30] - 10-11-2025
17
+
18
+ - Enhanced Markdownify
19
+
7
20
  ## [0.0.29] - 03-11-2025
8
21
 
9
22
  - Added Language to chats/ended/download
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.29",
3
+ "version": "0.0.32",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -565,31 +565,51 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
565
565
  </Tooltip>
566
566
  );
567
567
 
568
+ const updateChatTest = function (chatId: string, isTest: boolean) {
569
+ setFilteredEndedChatsList((prevChats) =>
570
+ prevChats.map((chat) => (chat.id === chatId ? ({ ...chat, istest: isTest } as ChatType) : chat))
571
+ );
572
+
573
+ if (selectedChat && selectedChat.id === chatId) {
574
+ setSelectedChat({
575
+ ...selectedChat,
576
+ istest: isTest,
577
+ } as ChatType);
578
+ }
579
+ };
580
+
568
581
  const markConversationAsTest = (props: any) => {
569
- return <>
570
- <FormCheckbox
571
- label={''}
572
- hideLabel
573
- emptyItem={true}
574
- name="active"
575
-
576
- item={{
577
- label: '',
578
- value: 'active',
579
- checked: props.getValue()
580
- }}
581
- onChange={(e) => {
582
- return chatTestChangeMutation.mutate({chatId: props.row.original.id, isTest: e.target.checked})
583
- }}
584
- />
585
- </>
586
- }
582
+ const chatId = props.row.original.id;
583
+ const newIsTestValue = props.getValue();
584
+ return (
585
+ <FormCheckbox
586
+ checked={newIsTestValue}
587
+ label={""}
588
+ hideLabel
589
+ emptyItem={true}
590
+ name="active"
591
+ item={{
592
+ label: "",
593
+ value: "active",
594
+ }}
595
+ onChange={(e) => {
596
+ const isTest = e.target.checked;
597
+ updateChatTest(chatId, isTest);
598
+ chatTestChangeMutation.mutate({ chatId, isTest });
599
+ }}
600
+ />
601
+ );
602
+ };
587
603
 
588
604
  const detailsView = (props: any) => (
589
605
  <Button
590
606
  appearance="text"
591
607
  onClick={() => {
592
608
  setSelectedChat(props.row.original);
609
+ setSearchParams((params) => {
610
+ params.set("chat", props.row.original.id);
611
+ return params;
612
+ });
593
613
  setChatState(props.row.original.lastMessageEvent);
594
614
  }}
595
615
  >
package/types/chat.ts CHANGED
@@ -87,6 +87,7 @@ export interface Chat {
87
87
  feedbackRating?: number;
88
88
  nps?: number;
89
89
  userDisplayName?: string;
90
+ istest?: boolean;
90
91
  }
91
92
  export interface GroupedChat {
92
93
  myChats: Chat[];
@@ -43,6 +43,25 @@ const LinkPreview: React.FC<{
43
43
 
44
44
  const hasSpecialFormat = (m: string) => m.includes("\n\n") && m.indexOf(".") > 0 && m.indexOf(":") > m.indexOf(".");
45
45
 
46
+ function formatMessage(message?: string): string {
47
+ if (!message) return "";
48
+
49
+ return message
50
+ .replace(/&#x([0-9A-Fa-f]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
51
+ .replace(/(^|\n)(\d{4})\.\s/g, (match, prefix, year) => {
52
+ const remainingText = message.substring(message.indexOf(match) + match.length);
53
+ const sentenceEnd = remainingText.indexOf("\n\n");
54
+ if (sentenceEnd !== -1) {
55
+ const currentSentence = remainingText.substring(0, sentenceEnd);
56
+ if (currentSentence.trim().endsWith(":")) {
57
+ return `${prefix}${year}. `;
58
+ }
59
+ }
60
+ return `${prefix}${year}\\. `;
61
+ })
62
+ .replace(/(?<=\n)\d+\.\s/g, hasSpecialFormat(message) ? "\n\n$&" : "$&");
63
+ }
64
+
46
65
  const Markdownify: React.FC<MarkdownifyProps> = ({ message, sanitizeLinks = false }) => (
47
66
  <div className={"reset"}>
48
67
  <Markdown
@@ -59,9 +78,7 @@ const Markdownify: React.FC<MarkdownifyProps> = ({ message, sanitizeLinks = fals
59
78
  disableParsingRawHTML: true,
60
79
  }}
61
80
  >
62
- {message
63
- ?.replace(/&#x([0-9A-Fa-f]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
64
- ?.replace(/(?<=\n)\d+\.\s/g, hasSpecialFormat(message) ? "\n\n$&" : "$&") ?? ""}
81
+ {formatMessage(message)}
65
82
  </Markdown>
66
83
  </div>
67
84
  );
@@ -34,7 +34,7 @@
34
34
  padding: 12px 24px 12px 16px;
35
35
  border-bottom: 1px solid get-color(black-coral-2);
36
36
  vertical-align: middle;
37
- max-width: fit-content;
37
+ max-width: 300px;
38
38
 
39
39
  p{
40
40
  white-space: break-spaces;