From ef1fee8f22686a3f1f84be94b07a2f9453e89fea Mon Sep 17 00:00:00 2001 From: Horacio Herrera Date: Tue, 25 Jun 2024 17:42:47 +0200 Subject: [PATCH] frontend: update desktop imports --- frontend/apps/desktop/src/app-account.tsx | 4 +- frontend/apps/desktop/src/app-api.ts | 10 +- frontend/apps/desktop/src/app-menu.ts | 2 +- frontend/apps/desktop/src/app-recents.ts | 2 +- frontend/apps/desktop/src/app-windows.ts | 10 +- frontend/apps/desktop/src/changes-list.tsx | 38 +++-- .../src/components/account-link-avatar.tsx | 20 +-- .../apps/desktop/src/components/app-error.tsx | 12 +- .../desktop/src/components/avatar-form.tsx | 16 +- .../src/components/citations-context.tsx | 6 +- .../apps/desktop/src/components/citations.tsx | 38 ++--- .../apps/desktop/src/components/comments.tsx | 31 ++-- .../src/components/commit-draft-button.tsx | 34 ++--- .../src/components/contacts-prompt.tsx | 2 +- .../src/components/delete-draft-dialog.tsx | 10 +- .../src/components/discard-draft-button.tsx | 12 +- .../src/components/edit-doc-button.tsx | 36 ++--- .../apps/desktop/src/components/editor.tsx | 18 +-- .../apps/desktop/src/components/error-bar.tsx | 6 +- .../apps/desktop/src/components/footer.tsx | 20 +-- .../apps/desktop/src/components/launcher.tsx | 46 +++--- .../desktop/src/components/network-dialog.tsx | 2 +- .../src/components/publication-list-item.tsx | 78 +++++----- .../src/components/publication-list.tsx | 40 ++--- .../desktop/src/components/sidebar-base.tsx | 66 ++++----- .../desktop/src/components/sidebar-neo.tsx | 93 ++++++------ .../apps/desktop/src/components/sidebar.tsx | 21 +-- .../src/components/titlebar-common.tsx | 81 +++++----- .../desktop/src/components/titlebar-title.tsx | 66 ++++----- .../src/components/titlebar-windows-linux.tsx | 15 +- .../apps/desktop/src/components/titlebar.tsx | 10 +- .../apps/desktop/src/components/variants.tsx | 65 ++++----- .../src/components/window-controls.tsx | 10 +- .../src/components/windows-linux-titlebar.tsx | 42 +++--- .../blocknote/core/BlockNoteExtensions.ts | 2 +- .../LinkMenu/defaultLinkMenuItems.tsx | 79 +++++----- .../editor/blocknote/react/BlockNoteTheme.ts | 2 +- .../editor/blocknote/react/BlockNoteView.tsx | 44 +++--- .../DefaultButtons/ColorStyleButton.tsx | 24 +-- .../DefaultButtons/CreateLinkButton.tsx | 8 +- .../DefaultButtons/NestBlockButtons.tsx | 14 +- .../DefaultButtons/TextAlignButton.tsx | 20 +-- .../DefaultButtons/ToggledStyleButton.tsx | 16 +- .../DefaultDropdowns/BlockTypeDropdown.tsx | 20 +-- .../components/DefaultFormattingToolbar.tsx | 10 +- .../FormattingToolbarPositioner.tsx | 8 +- .../components/HyperlinkToolbarPositioner.tsx | 8 +- .../LinkMenu/components/DefaultLinkMenu.tsx | 10 +- .../components/LinkMenuPositioner.tsx | 16 +- .../editor/blocknote/react/ReactBlockSpec.tsx | 12 +- .../DefaultButtons/AddBlockButton.tsx | 8 +- .../components/DefaultButtons/DragHandle.tsx | 12 +- .../SideMenu/components/DefaultSideMenu.tsx | 10 +- .../DefaultButtons/BlockColorsButton.tsx | 28 ++-- .../DefaultButtons/CopyLinkToBlockButton.tsx | 12 +- .../DefaultButtons/RemoveBlockButton.tsx | 12 +- .../DragHandleMenu/DefaultDragHandleMenu.tsx | 26 ++-- .../DragHandleMenu/DragHandleMenu.tsx | 14 +- .../components/SideMenuPositioner.tsx | 8 +- .../react/SlashMenu/ReactSlashMenuItem.ts | 2 +- .../SlashMenu/components/DefaultSlashMenu.tsx | 10 +- .../components/SlashMenuPositioner.tsx | 16 +- .../SlashMenu/defaultReactSlashMenuItems.tsx | 6 +- .../blocknote/react/hooks/useBlockNote.ts | 4 +- .../react/hooks/useEditorContentChange.ts | 5 +- .../react/hooks/useEditorSelectionChange.ts | 5 +- .../apps/desktop/src/editor/embed-block.tsx | 72 ++++----- .../src/editor/hypermedia-link-plugin.tsx | 18 +-- frontend/apps/desktop/src/editor/image.tsx | 38 ++--- .../desktop/src/editor/mentions-plugin.tsx | 20 +-- .../code-block-lowlight.tsx | 12 +- .../tiptap-extension-code-block/code-block.ts | 2 +- .../helpers/pasteHandler.ts | 8 +- frontend/apps/desktop/src/editor/video.tsx | 43 +++--- .../apps/desktop/src/editor/web-embed.tsx | 22 +-- frontend/apps/desktop/src/find-in-page.tsx | 10 +- frontend/apps/desktop/src/ipc.ts | 4 +- frontend/apps/desktop/src/main.ts | 2 +- frontend/apps/desktop/src/models/accounts.ts | 8 +- .../apps/desktop/src/models/app-settings.ts | 2 +- frontend/apps/desktop/src/models/comments.ts | 10 +- frontend/apps/desktop/src/models/daemon.ts | 2 +- frontend/apps/desktop/src/models/documents.ts | 22 +-- .../apps/desktop/src/models/experiments.ts | 2 +- frontend/apps/desktop/src/models/favorites.ts | 10 +- .../desktop/src/models/gateway-settings.ts | 2 +- .../apps/desktop/src/models/networking.ts | 2 +- frontend/apps/desktop/src/models/recents.ts | 2 +- frontend/apps/desktop/src/models/web-links.ts | 2 +- frontend/apps/desktop/src/open-url.ts | 9 +- .../src/pages/account-content-page.tsx | 23 ++- .../apps/desktop/src/pages/account-page.tsx | 138 +++++++++--------- frontend/apps/desktop/src/pages/blocknote.tsx | 4 +- .../apps/desktop/src/pages/comment-draft.tsx | 36 +++-- frontend/apps/desktop/src/pages/comment.tsx | 18 +-- .../apps/desktop/src/pages/contacts-page.tsx | 48 +++--- .../desktop/src/pages/deleted-content.tsx | 12 +- .../src/pages/document-placeholder.tsx | 4 +- frontend/apps/desktop/src/pages/document.tsx | 89 ++++++----- .../apps/desktop/src/pages/draft-rebase.tsx | 10 +- frontend/apps/desktop/src/pages/draft.tsx | 77 +++++----- frontend/apps/desktop/src/pages/explore.tsx | 8 +- frontend/apps/desktop/src/pages/favorites.tsx | 24 +-- frontend/apps/desktop/src/pages/feed.tsx | 101 +++++++------ .../apps/desktop/src/pages/find-in-page.tsx | 8 +- frontend/apps/desktop/src/pages/home.tsx | 4 +- frontend/apps/desktop/src/pages/main.tsx | 36 ++--- .../apps/desktop/src/pages/onboarding.tsx | 36 ++--- .../pages/publication-content-provider.tsx | 36 ++--- frontend/apps/desktop/src/pages/settings.tsx | 31 ++-- .../apps/desktop/src/preload-find-in-page.ts | 2 +- frontend/apps/desktop/src/preload.ts | 2 +- frontend/apps/desktop/src/query-client.ts | 4 +- frontend/apps/desktop/src/root.tsx | 44 +++--- .../src/utils/navigation-container.tsx | 2 +- frontend/apps/desktop/src/utils/open-draft.ts | 4 +- frontend/apps/desktop/tsconfig.json | 1 + 117 files changed, 1251 insertions(+), 1308 deletions(-) diff --git a/frontend/apps/desktop/src/app-account.tsx b/frontend/apps/desktop/src/app-account.tsx index 0b9bd2e51..efe58deb9 100644 --- a/frontend/apps/desktop/src/app-account.tsx +++ b/frontend/apps/desktop/src/app-account.tsx @@ -1,5 +1,5 @@ -import {DialogTitle} from '@shm/desktop/src/components/dialog' -import {queryKeys} from '@shm/desktop/src/models/query-keys' +import {DialogTitle} from '@/components/dialog' +import {queryKeys} from '@/models/query-keys' import {eventStream} from '@shm/shared' import { Button, diff --git a/frontend/apps/desktop/src/app-api.ts b/frontend/apps/desktop/src/app-api.ts index aa234bb4e..3d4c508b4 100644 --- a/frontend/apps/desktop/src/app-api.ts +++ b/frontend/apps/desktop/src/app-api.ts @@ -1,10 +1,6 @@ -import {resolveHmIdToAppRoute} from '@shm/desktop/src/utils/navigation' -import { - NavRoute, - defaultRoute, - navRouteSchema, -} from '@shm/desktop/src/utils/routes' -import type {AppWindowEvent} from '@shm/desktop/src/utils/window-events' +import {resolveHmIdToAppRoute} from '@/utils/navigation' +import {NavRoute, defaultRoute, navRouteSchema} from '@/utils/routes' +import type {AppWindowEvent} from '@/utils/window-events' import {API_GRPC_URL, API_HTTP_URL} from '@shm/shared/src/constants' import { diff --git a/frontend/apps/desktop/src/app-menu.ts b/frontend/apps/desktop/src/app-menu.ts index c6ccf6108..6ba717e5e 100644 --- a/frontend/apps/desktop/src/app-menu.ts +++ b/frontend/apps/desktop/src/app-menu.ts @@ -1,7 +1,7 @@ // this menu is visible on macOS only // the keyboard shortcuts apply to every platform -import {defaultRoute} from '@shm/desktop/src/utils/routes' +import {defaultRoute} from '@/utils/routes' import {Menu, MenuItem} from 'electron' import {dispatchFocusedWindowAppEvent, openRoute, trpc} from './app-api' diff --git a/frontend/apps/desktop/src/app-recents.ts b/frontend/apps/desktop/src/app-recents.ts index 0b5d1c803..b480b4ef1 100644 --- a/frontend/apps/desktop/src/app-recents.ts +++ b/frontend/apps/desktop/src/app-recents.ts @@ -1,4 +1,4 @@ -import {NavRoute, getRecentsRouteEntityUrl} from '@shm/desktop/src/utils/routes' +import {NavRoute, getRecentsRouteEntityUrl} from '@/utils/routes' import {getPublicationVariant} from '@shm/shared' import {z} from 'zod' import {grpcClient} from './app-grpc' diff --git a/frontend/apps/desktop/src/app-windows.ts b/frontend/apps/desktop/src/app-windows.ts index b60e4d2df..50e3fd150 100644 --- a/frontend/apps/desktop/src/app-windows.ts +++ b/frontend/apps/desktop/src/app-windows.ts @@ -1,8 +1,8 @@ -import appError from '@shm/desktop/src/errors' -import type {NavState} from '@shm/desktop/src/utils/navigation' -import {NavRoute, defaultRoute} from '@shm/desktop/src/utils/routes' -import type {AppWindowEvent} from '@shm/desktop/src/utils/window-events' -import {getRouteWindowType} from '@shm/desktop/src/utils/window-types' +import appError from '@/errors' +import type {NavState} from '@/utils/navigation' +import {NavRoute, defaultRoute} from '@/utils/routes' +import type {AppWindowEvent} from '@/utils/window-events' +import {getRouteWindowType} from '@/utils/window-types' import { BrowserView, BrowserWindow, diff --git a/frontend/apps/desktop/src/changes-list.tsx b/frontend/apps/desktop/src/changes-list.tsx index cf7ab5fbe..e5253858e 100644 --- a/frontend/apps/desktop/src/changes-list.tsx +++ b/frontend/apps/desktop/src/changes-list.tsx @@ -1,24 +1,21 @@ -import { AccessoryContainer } from '@shm/desktop/src/components/accessory-sidebar' -import { AccountLinkAvatar } from '@shm/desktop/src/components/account-link-avatar' -import { - MenuItemType, - OptionsDropdown, -} from '@shm/desktop/src/components/options-dropdown' -import { useAccount } from '@shm/desktop/src/models/accounts' -import { TimelineChange, useDocHistory } from '@shm/desktop/src/models/changes' -import { useGatewayUrl } from '@shm/desktop/src/models/gateway-settings' -import { useOpenUrl } from '@shm/desktop/src/open-url' -import { useNavRoute } from '@shm/desktop/src/utils/navigation' -import { NavRoute } from '@shm/desktop/src/utils/routes' -import { useNavigate } from '@shm/desktop/src/utils/useNavigate' +import {AccessoryContainer} from '@/components/accessory-sidebar' +import {AccountLinkAvatar} from '@/components/account-link-avatar' +import {MenuItemType, OptionsDropdown} from '@/components/options-dropdown' +import {useAccount} from '@/models/accounts' +import {TimelineChange, useDocHistory} from '@/models/changes' +import {useGatewayUrl} from '@/models/gateway-settings' +import {useOpenUrl} from '@/open-url' +import {useNavRoute} from '@/utils/navigation' +import {NavRoute} from '@/utils/routes' +import {useNavigate} from '@/utils/useNavigate' import { Change, createHmId, createPublicWebHmUrl, formattedDateLong, - unpackHmId + unpackHmId, } from '@shm/shared' -import { UnpackedHypermediaId } from '@shm/shared/src/utils/entity-id-url' +import {UnpackedHypermediaId} from '@shm/shared/src/utils/entity-id-url' import { ButtonText, Copy, @@ -26,9 +23,9 @@ import { Theme, XStack, YStack, - copyUrlToClipboardWithFeedback + copyUrlToClipboardWithFeedback, } from '@shm/ui' -import { ArrowUpRight } from '@tamagui/lucide-icons' +import {ArrowUpRight} from '@tamagui/lucide-icons' export function EntityVersionsAccessory({ id, @@ -87,7 +84,7 @@ function ChangeItem({ const navigate = useNavigate() const openAccount = (e) => { e.stopPropagation() - navigate({ key: 'account', accountId: change.author }) + navigate({key: 'account', accountId: change.author}) } const navRoute = useNavRoute() const isActive = new Set(activeVersion?.split('.') || []).has(change.id) @@ -98,8 +95,7 @@ function ChangeItem({ {change.createTime ? formattedDateLong(change.createTime) : null} ) - const variants = - navRoute.key === 'document' ? navRoute.variants : undefined + const variants = navRoute.key === 'document' ? navRoute.variants : undefined const topRow = shouldDisplayAuthorName ? ( @@ -122,7 +118,7 @@ function ChangeItem({ key: 'document', documentId: entityId, versionId: change.id, - accessory: { key: 'versions' }, + accessory: {key: 'versions'}, } } const parsedEntityId = unpackHmId(entityId) diff --git a/frontend/apps/desktop/src/components/account-link-avatar.tsx b/frontend/apps/desktop/src/components/account-link-avatar.tsx index 35adba312..53439ba76 100644 --- a/frontend/apps/desktop/src/components/account-link-avatar.tsx +++ b/frontend/apps/desktop/src/components/account-link-avatar.tsx @@ -1,11 +1,11 @@ -import { Avatar } from '@shm/desktop/src/components/avatar' -import appError from '@shm/desktop/src/errors' -import { useAccount } from '@shm/desktop/src/models/accounts' -import { useNavigate } from '@shm/desktop/src/utils/useNavigate' -import { Account } from '@shm/shared' -import { Button, FontSizeTokens, Tooltip, YStack } from '@shm/ui' -import { AlertCircle } from '@tamagui/lucide-icons' -import { getAvatarUrl } from '../utils/account-url' +import {Avatar} from '@/components/avatar' +import appError from '@/errors' +import {useAccount} from '@/models/accounts' +import {useNavigate} from '@/utils/useNavigate' +import {Account} from '@shm/shared' +import {Button, FontSizeTokens, Tooltip, YStack} from '@shm/ui' +import {AlertCircle} from '@tamagui/lucide-icons' +import {getAvatarUrl} from '../utils/account-url' export function ErrorDot() { return ( @@ -77,7 +77,7 @@ export function BaseAccountLinkAvatar({ className="no-window-drag" size="$1" backgroundColor="transparent" - hoverStyle={{ backgroundColor: 'transparent' }} + hoverStyle={{backgroundColor: 'transparent'}} minWidth={20} minHeight={20} padding={0} @@ -85,7 +85,7 @@ export function BaseAccountLinkAvatar({ e.preventDefault() e.stopPropagation() if (!accountId) return appError('No account ready to load') - navigate({ key: 'account', accountId }) + navigate({key: 'account', accountId}) }} position="relative" height={size} diff --git a/frontend/apps/desktop/src/components/app-error.tsx b/frontend/apps/desktop/src/components/app-error.tsx index d09d412cc..7aa89fd77 100644 --- a/frontend/apps/desktop/src/components/app-error.tsx +++ b/frontend/apps/desktop/src/components/app-error.tsx @@ -1,9 +1,9 @@ -import { useSidebarContext } from '@shm/desktop/src/sidebar-context' -import { Button, Heading, SizableText, XStack, YStack, useStream } from '@shm/ui' -import { FallbackProps } from 'react-error-boundary' -import { ErrorBar } from './error-bar' +import {useSidebarContext} from '@/sidebar-context' +import {Button, Heading, SizableText, XStack, YStack, useStream} from '@shm/ui' +import {FallbackProps} from 'react-error-boundary' +import {ErrorBar} from './error-bar' -export function AppErrorPage({ error, resetErrorBoundary }: FallbackProps) { +export function AppErrorPage({error, resetErrorBoundary}: FallbackProps) { const ctx = useSidebarContext() const isLocked = useStream(ctx.isLocked) return ( @@ -17,7 +17,7 @@ export function AppErrorPage({ error, resetErrorBoundary }: FallbackProps) { ) } -export function RootAppError({ error, resetErrorBoundary }: FallbackProps) { +export function RootAppError({error, resetErrorBoundary}: FallbackProps) { return ( { }) + .then(() => {}) .catch((error) => { - appError(`Failed to upload avatar: ${e.message}`, { error }) + appError(`Failed to upload avatar: ${e.message}`, {error}) }) .finally(() => { event.target.value = '' @@ -54,7 +54,7 @@ export function AvatarForm({ if (disabled) return avatarImage return ( - + versionChanges.has(changeId)) // .map(([changeId, change]) => change.author), // ) - let { data: account } = useAccount(pub.data?.document?.author) + let {data: account} = useAccount(pub.data?.document?.author) const docTextContent = useDocTextContent(pub.data) const destRoute: DocumentRoute = { @@ -89,10 +89,10 @@ function PublicationCitationItem({ mention }: { mention: Mention }) { ) } -function CommentCitationItem({ mention }: { mention: Mention }) { +function CommentCitationItem({mention}: {mention: Mention}) { const spawn = useNavigate('spawn') const unpackedSource = unpackHmId(mention.source) - const { data: comment } = useComment(unpackedSource?.id, { + const {data: comment} = useComment(unpackedSource?.id, { enabled: !!mention.source && !!unpackedSource, }) @@ -113,7 +113,7 @@ function CommentCitationItem({ mention }: { mention: Mention }) { }, ) - let { data: account } = useAccount(comment?.author) + let {data: account} = useAccount(comment?.author) // const docTextContent = useDocTextContent(pub.data) // const destRoute: DocumentRoute = { @@ -226,7 +226,7 @@ function CommentCitationItem({ mention }: { mention: Mention }) { ) } -export function DocCitationsAccessory({ docId }: { docId?: string }) { +export function DocCitationsAccessory({docId}: {docId?: string}) { const mentions = useEntityMentions(docId) if (!docId) return null const count = mentions.data?.mentions?.length || 0 @@ -267,7 +267,7 @@ export function DocCitationsAccessory({ docId }: { docId?: string }) { ) } -export function EntityCitationsAccessory({ entityId }: { entityId?: string }) { +export function EntityCitationsAccessory({entityId}: {entityId?: string}) { const mentions = useEntityMentions(entityId) if (!entityId) return null const count = mentions?.data?.mentions?.length || 0 diff --git a/frontend/apps/desktop/src/components/comments.tsx b/frontend/apps/desktop/src/components/comments.tsx index 9f1b2bf43..e04a53c60 100644 --- a/frontend/apps/desktop/src/components/comments.tsx +++ b/frontend/apps/desktop/src/components/comments.tsx @@ -1,4 +1,4 @@ -import { trpc } from '@shm/desktop/src/trpc' +import {trpc} from '@/trpc' import { API_FILE_URL, BlockRange, @@ -30,21 +30,21 @@ import { Pencil, Reply, } from '@tamagui/lucide-icons' -import { YStack } from 'tamagui' -import { useAppContext } from '../app-context' -import { useAccount } from '../models/accounts' -import type { CommentGroup } from '../models/comments' +import {YStack} from 'tamagui' +import {useAppContext} from '../app-context' +import {useAccount} from '../models/accounts' +import type {CommentGroup} from '../models/comments' import { useCommentReplies, useCreateComment, usePublicationCommentGroups, } from '../models/comments' -import { usePublication } from '../models/documents' -import { AppPublicationContentProvider } from '../pages/publication-content-provider' -import { useNavigate } from '../utils/useNavigate' -import { AccessoryContainer } from './accessory-sidebar' -import { MenuItemType, OptionsDropdown } from './options-dropdown' -import { WindowsLinuxWindowControls } from './window-controls' +import {usePublication} from '../models/documents' +import {AppPublicationContentProvider} from '../pages/publication-content-provider' +import {useNavigate} from '../utils/useNavigate' +import {AccessoryContainer} from './accessory-sidebar' +import {MenuItemType, OptionsDropdown} from './options-dropdown' +import {WindowsLinuxWindowControls} from './window-controls' export function CommentGroup({ group, @@ -136,8 +136,9 @@ export function CommentGroup({ }} icon={MessageSquare} > - {`${group.moreCommentsCount}${group.comments.length > 1 ? ' More' : '' - } Replies`} + {`${group.moreCommentsCount}${ + group.comments.length > 1 ? ' More' : '' + } Replies`} ) : ( @@ -445,7 +446,7 @@ export function NavigationButtons() { ) : null} @@ -493,8 +493,8 @@ function EmbedControl({ }, }, ]} - enterStyle={{ y: -10, opacity: 0 }} - exitStyle={{ y: -10, opacity: 0 }} + enterStyle={{y: -10, opacity: 0}} + exitStyle={{y: -10, opacity: 0}} elevate={true} > @@ -506,7 +506,7 @@ function EmbedControl({ handleBlockToDocument() }} title="Convert to Document Embed" - // icon={item.icon} + // icon={item.icon} /> ) : null} @@ -520,8 +520,8 @@ function EmbedControl({ const EmbedSideAnnotation = forwardRef< HTMLDivElement, - { hmId: string; sidePos: 'bottom' | 'right' } ->(function EmbedSideAnnotation({ hmId, sidePos }, ref) { + {hmId: string; sidePos: 'bottom' | 'right'} +>(function EmbedSideAnnotation({hmId, sidePos}, ref) { const unpacked = unpackHmId(hmId) if (unpacked && unpacked.type != 'd') return null const pub = usePublication({ @@ -534,11 +534,11 @@ const EmbedSideAnnotation = forwardRef< const sideStyles: YStackProps = sidePos == 'right' ? { - position: 'absolute', - top: 32, - right: -16, - transform: 'translateX(100%)', - } + position: 'absolute', + top: 32, + right: -16, + transform: 'translateX(100%)', + } : {} return ( diff --git a/frontend/apps/desktop/src/editor/hypermedia-link-plugin.tsx b/frontend/apps/desktop/src/editor/hypermedia-link-plugin.tsx index 2a85a1883..8cde3a5c6 100644 --- a/frontend/apps/desktop/src/editor/hypermedia-link-plugin.tsx +++ b/frontend/apps/desktop/src/editor/hypermedia-link-plugin.tsx @@ -1,8 +1,8 @@ -import { fetchWebLink } from '@shm/desktop/src/models/web-links' -import { AppQueryClient } from '@shm/desktop/src/query-client' -import { extractBlockRefOfUrl, hmIdWithVersion } from '@shm/shared' -import { EditorView } from '@tiptap/pm/view' -import { Plugin, PluginKey } from 'prosemirror-state' +import {fetchWebLink} from '@/models/web-links' +import {AppQueryClient} from '@/query-client' +import {extractBlockRefOfUrl, hmIdWithVersion} from '@shm/shared' +import {EditorView} from '@tiptap/pm/view' +import {Plugin, PluginKey} from 'prosemirror-state' export const hypermediaPluginKey = new PluginKey('hypermedia-link') @@ -69,10 +69,10 @@ async function checkHyperLink( entry: [key: string, value: string], ): Promise< | { - documentId: string - versionId?: string - blockId?: string - } + documentId: string + versionId?: string + blockId?: string + } | undefined > { let [id, entryUrl] = entry diff --git a/frontend/apps/desktop/src/editor/image.tsx b/frontend/apps/desktop/src/editor/image.tsx index e0f73dcb6..7fd0f1f07 100644 --- a/frontend/apps/desktop/src/editor/image.tsx +++ b/frontend/apps/desktop/src/editor/image.tsx @@ -1,17 +1,17 @@ -import { isValidUrl, timeoutPromise } from '@shm/desktop/src/editor/utils' -import { getCIDFromIPFSUrl, usePublicationContentContext } from '@shm/shared' -import { ResizeHandle, useTheme } from '@shm/ui' -import { useEffect, useState } from 'react' -import { RiImage2Line } from 'react-icons/ri' +import {isValidUrl, timeoutPromise} from '@/editor/utils' +import {getCIDFromIPFSUrl, usePublicationContentContext} from '@shm/shared' +import {ResizeHandle, useTheme} from '@shm/ui' +import {useEffect, useState} from 'react' +import {RiImage2Line} from 'react-icons/ri' import { Block, BlockNoteEditor, createReactBlockSpec, defaultProps, } from './blocknote' -import { MediaContainer } from './media-container' -import { DisplayComponentProps, MediaRender, MediaType } from './media-render' -import { HMBlockSchema } from './schema' +import {MediaContainer} from './media-container' +import {DisplayComponentProps, MediaRender, MediaType} from './media-render' +import {HMBlockSchema} from './schema' export const ImageBlock = createReactBlockSpec({ type: 'image', @@ -48,7 +48,7 @@ export const ImageBlock = createReactBlockSpec({ { tag: 'img[src]', getAttrs: (element) => { - return { src: element.getAttribute('src'), width: element.style.width } + return {src: element.getAttribute('src'), width: element.style.width} }, node: 'image', }, @@ -60,7 +60,7 @@ const Render = ( editor: BlockNoteEditor, ) => { const theme = useTheme() - const { importWebFile } = usePublicationContentContext() + const {importWebFile} = usePublicationContentContext() const submitImage = ( url: string, @@ -84,7 +84,7 @@ const Render = ( }) return } - assign({ props: { url: `ipfs://${imageData.cid}` } } as MediaType) + assign({props: {url: `ipfs://${imageData.cid}`}} as MediaType) setLoading(false) } else { let imgTypeSplit = imageData.type.split('/') @@ -102,7 +102,7 @@ const Render = ( }) setLoading(false) }) - } else setFileName({ name: 'The provided URL is invalid.', color: 'red' }) + } else setFileName({name: 'The provided URL is invalid.', color: 'red'}) const cursorPosition = editor.getTextCursorPosition() editor.focus() @@ -111,7 +111,7 @@ const Render = ( editor.setTextCursorPosition(cursorPosition.nextBlock, 'start') else { editor.insertBlocks( - [{ type: 'paragraph', content: '' }], + [{type: 'paragraph', content: ''}], block.id, 'after', ) @@ -141,7 +141,7 @@ const display = ({ setSelected, assign, }: DisplayComponentProps) => { - const { ipfsBlobPrefix } = usePublicationContentContext() + const {ipfsBlobPrefix} = usePublicationContentContext() const imageUrl = block.props.url.includes('.') ? null : `${ipfsBlobPrefix}${getCIDFromIPFSUrl(block.props.url)}` @@ -154,10 +154,10 @@ const display = ({ const [showHandle, setShowHandle] = useState(false) let resizeParams: | { - handleUsed: 'left' | 'right' - initialWidth: number - initialClientX: number - } + handleUsed: 'left' | 'right' + initialWidth: number + initialClientX: number + } | undefined useEffect(() => { @@ -295,7 +295,7 @@ const display = ({ )} {imageUrl && ( {block.props.name { @@ -52,7 +52,7 @@ export function createInlineEmbedNode(bnEditor: any) { getAttrs: (dom) => { if (dom instanceof HTMLElement) { var value = dom.getAttribute('data-inline-embed') - return { ref: value } + return {ref: value} } return false }, @@ -85,7 +85,7 @@ function InlineEmbedNodeComponent(props: any) { ) } -export function MentionToken(props: { value: string; selected?: boolean }) { +export function MentionToken(props: {value: string; selected?: boolean}) { const unpackedRef = unpackHmId(props.value) if (unpackedRef?.type == 'a') { diff --git a/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block-lowlight.tsx b/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block-lowlight.tsx index 0c5f7406f..f2eec0e07 100644 --- a/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block-lowlight.tsx +++ b/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block-lowlight.tsx @@ -1,14 +1,14 @@ -import styles from '@shm/desktop/src/editor/blocknote/core/extensions/Blocks/nodes/Block.module.css' +import styles from '@/editor/blocknote/core/extensions/Blocks/nodes/Block.module.css' import { NodeViewProps, NodeViewWrapper, ReactNodeViewRenderer, } from '@tiptap/react' -import { FC } from 'react' -import { mergeCSSClasses } from '..' -import { CodeBlock, CodeBlockOptions } from './code-block' -import { CodeBlockView } from './code-block-view' -import { LowlightPlugin } from './lowlight-plugin.js' +import {FC} from 'react' +import {mergeCSSClasses} from '..' +import {CodeBlock, CodeBlockOptions} from './code-block' +import {CodeBlockView} from './code-block-view' +import {LowlightPlugin} from './lowlight-plugin.js' export interface CodeBlockLowlightOptions extends CodeBlockOptions { lowlight: any diff --git a/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block.ts b/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block.ts index f1a946b2d..99a5f39dc 100644 --- a/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block.ts +++ b/frontend/apps/desktop/src/editor/tiptap-extension-code-block/code-block.ts @@ -1,4 +1,4 @@ -import styles from '@shm/desktop/src/editor/blocknote/core/extensions/Blocks/nodes/Block.module.css' +import styles from '@/editor/blocknote/core/extensions/Blocks/nodes/Block.module.css' import { Editor, mergeAttributes, diff --git a/frontend/apps/desktop/src/editor/tiptap-extension-link/helpers/pasteHandler.ts b/frontend/apps/desktop/src/editor/tiptap-extension-link/helpers/pasteHandler.ts index f82a08057..d4685b72a 100644 --- a/frontend/apps/desktop/src/editor/tiptap-extension-link/helpers/pasteHandler.ts +++ b/frontend/apps/desktop/src/editor/tiptap-extension-link/helpers/pasteHandler.ts @@ -1,7 +1,7 @@ -import {getLinkMenuItems} from '@shm/desktop/src/editor/blocknote/core' -import {linkMenuPluginKey} from '@shm/desktop/src/editor/blocknote/core/extensions/LinkMenu/LinkMenuPlugin' -import {fetchWebLink} from '@shm/desktop/src/models/web-links' -import type {AppQueryClient} from '@shm/desktop/src/query-client' +import {getLinkMenuItems} from '@/editor/blocknote/core' +import {linkMenuPluginKey} from '@/editor/blocknote/core/extensions/LinkMenu/LinkMenuPlugin' +import {fetchWebLink} from '@/models/web-links' +import type {AppQueryClient} from '@/query-client' import { GRPCClient, StateStream, diff --git a/frontend/apps/desktop/src/editor/video.tsx b/frontend/apps/desktop/src/editor/video.tsx index c124901c6..8f810387c 100644 --- a/frontend/apps/desktop/src/editor/video.tsx +++ b/frontend/apps/desktop/src/editor/video.tsx @@ -1,17 +1,17 @@ -import { isValidUrl, youtubeParser } from '@shm/desktop/src/editor/utils' -import { API_FILE_URL } from '@shm/shared' -import { ResizeHandle, SizableText, XStack, useTheme } from '@shm/ui' -import { useEffect, useState } from 'react' -import { RiVideoAddLine } from 'react-icons/ri' +import {isValidUrl, youtubeParser} from '@/editor/utils' +import {API_FILE_URL} from '@shm/shared' +import {ResizeHandle, SizableText, XStack, useTheme} from '@shm/ui' +import {useEffect, useState} from 'react' +import {RiVideoAddLine} from 'react-icons/ri' import { Block, BlockNoteEditor, createReactBlockSpec, defaultProps, } from './blocknote' -import { MediaContainer } from './media-container' -import { DisplayComponentProps, MediaRender, MediaType } from './media-render' -import { HMBlockSchema } from './schema' +import {MediaContainer} from './media-container' +import {DisplayComponentProps, MediaRender, MediaType} from './media-render' +import {HMBlockSchema} from './schema' export const getSourceType = (name: string) => { const nameArray = name.split('.') @@ -55,13 +55,13 @@ export const VideoBlock = createReactBlockSpec({ { tag: 'video[src]', getAttrs: (element) => { - return { src: element.getAttribute('src') } + return {src: element.getAttribute('src')} }, }, { tag: 'iframe', getAttrs: (element) => { - return { src: element.getAttribute('src') } + return {src: element.getAttribute('src')} }, }, ], @@ -80,19 +80,20 @@ const Render = ( if (ytId) { embedUrl = embedUrl + ytId } else { - setFileName({ name: `Unsupported Youtube Url:${url}`, color: 'red' }) + setFileName({name: `Unsupported Youtube Url:${url}`, color: 'red'}) return } } else if (url.includes('vimeo')) { const urlArray = url.split('/') - embedUrl = `https://player.vimeo.com/video/${urlArray[urlArray.length - 1] - }` + embedUrl = `https://player.vimeo.com/video/${ + urlArray[urlArray.length - 1] + }` } else { - setFileName({ name: 'Unsupported video source.', color: 'red' }) + setFileName({name: 'Unsupported video source.', color: 'red'}) return } - assign({ props: { url: embedUrl } } as MediaType) - } else setFileName({ name: 'The provided URL is invalid.', color: 'red' }) + assign({props: {url: embedUrl}} as MediaType) + } else setFileName({name: 'The provided URL is invalid.', color: 'red'}) const cursorPosition = editor.getTextCursorPosition() editor.focus() if (cursorPosition.block.id === block.id) { @@ -100,7 +101,7 @@ const Render = ( editor.setTextCursorPosition(cursorPosition.nextBlock, 'start') else { editor.insertBlocks( - [{ type: 'paragraph', content: '' }], + [{type: 'paragraph', content: ''}], block.id, 'after', ) @@ -140,10 +141,10 @@ const display = ({ const [showHandle, setShowHandle] = useState(false) let resizeParams: | { - handleUsed: 'left' | 'right' - initialWidth: number - initialClientX: number - } + handleUsed: 'left' | 'right' + initialWidth: number + initialClientX: number + } | undefined useEffect(() => { diff --git a/frontend/apps/desktop/src/editor/web-embed.tsx b/frontend/apps/desktop/src/editor/web-embed.tsx index 5a69af5c3..26ee32f1d 100644 --- a/frontend/apps/desktop/src/editor/web-embed.tsx +++ b/frontend/apps/desktop/src/editor/web-embed.tsx @@ -1,7 +1,7 @@ -import { isValidUrl } from '@shm/desktop/src/editor/utils' -import { useOpenUrl } from '@shm/desktop/src/open-url' -import { TwitterXIcon, XPostNotFound, XPostSkeleton, useTheme } from '@shm/ui' -import { Fragment } from '@tiptap/pm/model' +import {isValidUrl} from '@/editor/utils' +import {useOpenUrl} from '@/open-url' +import {TwitterXIcon, XPostNotFound, XPostSkeleton, useTheme} from '@shm/ui' +import {Fragment} from '@tiptap/pm/model' import { QuotedTweet, TweetBody, @@ -18,9 +18,9 @@ import { createReactBlockSpec, defaultProps, } from './blocknote' -import { MediaContainer } from './media-container' -import { DisplayComponentProps, MediaRender, MediaType } from './media-render' -import { HMBlockSchema } from './schema' +import {MediaContainer} from './media-container' +import {DisplayComponentProps, MediaRender, MediaType} from './media-render' +import {HMBlockSchema} from './schema' export const WebEmbed = createReactBlockSpec({ type: 'web-embed', @@ -64,7 +64,7 @@ const Render = ( const submitTwitterLink = (url: string, assign: any, setFileName: any) => { if (isValidUrl(url)) { if (url.includes('twitter') || url.includes('x.com')) { - assign({ props: { url: url } } as MediaType) + assign({props: {url: url}} as MediaType) } else { setFileName({ name: `The provided URL is not a twitter URL`, @@ -72,7 +72,7 @@ const Render = ( }) return } - } else setFileName({ name: 'The provided URL is invalid.', color: 'red' }) + } else setFileName({name: 'The provided URL is invalid.', color: 'red'}) const cursorPosition = editor.getTextCursorPosition() editor.focus() if (cursorPosition.block.id === block.id) { @@ -80,7 +80,7 @@ const Render = ( editor.setTextCursorPosition(cursorPosition.nextBlock, 'start') else { editor.insertBlocks( - [{ type: 'paragraph', content: '' }], + [{type: 'paragraph', content: ''}], block.id, 'after', ) @@ -112,7 +112,7 @@ const display = ({ }: DisplayComponentProps) => { const urlArray = block.props.url.split('/') const xPostId = urlArray[urlArray.length - 1].split('?')[0] - const { data, error, isLoading } = useTweet(xPostId) + const {data, error, isLoading} = useTweet(xPostId) const openUrl = useOpenUrl() let xPostContent diff --git a/frontend/apps/desktop/src/find-in-page.tsx b/frontend/apps/desktop/src/find-in-page.tsx index cf7265165..1008e9698 100644 --- a/frontend/apps/desktop/src/find-in-page.tsx +++ b/frontend/apps/desktop/src/find-in-page.tsx @@ -1,12 +1,12 @@ -import { StyleProvider } from '@shm/desktop/src/app-context-provider' -import { useStream } from '@shm/ui' +import {StyleProvider} from '@/app-context-provider' +import {useStream} from '@shm/ui' import '@tamagui/core/reset.css' import '@tamagui/font-inter/css/400.css' import '@tamagui/font-inter/css/700.css' -import React, { useMemo } from 'react' +import React, {useMemo} from 'react' import ReactDOM from 'react-dom/client' -import { createIPC } from './ipc' -import { FindInPage } from './pages/find-in-page' +import {createIPC} from './ipc' +import {FindInPage} from './pages/find-in-page' function FindInPageView() { const ipc = useMemo(() => createIPC(), []) diff --git a/frontend/apps/desktop/src/ipc.ts b/frontend/apps/desktop/src/ipc.ts index 750843010..37271cabe 100644 --- a/frontend/apps/desktop/src/ipc.ts +++ b/frontend/apps/desktop/src/ipc.ts @@ -1,6 +1,6 @@ -import {AppIPC} from '@shm/desktop/src/app-ipc' +import {AppIPC} from '@/app-ipc' -import {decodeRouteFromPath} from '@shm/desktop/src/utils/route-encoding' +import {decodeRouteFromPath} from '@/utils/route-encoding' import {client} from './trpc' export function createIPC(): AppIPC { diff --git a/frontend/apps/desktop/src/main.ts b/frontend/apps/desktop/src/main.ts index 61cf08a84..aa2c5c52d 100644 --- a/frontend/apps/desktop/src/main.ts +++ b/frontend/apps/desktop/src/main.ts @@ -1,5 +1,5 @@ +import {defaultRoute} from '@/utils/routes' import * as Sentry from '@sentry/electron/main' -import {defaultRoute} from '@shm/desktop/src/utils/routes' import {ELECTRON_HTTP_PORT, IS_PROD_DESKTOP} from '@shm/shared' import { BrowserWindow, diff --git a/frontend/apps/desktop/src/models/accounts.ts b/frontend/apps/desktop/src/models/accounts.ts index 4e0439861..6003195fa 100644 --- a/frontend/apps/desktop/src/models/accounts.ts +++ b/frontend/apps/desktop/src/models/accounts.ts @@ -1,8 +1,8 @@ +import {useGRPCClient, useQueryInvalidator} from '@/app-context' +import appError from '@/errors' +import {useDaemonInfo} from '@/models/daemon' +import {queryKeys} from '@/models/query-keys' import {ConnectError} from '@connectrpc/connect' -import {useGRPCClient, useQueryInvalidator} from '@shm/desktop/src/app-context' -import appError from '@shm/desktop/src/errors' -import {useDaemonInfo} from '@shm/desktop/src/models/daemon' -import {queryKeys} from '@shm/desktop/src/models/query-keys' import {GRPCClient, HMAccount, Profile, hmAccount} from '@shm/shared' import { UseMutationOptions, diff --git a/frontend/apps/desktop/src/models/app-settings.ts b/frontend/apps/desktop/src/models/app-settings.ts index faf6e6664..99b1849d1 100644 --- a/frontend/apps/desktop/src/models/app-settings.ts +++ b/frontend/apps/desktop/src/models/app-settings.ts @@ -1,4 +1,4 @@ -import {trpc} from '@shm/desktop/src/trpc' +import {trpc} from '@/trpc' import {toast} from '@shm/ui' import {useQueryInvalidator} from '../app-context' diff --git a/frontend/apps/desktop/src/models/comments.ts b/frontend/apps/desktop/src/models/comments.ts index d43f07331..b3d42e617 100644 --- a/frontend/apps/desktop/src/models/comments.ts +++ b/frontend/apps/desktop/src/models/comments.ts @@ -1,8 +1,8 @@ -import {useAppContext} from '@shm/desktop/src/app-context' -import {createHypermediaDocLinkPlugin} from '@shm/desktop/src/editor' -import {useOpenUrl} from '@shm/desktop/src/open-url' -import {slashMenuItems} from '@shm/desktop/src/slash-menu-items' -import {client, trpc} from '@shm/desktop/src/trpc' +import {useAppContext} from '@/app-context' +import {createHypermediaDocLinkPlugin} from '@/editor' +import {useOpenUrl} from '@/open-url' +import {slashMenuItems} from '@/slash-menu-items' +import {client, trpc} from '@/trpc' import { HMComment, HMCommentDraft, diff --git a/frontend/apps/desktop/src/models/daemon.ts b/frontend/apps/desktop/src/models/daemon.ts index da47467a6..264410820 100644 --- a/frontend/apps/desktop/src/models/daemon.ts +++ b/frontend/apps/desktop/src/models/daemon.ts @@ -1,4 +1,4 @@ -import {useGRPCClient} from '@shm/desktop/src/app-context' +import {useGRPCClient} from '@/app-context' import {useQuery} from '@tanstack/react-query' import {queryKeys} from './query-keys' diff --git a/frontend/apps/desktop/src/models/documents.ts b/frontend/apps/desktop/src/models/documents.ts index c267240a0..8b5716b00 100644 --- a/frontend/apps/desktop/src/models/documents.ts +++ b/frontend/apps/desktop/src/models/documents.ts @@ -1,19 +1,11 @@ +import {useAppContext, useGRPCClient, useQueryInvalidator} from '@/app-context' +import {createHypermediaDocLinkPlugin} from '@/editor' +import {useAccounts, useAllAccounts, useMyAccount} from '@/models/accounts' +import {queryKeys} from '@/models/query-keys' +import {useOpenUrl} from '@/open-url' +import {slashMenuItems} from '@/slash-menu-items' +import {trpc} from '@/trpc' import {Timestamp, toPlainMessage} from '@bufbuild/protobuf' -import { - useAppContext, - useGRPCClient, - useQueryInvalidator, -} from '@shm/desktop/src/app-context' -import {createHypermediaDocLinkPlugin} from '@shm/desktop/src/editor' -import { - useAccounts, - useAllAccounts, - useMyAccount, -} from '@shm/desktop/src/models/accounts' -import {queryKeys} from '@shm/desktop/src/models/query-keys' -import {useOpenUrl} from '@shm/desktop/src/open-url' -import {slashMenuItems} from '@shm/desktop/src/slash-menu-items' -import {trpc} from '@shm/desktop/src/trpc' import { Document, DocumentChange, diff --git a/frontend/apps/desktop/src/models/experiments.ts b/frontend/apps/desktop/src/models/experiments.ts index 22c63f8e1..bae40a3bc 100644 --- a/frontend/apps/desktop/src/models/experiments.ts +++ b/frontend/apps/desktop/src/models/experiments.ts @@ -1,4 +1,4 @@ -import {trpc} from '@shm/desktop/src/trpc' +import {trpc} from '@/trpc' import {toast} from '@shm/ui' import {useQueryInvalidator} from '../app-context' diff --git a/frontend/apps/desktop/src/models/favorites.ts b/frontend/apps/desktop/src/models/favorites.ts index d01289f31..b7e8e9e9e 100644 --- a/frontend/apps/desktop/src/models/favorites.ts +++ b/frontend/apps/desktop/src/models/favorites.ts @@ -1,8 +1,8 @@ -import { trpc } from '@shm/desktop/src/trpc' -import { HMAccount, UnpackedHypermediaId, unpackHmId } from '@shm/shared' -import { useMemo } from 'react' -import { useQueryInvalidator } from '../app-context' -import { useAccounts } from './accounts' +import {trpc} from '@/trpc' +import {HMAccount, UnpackedHypermediaId, unpackHmId} from '@shm/shared' +import {useMemo} from 'react' +import {useQueryInvalidator} from '../app-context' +import {useAccounts} from './accounts' export type FavoriteItem = | { diff --git a/frontend/apps/desktop/src/models/gateway-settings.ts b/frontend/apps/desktop/src/models/gateway-settings.ts index 80c75e221..cc20098df 100644 --- a/frontend/apps/desktop/src/models/gateway-settings.ts +++ b/frontend/apps/desktop/src/models/gateway-settings.ts @@ -1,4 +1,4 @@ -import {trpc} from '@shm/desktop/src/trpc' +import {trpc} from '@/trpc' import { HYPERMEDIA_PUBLIC_WEB_GATEWAY, StateStream, diff --git a/frontend/apps/desktop/src/models/networking.ts b/frontend/apps/desktop/src/models/networking.ts index f3d459290..c4a87485b 100644 --- a/frontend/apps/desktop/src/models/networking.ts +++ b/frontend/apps/desktop/src/models/networking.ts @@ -1,5 +1,5 @@ +import appError from '@/errors' import {ConnectError} from '@connectrpc/connect' -import appError from '@shm/desktop/src/errors' import {ConnectionStatus, GRPCClient, PeerInfo} from '@shm/shared' import { FetchQueryOptions, diff --git a/frontend/apps/desktop/src/models/recents.ts b/frontend/apps/desktop/src/models/recents.ts index 4f2da0d6b..37e824e14 100644 --- a/frontend/apps/desktop/src/models/recents.ts +++ b/frontend/apps/desktop/src/models/recents.ts @@ -1,4 +1,4 @@ -import {trpc} from '@shm/desktop/src/trpc' +import {trpc} from '@/trpc' import {useQueryInvalidator} from '../app-context' import {useNavRoute} from '../utils/navigation' import {getRecentsRouteEntityUrl} from '../utils/routes' diff --git a/frontend/apps/desktop/src/models/web-links.ts b/frontend/apps/desktop/src/models/web-links.ts index 009af721f..0bfd21e60 100644 --- a/frontend/apps/desktop/src/models/web-links.ts +++ b/frontend/apps/desktop/src/models/web-links.ts @@ -1,4 +1,4 @@ -import type {AppQueryClient} from '@shm/desktop/src/query-client' +import type {AppQueryClient} from '@/query-client' import {parseFragment} from '@shm/shared' import {useQuery} from '@tanstack/react-query' import {useEffect, useRef, useState} from 'react' diff --git a/frontend/apps/desktop/src/open-url.ts b/frontend/apps/desktop/src/open-url.ts index 611203d90..8fbccee23 100644 --- a/frontend/apps/desktop/src/open-url.ts +++ b/frontend/apps/desktop/src/open-url.ts @@ -1,9 +1,6 @@ -import {useAppContext} from '@shm/desktop/src/app-context' -import { - isHttpUrl, - useHmIdToAppRouteResolver, -} from '@shm/desktop/src/utils/navigation' -import {useNavigate} from '@shm/desktop/src/utils/useNavigate' +import {useAppContext} from '@/app-context' +import {isHttpUrl, useHmIdToAppRouteResolver} from '@/utils/navigation' +import {useNavigate} from '@/utils/useNavigate' import {toast} from '@shm/ui' import {useMemo} from 'react' diff --git a/frontend/apps/desktop/src/pages/account-content-page.tsx b/frontend/apps/desktop/src/pages/account-content-page.tsx index 53bb9c8f2..8733cbb18 100644 --- a/frontend/apps/desktop/src/pages/account-content-page.tsx +++ b/frontend/apps/desktop/src/pages/account-content-page.tsx @@ -1,18 +1,18 @@ -import { useCopyGatewayReference } from '@shm/desktop/src/components/copy-gateway-reference' -import { copyLinkMenuItem } from '@shm/desktop/src/components/list-item' -import { PublicationListItem } from '@shm/desktop/src/components/publication-list-item' -import { useAllAccounts } from '@shm/desktop/src/models/accounts' -import { useAccountPublications } from '@shm/desktop/src/models/documents' -import { Profile, unpackDocId } from '@shm/shared' -import { List } from '@shm/ui' -import { useMemo } from 'react' +import {useCopyGatewayReference} from '@/components/copy-gateway-reference' +import {copyLinkMenuItem} from '@/components/list-item' +import {PublicationListItem} from '@/components/publication-list-item' +import {useAllAccounts} from '@/models/accounts' +import {useAccountPublications} from '@/models/documents' +import {Profile, unpackDocId} from '@shm/shared' +import {List} from '@shm/ui' +import {useMemo} from 'react' export function getAccountName(profile: Profile | undefined) { if (!profile) return '' return profile.alias || 'Untitled Account' } -export function AccountPublications({ accountId }: { accountId: string }) { +export function AccountPublications({accountId}: {accountId: string}) { const list = useAccountPublications(accountId) const accounts = useAllAccounts() const data = useMemo(() => { @@ -48,8 +48,8 @@ export function AccountPublications({ accountId }: { accountId: string }) { { - const { publication, author, editors } = item + renderItem={({item}) => { + const {publication, author, editors} = item const docId = publication.document?.id if (!docId) return null return ( @@ -82,4 +82,3 @@ export function AccountPublications({ accountId }: { accountId: string }) { ) } - diff --git a/frontend/apps/desktop/src/pages/account-page.tsx b/frontend/apps/desktop/src/pages/account-page.tsx index badbf760f..346c42344 100644 --- a/frontend/apps/desktop/src/pages/account-page.tsx +++ b/frontend/apps/desktop/src/pages/account-page.tsx @@ -1,25 +1,25 @@ -import { AccessoryLayout } from '@shm/desktop/src/components/accessory-sidebar' -import { Avatar } from '@shm/desktop/src/components/avatar' -import { useCopyGatewayReference } from '@shm/desktop/src/components/copy-gateway-reference' -import { useDeleteDialog } from '@shm/desktop/src/components/delete-dialog' -import { FavoriteButton } from '@shm/desktop/src/components/favoriting' -import Footer, { FooterButton } from '@shm/desktop/src/components/footer' -import { OnlineIndicator } from '@shm/desktop/src/components/indicator' -import { ListItem, copyLinkMenuItem } from '@shm/desktop/src/components/list-item' -import { MainWrapperNoScroll } from '@shm/desktop/src/components/main-wrapper' -import { PublicationListItem } from '@shm/desktop/src/components/publication-list-item' -import { useAccount, useMyAccount } from '@shm/desktop/src/models/accounts' -import { useAccountWithDevices } from '@shm/desktop/src/models/contacts' -import { useEntityMentions } from '@shm/desktop/src/models/content-graph' +import {AccessoryLayout} from '@/components/accessory-sidebar' +import {Avatar} from '@/components/avatar' +import {useCopyGatewayReference} from '@/components/copy-gateway-reference' +import {useDeleteDialog} from '@/components/delete-dialog' +import {FavoriteButton} from '@/components/favoriting' +import Footer, {FooterButton} from '@/components/footer' +import {OnlineIndicator} from '@/components/indicator' +import {ListItem, copyLinkMenuItem} from '@/components/list-item' +import {MainWrapperNoScroll} from '@/components/main-wrapper' +import {PublicationListItem} from '@/components/publication-list-item' +import {useAccount, useMyAccount} from '@/models/accounts' +import {useAccountWithDevices} from '@/models/contacts' +import {useEntityMentions} from '@/models/content-graph' import { useAccountPublicationFullList, useDraftList, usePublication, -} from '@shm/desktop/src/models/documents' -import { useResourceFeedWithLatest } from '@shm/desktop/src/models/feed' -import { getAvatarUrl } from '@shm/desktop/src/utils/account-url' -import { useNavRoute } from '@shm/desktop/src/utils/navigation' -import { useNavigate } from '@shm/desktop/src/utils/useNavigate' +} from '@/models/documents' +import {useResourceFeedWithLatest} from '@/models/feed' +import {getAvatarUrl} from '@/utils/account-url' +import {useNavRoute} from '@/utils/navigation' +import {useNavigate} from '@/utils/useNavigate' import { Event, HMAccount, @@ -33,7 +33,7 @@ import { hmId, pluralS, pluralizer, - unpackDocId + unpackDocId, } from '@shm/shared' import { AlertDialog, @@ -54,14 +54,14 @@ import { copyTextToClipboard, toast, } from '@shm/ui' -import { PageContainer } from '@shm/ui/src/container' -import { Trash } from '@tamagui/lucide-icons' -import React, { ReactNode, useMemo } from 'react' -import { VirtuosoHandle } from 'react-virtuoso' -import { EntityCitationsAccessory } from '../components/citations' -import { CopyReferenceButton } from '../components/titlebar-common' -import { FeedItem, FeedPageFooter, NewUpdatesButton } from './feed' -import { AppPublicationContentProvider } from './publication-content-provider' +import {PageContainer} from '@shm/ui/src/container' +import {Trash} from '@tamagui/lucide-icons' +import React, {ReactNode, useMemo} from 'react' +import {VirtuosoHandle} from 'react-virtuoso' +import {EntityCitationsAccessory} from '../components/citations' +import {CopyReferenceButton} from '../components/titlebar-common' +import {FeedItem, FeedPageFooter, NewUpdatesButton} from './feed' +import {AppPublicationContentProvider} from './publication-content-provider' function DeviceRow({ isOnline, @@ -122,8 +122,8 @@ export default function AccountPage() { icon={BlockQuote} onPress={() => { if (route.accessory?.key === 'citations') - return replace({ ...route, accessory: null }) - replace({ ...route, accessory: { key: 'citations' } }) + return replace({...route, accessory: null}) + replace({...route, accessory: {key: 'citations'}}) }} /> ) : null} @@ -140,10 +140,10 @@ function MainAccountPage() { const account = useAccountWithDevices(accountId) const myAccount = useMyAccount() const isMe = myAccount.data?.id === accountId - const { data: documents } = useAccountPublicationFullList( + const {data: documents} = useAccountPublicationFullList( route.tab === 'documents' ? accountId : undefined, ) - const { data: drafts } = useDraftList({}) + const {data: drafts} = useDraftList({}) const allDocs = useMemo(() => { if (route.tab !== 'documents') return [] const allPubIds = new Set() @@ -151,12 +151,12 @@ function MainAccountPage() { const docs = documents.map((d) => { if (d.publication?.document?.id) allPubIds.add(d.publication?.document?.id) - return { key: 'document', ...d } + return {key: 'document', ...d} }) if (!isMe) return docs const newDrafts = drafts.documents .filter((d) => !allPubIds.has(d.id)) - .map((d) => ({ key: 'draft', document: d })) + .map((d) => ({key: 'draft', document: d})) return [...newDrafts, ...docs] }, [isMe, route.tab, drafts, documents]) const [copyDialogContent, onCopyId] = useCopyGatewayReference() @@ -166,15 +166,15 @@ function MainAccountPage() { | 'profile' | Event | { - key: 'document' - publication: HMPublication - author: HMAccount | undefined - editors: (HMAccount | undefined)[] - } + key: 'document' + publication: HMPublication + author: HMAccount | undefined + editors: (HMAccount | undefined)[] + } | { - key: 'draft' - document: HMDocument - } + key: 'draft' + document: HMDocument + } > = ['profile'] const feed = useResourceFeedWithLatest( route.tab === 'activity' ? hmId('a', accountId).qid : undefined, @@ -184,7 +184,7 @@ function MainAccountPage() { } else if (route.tab === 'activity') { items = feed.data || [] } - const { content: deleteDialog, open: openDelete } = useDeleteDialog() + const {content: deleteDialog, open: openDelete} = useDeleteDialog() const navigate = useNavigate() return ( <> @@ -198,7 +198,7 @@ function MainAccountPage() { onEndReached={() => { if (route.tab === 'activity') feed.fetchNextPage() }} - renderItem={({ item }) => { + renderItem={({item}) => { if (item === 'profile') { return } @@ -255,7 +255,7 @@ function MainAccountPage() { theme="yellow" backgroundColor="$color3" accessory={ - } @@ -270,7 +270,7 @@ function MainAccountPage() { {route.tab === 'activity' && feed.hasNewItems && ( { - scrollRef.current?.scrollTo({ top: 0 }) + scrollRef.current?.scrollTo({top: 0}) feed.refetch() }} /> @@ -333,15 +333,15 @@ function AccountPageHeader() { {isMe ? 'My Devices' : isConnected - ? 'Connected' - : 'Offline'} + ? 'Connected' + : 'Offline'} { - replace({ ...route, tab }) + replace({...route, tab}) }} /> @@ -398,7 +398,7 @@ function AccountPageHeader() { ) } -function ProfileDoc({ }: {}) { +function ProfileDoc({}: {}) { const route = useNavRoute() const accountRoute = route.key === 'account' ? route : undefined if (!accountRoute) throw new Error('Invalid route, no account id') @@ -417,28 +417,28 @@ function ProfileDoc({ }: {}) { const pubDataWithHeading = pub.data?.document?.title && - account.data?.profile?.alias !== pub.data?.document?.title + account.data?.profile?.alias !== pub.data?.document?.title ? { - ...pub.data, - document: { - ...pub.data.document, - children: [ - { - block: { - type: 'heading', - text: pub.data.document.title, + ...pub.data, + document: { + ...pub.data.document, + children: [ + { + block: { + type: 'heading', + text: pub.data.document.title, + }, + children: pub.data.document.children, }, - children: pub.data.document.children, - }, - ], - }, - } + ], + }, + } : pub.data return pub.status == 'success' && pub.data ? ( diff --git a/frontend/apps/desktop/src/pages/document-placeholder.tsx b/frontend/apps/desktop/src/pages/document-placeholder.tsx index 52bd9b06a..be5bcc145 100644 --- a/frontend/apps/desktop/src/pages/document-placeholder.tsx +++ b/frontend/apps/desktop/src/pages/document-placeholder.tsx @@ -1,5 +1,5 @@ -import { Placeholder } from '@shm/desktop/src/components/placeholder-box' -import { YStack } from '@shm/ui' +import {Placeholder} from '@/components/placeholder-box' +import {YStack} from '@shm/ui' export function DocumentPlaceholder() { return ( diff --git a/frontend/apps/desktop/src/pages/document.tsx b/frontend/apps/desktop/src/pages/document.tsx index 0245efb18..9909761d8 100644 --- a/frontend/apps/desktop/src/pages/document.tsx +++ b/frontend/apps/desktop/src/pages/document.tsx @@ -1,21 +1,21 @@ -import { EntityVersionsAccessory } from '@shm/desktop/src/changes-list' -import { AccessoryLayout } from '@shm/desktop/src/components/accessory-sidebar' -import { BaseAccountLinkAvatar } from '@shm/desktop/src/components/account-link-avatar' -import { CitationsProvider } from '@shm/desktop/src/components/citations-context' -import { EntityCommentsAccessory } from '@shm/desktop/src/components/comments' -import { PushToGatewayDialog } from '@shm/desktop/src/components/copy-gateway-reference' -import { useAppDialog } from '@shm/desktop/src/components/dialog' -import { FavoriteButton } from '@shm/desktop/src/components/favoriting' -import Footer, { FooterButton } from '@shm/desktop/src/components/footer' -import { MainWrapper } from '@shm/desktop/src/components/main-wrapper' -import { useAccounts } from '@shm/desktop/src/models/accounts' -import { useDocHistory } from '@shm/desktop/src/models/changes' -import { useAllPublicationComments, useCreateComment } from '@shm/desktop/src/models/comments' -import { useEntityMentions } from '@shm/desktop/src/models/content-graph' -import { useGatewayHost } from '@shm/desktop/src/models/gateway-settings' -import { usePublicationVariant } from '@shm/desktop/src/models/publication' -import { useNavRoute } from '@shm/desktop/src/utils/navigation' -import { useNavigate } from '@shm/desktop/src/utils/useNavigate' +import {EntityVersionsAccessory} from '@/changes-list' +import {AccessoryLayout} from '@/components/accessory-sidebar' +import {BaseAccountLinkAvatar} from '@/components/account-link-avatar' +import {CitationsProvider} from '@/components/citations-context' +import {EntityCommentsAccessory} from '@/components/comments' +import {PushToGatewayDialog} from '@/components/copy-gateway-reference' +import {useAppDialog} from '@/components/dialog' +import {FavoriteButton} from '@/components/favoriting' +import Footer, {FooterButton} from '@/components/footer' +import {MainWrapper} from '@/components/main-wrapper' +import {useAccounts} from '@/models/accounts' +import {useDocHistory} from '@/models/changes' +import {useAllPublicationComments, useCreateComment} from '@/models/comments' +import {useEntityMentions} from '@/models/content-graph' +import {useGatewayHost} from '@/models/gateway-settings' +import {usePublicationVariant} from '@/models/publication' +import {useNavRoute} from '@/utils/navigation' +import {useNavigate} from '@/utils/useNavigate' import { Document, PublicationContent, @@ -32,17 +32,17 @@ import { SizableText, Text, XStack, - YStack + YStack, } from '@shm/ui' -import { History, MessageSquare } from '@tamagui/lucide-icons' +import {History, MessageSquare} from '@tamagui/lucide-icons' import 'allotment/dist/style.css' -import { ReactNode, useEffect, useRef } from 'react' -import { ErrorBoundary } from 'react-error-boundary' -import { AppErrorPage } from '../components/app-error' -import { EntityCitationsAccessory } from '../components/citations' -import { CopyReferenceButton } from '../components/titlebar-common' -import { getAccountName } from './account-page' -import { AppPublicationContentProvider } from './publication-content-provider' +import {ReactNode, useEffect, useRef} from 'react' +import {ErrorBoundary} from 'react-error-boundary' +import {AppErrorPage} from '../components/app-error' +import {EntityCitationsAccessory} from '../components/citations' +import {CopyReferenceButton} from '../components/titlebar-common' +import {getAccountName} from './account-page' +import {AppPublicationContentProvider} from './publication-content-provider' export default function PublicationPage() { const route = useNavRoute() @@ -72,7 +72,7 @@ export default function PublicationPage() { const pushToGatewayDialog = useAppDialog(PushToGatewayDialog, { onClose: () => { if (route.immediatelyPromptPush) { - replace({ ...route, immediatelyPromptPush: false }) + replace({...route, immediatelyPromptPush: false}) } }, }) @@ -124,7 +124,7 @@ export default function PublicationPage() { documentId={docId} onCitationsOpen={() => { // todo, pass active citations into route - replace({ ...route, accessory: { key: 'citations' } }) + replace({...route, accessory: {key: 'citations'}}) }} > @@ -139,11 +139,11 @@ export default function PublicationPage() { citations={mentions.data?.mentions} onCitationClick={() => { if (route.accessory?.key === 'citations') - return replace({ ...route, accessory: null }) - replace({ ...route, accessory: { key: 'citations' } }) + return replace({...route, accessory: null}) + replace({...route, accessory: {key: 'citations'}}) }} onBlockComment={(blockId, blockRange) => { - replace({ ...route, accessory: { key: 'comments' } }) + replace({...route, accessory: {key: 'comments'}}) const version = publication.data?.publication?.version if (!id) throw new Error('invalid doc id') if (!version) @@ -164,14 +164,11 @@ export default function PublicationPage() { right={ {id && ( - + )} @@ -217,8 +214,8 @@ export default function PublicationPage() { icon={BlockQuote} onPress={() => { if (route.accessory?.key === 'citations') - return replace({ ...route, accessory: null }) - replace({ ...route, accessory: { key: 'citations' } }) + return replace({...route, accessory: null}) + replace({...route, accessory: {key: 'citations'}}) }} /> ) : null} @@ -259,8 +256,8 @@ function PublicationCommentaryButton() { active={accessoryKey === 'comments'} onPress={() => { if (route.accessory?.key === 'comments') - return replace({ ...route, accessory: null }) - replace({ ...route, accessory: { key: 'comments' } }) + return replace({...route, accessory: null}) + replace({...route, accessory: {key: 'comments'}}) }} /> ) @@ -286,14 +283,14 @@ function DocumentVersionsFooterButton({ icon={History} onPress={() => { if (route.accessory?.key === 'versions') - return replace({ ...route, accessory: null }) - replace({ ...route, accessory: { key: 'versions' } }) + return replace({...route, accessory: null}) + replace({...route, accessory: {key: 'versions'}}) }} /> ) } -function DocumentPageMeta({ document }: { document: Document }) { +function DocumentPageMeta({document}: {document: Document}) { const editors = useAccounts(document.document?.editors || []) const navigate = useNavigate() @@ -342,7 +339,7 @@ function DocumentPageMeta({ document }: { document: Document }) { key={account.id} fontWeight={'bold'} onPress={() => { - navigate({ key: 'account', accountId: account.id }) + navigate({key: 'account', accountId: account.id}) }} hoverStyle={{ textDecorationLine: 'underline', diff --git a/frontend/apps/desktop/src/pages/draft-rebase.tsx b/frontend/apps/desktop/src/pages/draft-rebase.tsx index 6e9c5cc74..eb21cbd0e 100644 --- a/frontend/apps/desktop/src/pages/draft-rebase.tsx +++ b/frontend/apps/desktop/src/pages/draft-rebase.tsx @@ -1,8 +1,8 @@ -import { BlockNoteEditor } from '@shm/desktop/src/editor' -import { YStack } from '@shm/ui' -import { useMemo, useState } from 'react' -import { HyperMediaEditorView } from 'src/components/editor' -import { AppPublicationContentProvider } from './publication-content-provider' +import {BlockNoteEditor} from '@/editor' +import {YStack} from '@shm/ui' +import {useMemo, useState} from 'react' +import {HyperMediaEditorView} from 'src/components/editor' +import {AppPublicationContentProvider} from './publication-content-provider' export default function DraftRebase() { // const [state, send, actor] = useDraftRebase() diff --git a/frontend/apps/desktop/src/pages/draft.tsx b/frontend/apps/desktop/src/pages/draft.tsx index 523db5113..3c4403c3e 100644 --- a/frontend/apps/desktop/src/pages/draft.tsx +++ b/frontend/apps/desktop/src/pages/draft.tsx @@ -1,31 +1,28 @@ -import { useGRPCClient } from '@shm/desktop/src/app-context' -import Footer from '@shm/desktop/src/components/footer' -import { MainWrapper } from '@shm/desktop/src/components/main-wrapper' -import { subscribeDraftFocus } from '@shm/desktop/src/draft-focusing' -import { - BlockNoteEditor, - getBlockInfoFromPos, -} from '@shm/desktop/src/editor' -import { useMyAccount } from '@shm/desktop/src/models/accounts' +import {useGRPCClient} from '@/app-context' +import Footer from '@/components/footer' +import {MainWrapper} from '@/components/main-wrapper' +import {subscribeDraftFocus} from '@/draft-focusing' +import {BlockNoteEditor, getBlockInfoFromPos} from '@/editor' +import {useMyAccount} from '@/models/accounts' import { compareDraftWithMap, createBlocksMap, extractDeletes, useDraftEditor, -} from '@shm/desktop/src/models/documents' -import { DraftStatusContext, draftMachine } from '@shm/desktop/src/models/draft-machine' -import { useHasDevTools } from '@shm/desktop/src/models/experiments' -import { useGatewayUrl } from '@shm/desktop/src/models/gateway-settings' -import { trpc } from '@shm/desktop/src/trpc' +} from '@/models/documents' +import {DraftStatusContext, draftMachine} from '@/models/draft-machine' +import {useHasDevTools} from '@/models/experiments' +import {useGatewayUrl} from '@/models/gateway-settings' +import {trpc} from '@/trpc' import { chromiumSupportedImageMimeTypes, chromiumSupportedVideoMimeTypes, generateBlockId, handleDragMedia, -} from '@shm/desktop/src/utils/media-drag' -import { useNavRoute } from '@shm/desktop/src/utils/navigation' -import { useOpenDraft } from '@shm/desktop/src/utils/open-draft' -import { DraftRoute } from '@shm/desktop/src/utils/routes' +} from '@/utils/media-drag' +import {useNavRoute} from '@/utils/navigation' +import {useOpenDraft} from '@/utils/open-draft' +import {DraftRoute} from '@/utils/routes' import { BlockRange, ExpandedBlockRange, @@ -50,12 +47,12 @@ import { copyUrlToClipboardWithFeedback, useStream, } from '@shm/ui' -import { useSelector } from '@xstate/react' -import { useEffect, useRef, useState } from 'react' -import { ErrorBoundary, FallbackProps } from 'react-error-boundary' -import { HMEditorContainer, HyperMediaEditorView } from 'src/components/editor' -import { ActorRefFrom } from 'xstate' -import { AppPublicationContentProvider } from './publication-content-provider' +import {useSelector} from '@xstate/react' +import {useEffect, useRef, useState} from 'react' +import {ErrorBoundary, FallbackProps} from 'react-error-boundary' +import {HMEditorContainer, HyperMediaEditorView} from 'src/components/editor' +import {ActorRefFrom} from 'xstate' +import {AppPublicationContentProvider} from './publication-content-provider' export default function DraftPage() { let route = useNavRoute() @@ -120,7 +117,7 @@ export default function DraftPage() { const result = data.draft?.children ? compareDraftWithMap({}, data.draft.children, '') - : { changes: [], touchedBlocks: [] } + : {changes: [], touchedBlocks: []} const deletedBlocks = extractDeletes(prevBlocksMap, result.touchedBlocks) try { @@ -225,7 +222,7 @@ export default function DraftPage() { return handleDragMedia(file).then((props) => { if (!props) return false - const { state } = ttEditor.view + const {state} = ttEditor.view let blockNode const newId = generateBlockId() @@ -265,13 +262,13 @@ export default function DraftPage() { ) if (index === 0) { - ; (data.editor as BlockNoteEditor).insertBlocks( + ;(data.editor as BlockNoteEditor).insertBlocks( [blockNode], blockInfo.id, blockInfo.node.textContent ? 'after' : 'before', ) } else { - ; (data.editor as BlockNoteEditor).insertBlocks( + ;(data.editor as BlockNoteEditor).insertBlocks( [blockNode], lastId, 'after', @@ -379,7 +376,7 @@ export default function DraftPage() { }} importWebFile={importWebFile} > - {data.state.matches({ ready: 'saveError' }) ? ( + {data.state.matches({ready: 'saveError'}) ? ( data.send({ type: 'RESTORE.DRAFT' })} + onPress={() => data.send({type: 'RESTORE.DRAFT'})} $sm={{ alignSelf: 'stretch', }} @@ -451,7 +448,7 @@ export default function DraftPage() { alignSelf: 'stretch', }} size="$2" - onPress={() => data.send({ type: 'RESET.DRAFT' })} + onPress={() => data.send({type: 'RESET.DRAFT'})} > Reset to the initial state @@ -465,7 +462,7 @@ export default function DraftPage() { onPress={(e) => { e.stopPropagation() }} - // style={{border: '1px solid green'}} + // style={{border: '1px solid green'}} > {data.state.context.draft && - data.editor && - data.editor.topLevelBlocks.length ? ( + data.editor && + data.editor.topLevelBlocks.length ? ( ) : null} @@ -535,7 +532,7 @@ export default function DraftPage() { {debugValue && ( - + {JSON.stringify(editorValue, null, 2)} )} @@ -723,7 +720,7 @@ function DraftError({ documentId, error, resetErrorBoundary, -}: FallbackProps & { documentId: string }) { +}: FallbackProps & {documentId: string}) { return ( ) -} \ No newline at end of file +} diff --git a/frontend/apps/desktop/src/pages/favorites.tsx b/frontend/apps/desktop/src/pages/favorites.tsx index 0a8707a31..014dabd12 100644 --- a/frontend/apps/desktop/src/pages/favorites.tsx +++ b/frontend/apps/desktop/src/pages/favorites.tsx @@ -1,14 +1,14 @@ -import { useCopyGatewayReference } from '@shm/desktop/src/components/copy-gateway-reference' -import Footer from '@shm/desktop/src/components/footer' -import { copyLinkMenuItem } from '@shm/desktop/src/components/list-item' -import { MainWrapperNoScroll } from '@shm/desktop/src/components/main-wrapper' -import { PublicationListItem } from '@shm/desktop/src/components/publication-list-item' -import { useAllAccounts } from '@shm/desktop/src/models/accounts' -import { usePublication } from '@shm/desktop/src/models/documents' -import { FavoriteItem, useFavorites } from '@shm/desktop/src/models/favorites' -import { HMAccount, UnpackedHypermediaId } from '@shm/shared' -import { List } from '@shm/ui' -import { ContactItem } from './contacts-page' +import {useCopyGatewayReference} from '@/components/copy-gateway-reference' +import Footer from '@/components/footer' +import {copyLinkMenuItem} from '@/components/list-item' +import {MainWrapperNoScroll} from '@/components/main-wrapper' +import {PublicationListItem} from '@/components/publication-list-item' +import {useAllAccounts} from '@/models/accounts' +import {usePublication} from '@/models/documents' +import {FavoriteItem, useFavorites} from '@/models/favorites' +import {HMAccount, UnpackedHypermediaId} from '@shm/shared' +import {List} from '@shm/ui' +import {ContactItem} from './contacts-page' export default function FavoritesPage() { const favorites = useFavorites() @@ -25,7 +25,7 @@ export default function FavoritesPage() { onEndReached={() => { // publications.fetchNextPage() }} - renderItem={({ item }) => { + renderItem={({item}) => { return ( {props.children} @@ -110,13 +110,13 @@ function FeedItemContainer({ onPress={ linkId ? () => { - const route = appRouteOfId(linkId) - if (route) { - navigate(route) - } else { - toast.error('Failed to resolve a route for this') + const route = appRouteOfId(linkId) + if (route) { + navigate(route) + } else { + toast.error('Failed to resolve a route for this') + } } - } : undefined } > @@ -162,7 +162,7 @@ function EntityLink({ const navigate = useNavigate('push') return ( { e.stopPropagation() @@ -211,7 +211,7 @@ function FeedItemHeader({ } label={account.data?.profile?.alias || account.data?.id} onPress={() => { - navigate({ key: 'account', accountId: author }) + navigate({key: 'account', accountId: author}) }} /> @@ -247,12 +247,12 @@ function FeedItemPublicationContent({ ) } -function FeedItemCommentContent({ comment }: { comment: HMComment }) { +function FeedItemCommentContent({comment}: {comment: HMComment}) { return ( ) { +}: PropsWithChildren<{to: UnpackedHypermediaId}>) { const navigate = useNavigate('push') return (