From 7c0a5a3116e366055678421af489dbeb8f8dde3a Mon Sep 17 00:00:00 2001 From: Derock Date: Wed, 28 Sep 2022 21:06:18 -0400 Subject: [PATCH] feat: discord timestamp parsing --- package.json | 4 ++-- pnpm-lock.yaml | 18 +++++++++--------- src/generator/renderers/content.tsx | 4 ++++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 8ea4de4..3aae956 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,8 @@ "typescript": "^4.8.4" }, "dependencies": { - "@derockdev/discord-components-core": "^3.4.4", - "@derockdev/discord-components-react": "^3.4.2", + "@derockdev/discord-components-core": "^3.5.0", + "@derockdev/discord-components-react": "^3.5.0", "discord-markdown-parser": "~1.1.0", "html-minifier": "^4.0.0", "react": "^18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ee4c6e..4307b2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,8 +1,8 @@ lockfileVersion: 5.4 specifiers: - '@derockdev/discord-components-core': ^3.4.4 - '@derockdev/discord-components-react': ^3.4.2 + '@derockdev/discord-components-core': ^3.5.0 + '@derockdev/discord-components-react': ^3.5.0 '@types/node': ^18.7.23 '@types/react': ^18.0.21 '@types/react-dom': ^18.0.6 @@ -25,8 +25,8 @@ specifiers: undici: ^5.10.0 dependencies: - '@derockdev/discord-components-core': 3.4.4 - '@derockdev/discord-components-react': 3.4.2_biqbaboplfbrettd7655fr4n2y + '@derockdev/discord-components-core': 3.5.0 + '@derockdev/discord-components-react': 3.5.0_biqbaboplfbrettd7655fr4n2y discord-markdown-parser: 1.1.0 html-minifier: 4.0.0 react: 18.2.0 @@ -59,8 +59,8 @@ packages: '@jridgewell/trace-mapping': 0.3.9 dev: true - /@derockdev/discord-components-core/3.4.4: - resolution: {integrity: sha512-iQhs/rxRdopCKo8fZ+c0oo9g6QREGztulvygkIAEmQZ4Vjro0qRdSF9V9BjxYxqW7lETZayCxeSDBr2WDbCuUQ==} + /@derockdev/discord-components-core/3.5.0: + resolution: {integrity: sha512-r3xlWyLL/FAJcKnT4spNkru4UKkBxy6Ajw0QqvwARcuKIiTfFPuxBay1NX5PrSCYOHxrOaqzPSJ04PJ5dFFFJA==} engines: {node: '>=v14.0.0'} dependencies: '@stencil/core': 2.18.0 @@ -69,14 +69,14 @@ packages: highlight.js: 11.6.0 dev: false - /@derockdev/discord-components-react/3.4.2_biqbaboplfbrettd7655fr4n2y: - resolution: {integrity: sha512-/eUidKRQm/VtX9lr9CzGTUrkkGlz2I/B3Xw7qRmrRtmNLMmELPRp0elOXvHfgI6JXAeAyYSzLTw6EPKQAM4Npg==} + /@derockdev/discord-components-react/3.5.0_biqbaboplfbrettd7655fr4n2y: + resolution: {integrity: sha512-fxJ6UOijChZCzH0KHrSixqyFPyDE6X5xZWFeq6tbvZNHY5wat9q4ijPSwMUOHtxhTqtO2WmMvOVs0INI23GEcA==} engines: {node: '>=v14.0.0'} peerDependencies: react: 16.8.x || 17.x || 18.x react-dom: 16.8.x || 17.x || 18.x dependencies: - '@derockdev/discord-components-core': 3.4.4 + '@derockdev/discord-components-core': 3.5.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 tslib: 2.4.0 diff --git a/src/generator/renderers/content.tsx b/src/generator/renderers/content.tsx index 749fbc2..a80f69f 100644 --- a/src/generator/renderers/content.tsx +++ b/src/generator/renderers/content.tsx @@ -7,6 +7,7 @@ import { DiscordMention, DiscordQuote, DiscordSpoiler, + DiscordTime, DiscordUnderlined, } from '@derockdev/discord-components-react'; import parse, { type RuleTypesExtended } from 'discord-markdown-parser'; @@ -173,6 +174,9 @@ export async function renderASTNode(node: SingleASTNode, context: RenderContentC /> ); + case 'timestamp': + return ; + default: { console.log(`Unknown node type: ${type}`, node); return typeof node.content === 'string' ? node.content : await renderNodes(node.content, context);