From e2334fe450e290da50470c56001758760d0dda87 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Tue, 17 Oct 2023 12:09:30 +0200 Subject: [PATCH] Minor fixes --- dev | 1 + .../[entityId]/[versionId]/media.png.tsx | 17 ++++++++--------- .../packages/shared/src/client/to-hm-block.ts | 6 +++--- scripts/cleanup-frontend.sh | 3 ++- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dev b/dev index b2cd5013af..0bcb510b26 100755 --- a/dev +++ b/dev @@ -78,6 +78,7 @@ def main(): def run_desktop(args): run("./scripts/cleanup-desktop.sh") run("yarn install") + run("yarn workspace @mintter/ui generate") run("plz build //backend:mintterd //:yarn") return run("yarn desktop", args=args) diff --git a/frontend/apps/site/pages/api/content-image/[entityType]/[entityId]/[versionId]/media.png.tsx b/frontend/apps/site/pages/api/content-image/[entityType]/[entityId]/[versionId]/media.png.tsx index e784219f58..fb06d8f02d 100644 --- a/frontend/apps/site/pages/api/content-image/[entityType]/[entityId]/[versionId]/media.png.tsx +++ b/frontend/apps/site/pages/api/content-image/[entityType]/[entityId]/[versionId]/media.png.tsx @@ -6,20 +6,19 @@ import {readFileSync} from 'fs' import {join} from 'path' import {serverHelpers} from 'server/ssr-helpers' import {OG_IMAGE_SIZE} from 'server/content-image-meta' -import { - HMBlockChildrenType, - InlineContent, - createHmId, - serverBlockToEditorInline, -} from '@mintter/shared' import { HMAccount, HMBlock, + HMBlockChildrenType, HMBlockNode, HMGroup, HMPublication, -} from 'server/json-hm' + createHmId, + toHMInlineContent, +} from '@mintter/shared' + import {ReactElement} from 'react' +import {InlineContent} from '@mintter/editor' function loadFont(fileName: string) { const path = join(process.cwd(), 'font', fileName) @@ -69,7 +68,7 @@ function ParagraphBlockDisplay({ block: HMBlock childrenType: HMBlockChildrenType }) { - const inlineContent = serverBlockToEditorInline(block) + const inlineContent = toHMInlineContent(block) return (
{ - const linkAnnotations = block.annotations.filter((a) => a.type === 'link') - if (!linkAnnotations.length) { + const linkAnnotations = block.annotations?.filter((a) => a.type === 'link') + if (!linkAnnotations?.length) { return partialBlockToStyledText(block) } if ( @@ -130,7 +130,7 @@ export function partialBlockToStyledText({ const inlines: HMStyles[] = [] const allStyleKeys = new Set() - annotations.forEach((annotation) => { + annotations?.forEach((annotation) => { const {starts, ends} = annotation const annotationStyles = annotationStyle(annotation) Object.keys(annotationStyles).forEach((key) => allStyleKeys.add(key)) diff --git a/scripts/cleanup-frontend.sh b/scripts/cleanup-frontend.sh index 8bf9f65c0f..2c48fd395c 100755 --- a/scripts/cleanup-frontend.sh +++ b/scripts/cleanup-frontend.sh @@ -1,3 +1,4 @@ rm yarn.lock \; 2>/dev/null || true find . -type d -name "node_modules" -exec rm -r {} \; 2>/dev/null || true -find . -type d -name ".tamagui" -exec rm -r {} \; 2>/dev/null || true \ No newline at end of file +find . -type d -name ".tamagui" -exec rm -r {} \; 2>/dev/null || true +rm frontend/packages/ui/src/themes-generated.ts \ No newline at end of file