@buerokratt-ria/common-gui-components 0.0.28 → 0.0.30

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,14 @@ 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.30] - 10-11-2025
8
+
9
+ - Enhanced Markdownify
10
+
11
+ ## [0.0.29] - 03-11-2025
12
+
13
+ - Added Language to chats/ended/download
14
+
7
15
  ## [0.0.28] - 03-10-2025
8
16
 
9
17
  - Defined new endpoint specifically for ended chats. REACT_APP_RUUTER_PRIVATE_ENDED_API_URL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -921,7 +921,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
921
921
  );
922
922
 
923
923
  const response = await apiDevEnded.post('chats/ended/download', {
924
- headers, rows, chatIds
924
+ headers, rows, chatIds, language: i18n.language
925
925
  });
926
926
 
927
927
 
@@ -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
  );