diff --git a/pkg/interface/src/logic/api/graph.ts b/pkg/interface/src/logic/api/graph.ts index 95ca69ac2f..12fffce3a7 100644 --- a/pkg/interface/src/logic/api/graph.ts +++ b/pkg/interface/src/logic/api/graph.ts @@ -1,4 +1,5 @@ import { Content, Enc, GraphNode, GroupPolicy, Path, Patp, Post, Resource } from '@urbit/api'; +import BigIntOrderedMap from '@urbit/api/lib/BigIntOrderedMap'; import _ from 'lodash'; import { decToUd, deSig, resourceAsPath, unixToDa } from '~/logic/lib/util'; import { makeResource, resourceFromPath } from '../lib/group'; @@ -9,7 +10,7 @@ export const createBlankNodeWithChildPost = ( parentIndex = '', childIndex = '', contents: Content[] -) => { +): GraphNode => { const date = unixToDa(Date.now()).toString(); const nodeIndex = parentIndex + '/' + date; @@ -35,7 +36,7 @@ export const createBlankNodeWithChildPost = ( hash: null, signatures: [] }, - children: childGraph + children: childGraph as BigIntOrderedMap }; }; diff --git a/pkg/interface/src/logic/lib/hark.ts b/pkg/interface/src/logic/lib/hark.ts index f410e88d31..a5fe5883ea 100644 --- a/pkg/interface/src/logic/lib/hark.ts +++ b/pkg/interface/src/logic/lib/hark.ts @@ -1,5 +1,6 @@ import { IndexedNotification, NotificationGraphConfig, Unreads } from '@urbit/api'; import bigInt, { BigInteger } from 'big-integer'; +import _ from 'lodash'; import f from 'lodash/fp'; export function getLastSeen( @@ -31,7 +32,7 @@ export function getNotificationCount( ): number { const unread = unreads.graph?.[path] || {}; return Object.keys(unread) - .map(index => unread[index]?.notifications?.length || 0) + .map(index => _.get(unread[index], 'notifications.length', 0)) .reduce(f.add, 0); } diff --git a/pkg/interface/src/logic/lib/permalinks.ts b/pkg/interface/src/logic/lib/permalinks.ts index cc85032c78..d225dc317b 100644 --- a/pkg/interface/src/logic/lib/permalinks.ts +++ b/pkg/interface/src/logic/lib/permalinks.ts @@ -20,11 +20,12 @@ function getPermalinkForAssociatedGroup(group: string) { type Permalink = GraphPermalink | GroupPermalink; -interface GroupPermalink { +export interface GroupPermalink { type: 'group'; group: string; link: string; } + export interface GraphPermalink { type: 'graph'; link: string; diff --git a/pkg/interface/src/logic/lib/useModal.tsx b/pkg/interface/src/logic/lib/useModal.tsx index 95adb05706..9edbf011ab 100644 --- a/pkg/interface/src/logic/lib/useModal.tsx +++ b/pkg/interface/src/logic/lib/useModal.tsx @@ -1,9 +1,9 @@ import { Box } from '@tlon/indigo-react'; import React, { - ReactNode, - useCallback, - useMemo, - useRef, useState + ReactNode, + useCallback, + useMemo, + useRef, useState } from 'react'; import { PropFunc } from '~/types'; import { ModalOverlay } from '~/views/components/ModalOverlay'; @@ -57,7 +57,7 @@ export function useModal(props: UseModalProps & PropFunc): UseModalR display="flex" alignItems="stretch" flexDirection="column" - spacing="2" + spacing={2} dismiss={dismiss} {...rest} > diff --git a/pkg/interface/src/logic/lib/util.ts b/pkg/interface/src/logic/lib/util.tsx similarity index 97% rename from pkg/interface/src/logic/lib/util.ts rename to pkg/interface/src/logic/lib/util.tsx index 2b20c7047e..1dc01f9cf2 100644 --- a/pkg/interface/src/logic/lib/util.ts +++ b/pkg/interface/src/logic/lib/util.tsx @@ -5,7 +5,7 @@ import bigInt, { BigInteger } from 'big-integer'; import { enableMapSet } from 'immer'; import _ from 'lodash'; import f from 'lodash/fp'; -import { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { IconRef } from '~/types'; import useSettingsState from '../state/settings'; @@ -423,6 +423,13 @@ export const useHovering = (): useHoveringInterface => { return useMemo(() => ({ hovering, bind }), [hovering, bind]); }; +export function withHovering(Component: React.ComponentType) { + return React.forwardRef((props, ref) => { + const { hovering, bind } = useHovering(); + return + }) +} + const DM_REGEX = /ship\/~([a-z]|-)*\/dm--/; export function getItemTitle(association: Association): string { if (DM_REGEX.test(association.resource)) { diff --git a/pkg/interface/src/logic/lib/withState.tsx b/pkg/interface/src/logic/lib/withState.tsx index 1ccd661468..80fdce4c15 100644 --- a/pkg/interface/src/logic/lib/withState.tsx +++ b/pkg/interface/src/logic/lib/withState.tsx @@ -19,12 +19,14 @@ const withStateo = < }); }; -const withState = < - StateType extends BaseState, - stateKey extends keyof StateType - >( +interface StatePicker extends Array { + 0: UseStore; + 1?: string[]; +} + +const withState = ( Component: any, - stores: ([UseStore, stateKey[]])[] + stores: StatePicker[] ) => { return React.forwardRef((props, ref) => { const stateProps: unknown = {}; diff --git a/pkg/interface/src/logic/reducers/graph-update.ts b/pkg/interface/src/logic/reducers/graph-update.ts index 1bb7632787..b049119131 100644 --- a/pkg/interface/src/logic/reducers/graph-update.ts +++ b/pkg/interface/src/logic/reducers/graph-update.ts @@ -1,3 +1,4 @@ +import { GraphNode } from '@urbit/api'; import BigIntOrderedMap from '@urbit/api/lib/BigIntOrderedMap'; import bigInt, { BigInteger } from 'big-integer'; import produce from 'immer'; @@ -52,14 +53,14 @@ const keys = (json, state: GraphState): GraphState => { const processNode = (node) => { // is empty if (!node.children) { - return produce(node, (draft) => { + return produce(node, (draft: GraphNode) => { draft.children = new BigIntOrderedMap(); }); } // is graph - return produce(node, (draft) => { - draft.children = new BigIntOrderedMap() + return produce(node, (draft: GraphNode) => { + draft.children = new BigIntOrderedMap() .gas(_.map(draft.children, (item, idx) => [bigInt(idx), processNode(item)] as [BigInteger, any] )); diff --git a/pkg/interface/src/logic/reducers/hark-update.ts b/pkg/interface/src/logic/reducers/hark-update.ts index f40b9f2854..50978b4e3a 100644 --- a/pkg/interface/src/logic/reducers/hark-update.ts +++ b/pkg/interface/src/logic/reducers/hark-update.ts @@ -64,11 +64,19 @@ function calculateCount(json: any, state: HarkState) { let count = 0; _.forEach(state.unreads.graph, (graphs) => { _.forEach(graphs, (graph) => { - count += (graph?.notifications || []).length; + if (typeof graph?.notifications === 'object') { + count += graph?.notifications.length; + } else { + count += 0; + } }); }); _.forEach(state.unreads.group, (group) => { - count += (group?.notifications || []).length; + if (typeof group?.notifications === 'object') { + count += group?.notifications.length; + } else { + count += 0; + } }); state.notificationsCount = count; return state; diff --git a/pkg/interface/src/logic/state/base.ts b/pkg/interface/src/logic/state/base.ts index 4286d2dcd1..c987df77a7 100644 --- a/pkg/interface/src/logic/state/base.ts +++ b/pkg/interface/src/logic/state/base.ts @@ -44,13 +44,13 @@ export interface BaseState extends State { set: (fn: (state: StateType) => void) => void; } -export const createState = ( +export const createState = >( name: string, - properties: T, + properties: { [K in keyof Omit]: T[K] }, blacklist: string[] = [] -): UseStore> => create(persist((set, get) => ({ +): UseStore => create(persist((set, get) => ({ set: fn => stateSetter(fn, set), - ...properties + ...properties as any }), { blacklist, name: stateStorageKey(name), diff --git a/pkg/interface/src/views/apps/chat/components/ChatEditor.tsx b/pkg/interface/src/views/apps/chat/components/ChatEditor.tsx index 3a805fc439..2f7a0b99d6 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatEditor.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatEditor.tsx @@ -108,8 +108,18 @@ interface ChatEditorState { message: string; } +interface CodeMirrorShim { + setValue: (string) => void; + setOption: (option: string, property: any) => void; + focus: () => void; + execCommand: (string) => void; + getValue: () => string; + getInputField: () => HTMLInputElement; + element: HTMLElement; +} + export default class ChatEditor extends Component { - editor: ProxyHandler | null; + editor: CodeMirrorShim; constructor(props: ChatEditorProps) { super(props); @@ -222,7 +232,7 @@ export default class ChatEditor extends Component { if (this.editor) { @@ -245,7 +255,7 @@ export default class ChatEditor extends Component - this.messageChange(null, null, event.target.value) + this.messageChange(null, null, (event.target as any).value) } ref={(input) => { if (!input) diff --git a/pkg/interface/src/views/apps/chat/components/ChatInput.tsx b/pkg/interface/src/views/apps/chat/components/ChatInput.tsx index 2f443fec2b..5d0524ed43 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatInput.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatInput.tsx @@ -29,7 +29,7 @@ interface ChatInputState { currentInput: string; } -class ChatInput extends Component { +export class ChatInput extends Component { private chatEditor: React.RefObject; constructor(props) { diff --git a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx index cf976e7bdf..6bee90d048 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx @@ -1,9 +1,10 @@ /* eslint-disable max-lines-per-function */ import { BaseImage, Box, Col, Icon, Row, Rule, Text } from '@tlon/indigo-react'; -import { Contact, Post } from '@urbit/api'; +import { Contact, MentionContent, Post } from '@urbit/api'; import bigInt from 'big-integer'; import moment from 'moment'; import React, { + Ref, useEffect, useMemo, useState } from 'react'; @@ -20,13 +21,13 @@ import useLocalState from '~/logic/state/local'; import useSettingsState, { selectCalmState } from '~/logic/state/settings'; import { Dropdown } from '~/views/components/Dropdown'; import ProfileOverlay from '~/views/components/ProfileOverlay'; -import { GraphContent} from '~/views/landscape/components/Graph/GraphContent'; +import { GraphContent } from '~/views/landscape/components/Graph/GraphContent'; export const DATESTAMP_FORMAT = '[~]YYYY.M.D'; interface DayBreakProps { - when: string; + when: string | number; shimTop?: boolean; } @@ -55,7 +56,7 @@ export const DayBreak = ({ when, shimTop = false }: DayBreakProps) => ( ); export const UnreadMarker = React.forwardRef( - ({ dismissUnread }: any, ref) => { + ({ dismissUnread }: any, ref: Ref) => { const [visible, setVisible] = useState(false); const idling = useIdlingState(); @@ -113,7 +114,7 @@ const MessageActionItem = (props) => { ); }; -const MessageActions = ({ api, onReply, onDelete, association, msg, isAdmin, permalink }) => { +const MessageActions = ({ onReply, onDelete, msg, isAdmin, permalink }) => { const isOwn = () => msg.author === window.ship; const { doCopy, copyDisplay } = useCopy(permalink, 'Copy Message Link'); @@ -205,14 +206,14 @@ interface ChatMessageProps { msg: Post; previousMsg?: Post; nextMsg?: Post; - isLastRead: boolean; - permalink: string; + isLastRead?: boolean; + permalink?: string; transcluded?: number; className?: string; - isPending: boolean; + isPending?: boolean; style?: unknown; isLastMessage?: boolean; - dismissUnread: () => void; + dismissUnread?: () => void; api: GlobalApi; highlighted?: boolean; renderSigil?: boolean; @@ -220,27 +221,24 @@ interface ChatMessageProps { innerRef: (el: HTMLDivElement | null) => void; onReply?: (msg: Post) => void; showOurContact: boolean; + onDelete?: () => void; } function ChatMessage(props: ChatMessageProps) { let { highlighted } = props; const { msg, - previousMsg, nextMsg, - isLastRead, - group, - association, + isLastRead = false, className = '', - isPending, + isPending = false, style, isLastMessage, api, showOurContact, - fontSize, hideHover, - dismissUnread, - permalink + dismissUnread = () => null, + permalink = '' } = props; if (typeof msg === 'string' || !msg) { @@ -257,7 +255,7 @@ function ChatMessage(props: ChatMessageProps) { msg.number === 1 ); - const ourMention = msg?.contents?.some((e) => { + const ourMention = msg?.contents?.some((e: MentionContent) => { return e?.mention && e?.mention === window.ship; }); @@ -291,12 +289,10 @@ function ChatMessage(props: ChatMessageProps) { const messageProps = { msg, timestamp, - association, isPending, showOurContact, api, highlighted, - fontSize, hideHover, transcluded, onReply, @@ -494,7 +490,7 @@ export const Message = React.memo(({ position='absolute' width='36px' textAlign='right' - left='0' + left={0} top='2px' lineHeight="tall" fontSize={0} @@ -528,10 +524,10 @@ export const MessagePlaceholder = ({ }) => ( diff --git a/pkg/interface/src/views/apps/chat/components/ChatPane.tsx b/pkg/interface/src/views/apps/chat/components/ChatPane.tsx index ed283c3340..dd6ebf46fb 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatPane.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatPane.tsx @@ -11,7 +11,7 @@ import useGraphState from '~/logic/state/graph'; import ShareProfile from '~/views/apps/chat/components/ShareProfile'; import { Loading } from '~/views/components/Loading'; import SubmitDragger from '~/views/components/SubmitDragger'; -import ChatInput from './ChatInput'; +import ChatInput, { ChatInput as NakedChatInput } from './ChatInput'; import ChatWindow from './ChatWindow'; interface ChatPaneProps { @@ -82,14 +82,14 @@ export function ChatPane(props: ChatPaneProps): ReactElement { } = props; const graphTimesentMap = useGraphState(state => state.graphTimesentMap); const ourContact = useOurContact(); - const chatInput = useRef(); + const chatInput = useRef(); const onFileDrag = useCallback( (files: FileList | File[]) => { if (!chatInput.current) { return; } - chatInput.current?.uploadFiles(files); + (chatInput.current as NakedChatInput)?.uploadFiles(files); }, [chatInput.current] ); diff --git a/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx b/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx index b7ca5a39c5..b721601665 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatWindow.tsx @@ -16,7 +16,7 @@ type ChatWindowProps = { unreadCount: number; graph: Graph; graphSize: number; - station: unknown; + station?: unknown; fetchMessages: (newer: boolean) => Promise; api: GlobalApi; scrollTo?: BigInteger; @@ -36,6 +36,11 @@ interface ChatWindowState { unreadIndex: BigInteger; } +interface RendererProps { + index: bigInt.BigInteger; + scrollWindow: any; +} + const virtScrollerStyle = { height: '100%' }; class ChatWindow extends Component< @@ -99,11 +104,12 @@ class ChatWindow extends Component< }); } - dismissedInitialUnread(): void { + dismissedInitialUnread(): boolean { const { unreadCount, graph } = this.props; - return this.state.unreadIndex.eq(bigInt.zero) ? unreadCount > graph.size : - this.state.unreadIndex.neq(graph.keys()?.[unreadCount]?.[0] ?? bigInt.zero); + return this.state.unreadIndex.eq(bigInt.zero) + ? unreadCount > graph.size + : this.state.unreadIndex.neq(graph.keys()?.[unreadCount]?.[0] ?? bigInt.zero); } handleWindowBlur(): void { @@ -173,7 +179,7 @@ class ChatWindow extends Component< } } - renderer = React.forwardRef(({ index, scrollWindow }, ref) => { + renderer = React.forwardRef(({ index, scrollWindow }: RendererProps, ref) => { const { api, showOurContact, diff --git a/pkg/interface/src/views/apps/chat/components/UnreadNotice.tsx b/pkg/interface/src/views/apps/chat/components/UnreadNotice.tsx index ac5a34f89c..a81acf014b 100644 --- a/pkg/interface/src/views/apps/chat/components/UnreadNotice.tsx +++ b/pkg/interface/src/views/apps/chat/components/UnreadNotice.tsx @@ -22,16 +22,16 @@ const UnreadNotice = (props): ReactElement | null => { className='unread-notice' >
- + { if(!graphKeys.has(resource)) { autoJoin(); - } else if(Boolean(association) && 'graph' in association.config) { - history.push(`/~landscape/home/resource/${association.metadata.config.graph}${path}`); + } else if(Boolean(association) && 'graph' in association.metadata.config) { + history.push(`/~landscape/home/resource/${(association.metadata.config as GraphConfig).graph}${path}`); } return (
diff --git a/pkg/interface/src/views/apps/launch/App.tsx b/pkg/interface/src/views/apps/launch/App.tsx index 791a42402b..0d7b783fe6 100644 --- a/pkg/interface/src/views/apps/launch/App.tsx +++ b/pkg/interface/src/views/apps/launch/App.tsx @@ -6,13 +6,13 @@ import { Helmet } from 'react-helmet'; import styled from 'styled-components'; import GlobalApi from '~/logic/api/global'; import { - hasTutorialGroup, + hasTutorialGroup, - TUTORIAL_BOOK, - TUTORIAL_CHAT, TUTORIAL_GROUP, - TUTORIAL_HOST, + TUTORIAL_BOOK, + TUTORIAL_CHAT, TUTORIAL_GROUP, + TUTORIAL_HOST, - TUTORIAL_LINKS + TUTORIAL_LINKS } from '~/logic/lib/tutorialModal'; import { useModal } from '~/logic/lib/useModal'; import { useQuery } from '~/logic/lib/useQuery'; @@ -67,8 +67,8 @@ export const LaunchApp = (props: LaunchAppProps): ReactElement | null => { const hashBox = ( { dismiss(); }; return exitingTut ? ( - + - + You can always restart the tutorial by typing “tutorial” in Leap - + ) : ( - + - Welcome - + Welcome + You have been invited to use Landscape, an interface to chat and interact with communities
Would you like a tour of Landscape?
- + } @@ -125,7 +125,7 @@ export function NotificationWrapper(props: { {children} - + ); }); @@ -67,21 +67,21 @@ export default function NotificationsScreen(props: any): ReactElement { - + Notifications - + diff --git a/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx b/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx index 8e5214bccb..010675ebbc 100644 --- a/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx +++ b/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx @@ -1,5 +1,5 @@ import { Anchor, Box, Col, Icon, Row, Text } from '@tlon/indigo-react'; -import { Association, GraphNode, Group, Post } from '@urbit/api'; +import { Association, GraphConfig, GraphNode, Group, Post, ReferenceContent, TextContent, UrlContent } from '@urbit/api'; import bigInt from 'big-integer'; import React from 'react'; import GlobalApi from '~/logic/api/global'; @@ -38,7 +38,7 @@ function TranscludedLinkNode(props: { switch (idx.length) { case 1: - const [{ text }, link] = node.post.contents; + const [{ text }, link] = node.post.contents as [TextContent, UrlContent | ReferenceContent]; if('reference' in link) { const permalink = referenceToPermalink(link).link; return ; @@ -76,6 +76,7 @@ function TranscludedLinkNode(props: {
); + case 2: return ( + - {post.post.contents[0]?.text} + {(post.post.contents[0] as TextContent)?.text} diff --git a/pkg/interface/src/views/apps/permalinks/app.tsx b/pkg/interface/src/views/apps/permalinks/app.tsx index cfbd8b82ca..3e29a7e5c6 100644 --- a/pkg/interface/src/views/apps/permalinks/app.tsx +++ b/pkg/interface/src/views/apps/permalinks/app.tsx @@ -1,4 +1,4 @@ -import { Association } from '@urbit/api'; +import { Association, GraphConfig } from '@urbit/api'; import React, { useCallback } from 'react'; import { Redirect, Route, Switch @@ -82,7 +82,7 @@ function GroupRoutes(props: { group: string; url: string }) { return ; } diff --git a/pkg/interface/src/views/apps/permalinks/embed.tsx b/pkg/interface/src/views/apps/permalinks/embed.tsx index 6a4cd514a3..6c0bb3de1d 100644 --- a/pkg/interface/src/views/apps/permalinks/embed.tsx +++ b/pkg/interface/src/views/apps/permalinks/embed.tsx @@ -1,27 +1,25 @@ -import React, { useCallback, useEffect, useState } from "react"; -import { useHistory, useLocation, Link } from 'react-router-dom'; +import { + BaseAnchor, Box, + + + + + + Center, Col, Icon, Row, Text +} from "@tlon/indigo-react"; import { Association, GraphNode, resourceFromPath } from '@urbit/api'; +import React, { useCallback, useEffect, useState } from "react"; +import { useHistory, useLocation } from 'react-router-dom'; import GlobalApi from '~/logic/api/global'; import { getPermalinkForGraph, GraphPermalink as IGraphPermalink, parsePermalink } from '~/logic/lib/permalinks'; -import { - Action, - Box, - Text, - BaseAnchor, - Row, - Icon, - Col, - Center -} from "@tlon/indigo-react"; -import { GroupLink } from "~/views/components/GroupLink"; import { getModuleIcon } from "~/logic/lib/util"; -import useMetadataState from "~/logic/state/metadata"; +import { useVirtualResizeProp } from "~/logic/lib/virtualContext"; import useGraphState from "~/logic/state/graph"; -import { GraphNodeContent } from "../notifications/graph"; +import useMetadataState from "~/logic/state/metadata"; +import { GroupLink } from "~/views/components/GroupLink"; import { TranscludedNode } from "./TranscludedNode"; -import {useVirtualResizeProp} from "~/logic/lib/virtualContext"; function GroupPermalink(props: { group: string; api: GlobalApi }) { const { group, api } = props; @@ -29,9 +27,9 @@ function GroupPermalink(props: { group: string; api: GlobalApi }) { ); @@ -112,7 +110,7 @@ function GraphPermalink( maxWidth={full ? null : "500px"} border={full ? null : "1"} borderColor="lightGray" - borderRadius="2" + borderRadius={2} cursor="pointer" onClick={(e) => { navigate(e); @@ -140,7 +138,7 @@ function GraphPermalink( diff --git a/pkg/interface/src/views/apps/permalinks/graphIndex.tsx b/pkg/interface/src/views/apps/permalinks/graphIndex.tsx index 714731e0b3..3d40197ffc 100644 --- a/pkg/interface/src/views/apps/permalinks/graphIndex.tsx +++ b/pkg/interface/src/views/apps/permalinks/graphIndex.tsx @@ -1,4 +1,4 @@ -import { Association, Group } from '@urbit/api'; +import { Association, GraphConfig, Group } from '@urbit/api'; import _ from 'lodash'; import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; @@ -8,7 +8,7 @@ export function getGraphPermalink( group: Group, index: string ) { - const mod = assoc.metadata.config.graph; + const mod = (assoc.metadata.config as GraphConfig).graph; const groupPath = group.hidden ? '/~landscape/home' : `/~landscape${assoc.group}`; diff --git a/pkg/interface/src/views/apps/profile/components/EditProfile.tsx b/pkg/interface/src/views/apps/profile/components/EditProfile.tsx index 2225fa25a0..7705c649c1 100644 --- a/pkg/interface/src/views/apps/profile/components/EditProfile.tsx +++ b/pkg/interface/src/views/apps/profile/components/EditProfile.tsx @@ -1,8 +1,8 @@ import { - Button, Col, ManagedCheckboxField as Checkbox, ManagedForm as Form, - ManagedTextInputField as Input, + Button, Col, ManagedCheckboxField as Checkbox, ManagedForm as Form, + ManagedTextInputField as Input, - Row, Text + Row, Text } from '@tlon/indigo-react'; import { Formik } from 'formik'; import _ from 'lodash'; @@ -18,9 +18,9 @@ import { ColorInput } from '~/views/components/ColorInput'; import GroupSearch from '~/views/components/GroupSearch'; import { ImageInput } from '~/views/components/ImageInput'; import { - ProfileControls, ProfileHeader, + ProfileControls, ProfileHeader, - ProfileImages, ProfileStatus + ProfileImages, ProfileStatus } from './Profile'; const formSchema = Yup.object({ @@ -61,7 +61,7 @@ export function ProfileHeaderImageEdit(props: any): ReactElement { ) : ( - { diff --git a/pkg/interface/src/views/apps/profile/components/Profile.tsx b/pkg/interface/src/views/apps/profile/components/Profile.tsx index 03151887d2..41c73d7784 100644 --- a/pkg/interface/src/views/apps/profile/components/Profile.tsx +++ b/pkg/interface/src/views/apps/profile/components/Profile.tsx @@ -16,7 +16,7 @@ export function ProfileHeader(props: any): ReactElement { @@ -27,7 +27,7 @@ export function ProfileHeader(props: any): ReactElement { export function ProfileImages(props: any): ReactElement { const { hideAvatars } = useSettingsState(selectCalmState); - const { contact, hideCover, ship } = { ...props }; + const { contact, hideCover, ship } = props; const hexColor = contact?.color ? `#${uxToHex(contact.color)}` : '#000000'; const anchorRef = useRef(null); @@ -76,7 +76,7 @@ export function ProfileImages(props: any): ReactElement { + {props.children} ); } export function ProfileStatus(props: any): ReactElement { - const { contact } = { ...props }; + const { contact } = props; return ( {ship === `~${window.ship}` ? ( <> { @@ -145,8 +145,8 @@ export function ProfileActions(props: any): ReactElement { history.push(`/~landscape/dm/${ship.substring(1)}`)} diff --git a/pkg/interface/src/views/apps/profile/components/ViewProfile.tsx b/pkg/interface/src/views/apps/profile/components/ViewProfile.tsx index f63a45927c..7c1122f9fb 100644 --- a/pkg/interface/src/views/apps/profile/components/ViewProfile.tsx +++ b/pkg/interface/src/views/apps/profile/components/ViewProfile.tsx @@ -45,15 +45,15 @@ export function ViewProfile(props: any): ReactElement {
- +
- + {contact?.bio ? contact.bio : ''}
{(contact?.groups || []).length > 0 && ( - + Pinned Groups {contact?.groups.slice().sort(lengthOrder).map(g => ( diff --git a/pkg/interface/src/views/apps/profile/profile.tsx b/pkg/interface/src/views/apps/profile/profile.tsx index ea73638086..3e1faf914b 100644 --- a/pkg/interface/src/views/apps/profile/profile.tsx +++ b/pkg/interface/src/views/apps/profile/profile.tsx @@ -36,7 +36,7 @@ export default function ProfileScreen(props: any) { border={1} borderColor='lightGray' overflowY='auto' - flexGrow + flexGrow={1} > bind.onDragLeave(e)} - onDragOver={(editor, e) => bind.onDragOver(e)} - onDrop={(editor, e) => bind.onDrop(e)} - onDragEnter={(editor, e) => bind.onDragEnter(e)} + onDragLeave={(editor, e: DragEvent) => bind.onDragLeave(e)} + onDragOver={(editor, e: DragEvent) => bind.onDragOver(e)} + onDrop={(editor, e: DragEvent) => bind.onDrop(e)} + onDragEnter={(editor, e: DragEvent) => bind.onDragEnter(e)} /> {dragging && } diff --git a/pkg/interface/src/views/apps/publish/components/MarkdownField.tsx b/pkg/interface/src/views/apps/publish/components/MarkdownField.tsx index 36708880e0..f779b1c6a4 100644 --- a/pkg/interface/src/views/apps/publish/components/MarkdownField.tsx +++ b/pkg/interface/src/views/apps/publish/components/MarkdownField.tsx @@ -36,7 +36,7 @@ export const MarkdownField = ({ value={value} onChange={setValue} /> - + {error}
diff --git a/pkg/interface/src/views/apps/publish/components/Note.tsx b/pkg/interface/src/views/apps/publish/components/Note.tsx index 34ead4b28e..f609c63af1 100644 --- a/pkg/interface/src/views/apps/publish/components/Note.tsx +++ b/pkg/interface/src/views/apps/publish/components/Note.tsx @@ -1,18 +1,18 @@ -import React, { useState, useEffect } from 'react'; -import { Box, Text, Col, Anchor, Row, Action } from '@tlon/indigo-react'; +import { Action, Anchor, Box, Col, Row, Text } from '@tlon/indigo-react'; +import { Association, Graph, GraphNode, Group } from '@urbit/api'; import bigInt from 'big-integer'; +import React, { useEffect, useState } from 'react'; import { Link, RouteComponentProps } from 'react-router-dom'; import GlobalApi from '~/logic/api/global'; import { roleForShip } from '~/logic/lib/group'; -import { Contacts, GraphNode, Graph, Association, Unreads, Group, Post } from '@urbit/api'; import { getPermalinkForGraph } from '~/logic/lib/permalinks'; -import { GraphContent } from '~/views/landscape/components/Graph/GraphContent'; import { getComments, getLatestRevision } from '~/logic/lib/publish'; import { useCopy } from '~/logic/lib/useCopy'; import { useQuery } from '~/logic/lib/useQuery'; import Author from '~/views/components/Author'; import { Comments } from '~/views/components/Comments'; import { Spinner } from '~/views/components/Spinner'; +import { GraphContent } from '~/views/landscape/components/Graph/GraphContent'; import { NoteNavigation } from './NoteNavigation'; import { Redirect } from 'react-router-dom'; @@ -117,7 +117,7 @@ export function Note(props: NoteProps & RouteComponentProps) { date={post?.['time-sent']} group={group} > - + {copyDisplay} {adminLinks} @@ -128,8 +128,7 @@ export function Note(props: NoteProps & RouteComponentProps) { @@ -48,12 +48,12 @@ function getAdjacentId( return target?.[0] || null; } -function makeNoteUrl(noteId: number) { +function makeNoteUrl(noteId: BigInteger) { return noteId.toString(); } interface NoteNavigationProps { - noteId: number; + noteId: BigInteger; notebook: Graph; baseUrl: string; } diff --git a/pkg/interface/src/views/apps/publish/components/NotePreview.tsx b/pkg/interface/src/views/apps/publish/components/NotePreview.tsx index 177b091b7a..ca8c201681 100644 --- a/pkg/interface/src/views/apps/publish/components/NotePreview.tsx +++ b/pkg/interface/src/views/apps/publish/components/NotePreview.tsx @@ -6,9 +6,9 @@ import ReactMarkdown from 'react-markdown'; import { Link } from 'react-router-dom'; import styled from 'styled-components'; import { - getComments, - getLatestRevision, - getSnippet + getComments, + getLatestRevision, + getSnippet } from '~/logic/lib/publish'; import useHarkState from '~/logic/state/hark'; import Author from '~/views/components/Author'; @@ -37,7 +37,7 @@ export function NotePreviewContent({ snippet }) { style={{ backgroundSize: 'cover', backgroundPosition: 'center' }} > - +
), paragraph: props => ( @@ -91,7 +91,7 @@ export function NotePreview(props: NotePreviewProps) { borderRadius={2} alignItems='flex-start' overflow='hidden' - p='2' + p={2} > {title} @@ -101,7 +101,7 @@ export function NotePreview(props: NotePreviewProps) { - + + {association.metadata?.title} @@ -50,7 +50,7 @@ export function Notebook(props: NotebookProps & RouteComponentProps): ReactEleme - + { return ( Writers - Add additional writers to this notebook + Add additional writers to this notebook { label="" maxLength={undefined} /> - + Submit {writers.length > 0 ? <> - Current writers: - {writers} + Current writers: + {writers} : - + All group members can write to this channel } diff --git a/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx b/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx index 88145ebf8f..6218bcd58d 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/BackButton.tsx @@ -7,7 +7,7 @@ export function BackButton(props: {}) { Landscape Background - - Set an image background + + Set an image background - - Set a hex-based background - + + Set a hex-based background + )} - + diff --git a/pkg/interface/src/views/apps/settings/components/lib/CalmPref.tsx b/pkg/interface/src/views/apps/settings/components/lib/CalmPref.tsx index a3ab0d61dc..b676499160 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/CalmPref.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/CalmPref.tsx @@ -1,7 +1,7 @@ import { - Col, ManagedToggleSwitchField as Toggle, + Col, ManagedToggleSwitchField as Toggle, - Text + Text } from '@tlon/indigo-react'; import { Form, Formik, FormikHelpers } from 'formik'; import React, { useCallback } from 'react'; @@ -75,8 +75,8 @@ export function CalmPrefs(props: {
- - + + CalmEngine diff --git a/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx b/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx index 66ec23c013..e6b6171721 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx @@ -52,7 +52,7 @@ const StoreDebugger = (props: StoreDebuggerProps) => { backgroundColor='white' color='black' border='1px solid transparent' - borderRadius='2' + borderRadius={2} fontSize={1} placeholder="Drill Down" width="100%" @@ -65,7 +65,7 @@ const StoreDebugger = (props: StoreDebuggerProps) => { } }} /> - {text} + {text} } ); @@ -75,8 +75,8 @@ const DebugPane = () => { return ( <> - - + + Debug Menu diff --git a/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx b/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx index 534e5a6192..e7b16009b8 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx @@ -1,8 +1,8 @@ import { - Col, + Col, - Label, - ManagedRadioButtonField as Radio, Text + Label, + ManagedRadioButtonField as Radio, Text } from '@tlon/indigo-react'; import { Form, Formik } from 'formik'; import React from 'react'; @@ -89,8 +89,8 @@ export default function DisplayForm(props: DisplayFormProps) { {props => ( - - + + Display Preferences diff --git a/pkg/interface/src/views/apps/settings/components/lib/GroupChannelPicker.tsx b/pkg/interface/src/views/apps/settings/components/lib/GroupChannelPicker.tsx index 59ce838743..3ec7a3c96d 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/GroupChannelPicker.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/GroupChannelPicker.tsx @@ -5,12 +5,12 @@ import { StatelessToggleSwitchField, Text } from '@tlon/indigo-react'; -import { Association, resourceFromPath } from '@urbit/api'; +import { Association, GraphConfig, resourceFromPath } from '@urbit/api'; import { useField } from 'formik'; import _ from 'lodash'; import React, { useEffect, useState } from 'react'; import { isWatching } from '~/logic/lib/hark'; -import { getModuleIcon } from '~/logic/lib/util'; +import { getModuleIcon, GraphModule } from '~/logic/lib/util'; import useGraphState from '~/logic/state/graph'; import useHarkState from '~/logic/state/hark'; import useMetadataState, { useGraphsForGroup } from '~/logic/state/metadata'; @@ -20,7 +20,7 @@ export function GroupChannelPicker(props: {}) { const associations = useMetadataState(s => s.associations); return ( - + {_.map(associations.groups, (assoc: Association, group: string) => ( ))} @@ -62,7 +62,7 @@ function GroupWithChannels(props: { association: Association }) { display="grid" gridTemplateColumns="24px 24px 1fr 24px 24px" gridTemplateRows="auto" - gridGap="2" + gridGap={2} gridTemplateAreas="'arrow icon title graphToggle groupToggle'" > {Object.keys(joinedGroupGraphs).length > 0 && ( @@ -112,17 +112,17 @@ function Channel(props: { association: Association }) { setValue(!value); }; - const icon = getModuleIcon(metadata.config?.graph); + const icon = getModuleIcon((metadata.config as GraphConfig)?.graph as GraphModule); return ( <> -
+
- + {metadata.title} - + diff --git a/pkg/interface/src/views/apps/settings/components/lib/LeapSettings.tsx b/pkg/interface/src/views/apps/settings/components/lib/LeapSettings.tsx index d628c4aa42..5f3c616cda 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/LeapSettings.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/LeapSettings.tsx @@ -1,7 +1,7 @@ import { - Col, + Col, - ManagedCheckboxField, Text + ManagedCheckboxField, Text } from '@tlon/indigo-react'; import { Form, useField, useFormikContext } from 'formik'; import _ from 'lodash'; @@ -9,8 +9,8 @@ import React from 'react'; import GlobalApi from '~/logic/api/global'; import useSettingsState, { selectSettingsState } from '~/logic/state/settings'; import { - LeapCategories, - leapCategories + LeapCategories, + leapCategories } from '~/types'; import { FormikOnBlur } from '~/views/components/FormikOnBlur'; import { ShuffleFields } from '~/views/components/ShuffleFields'; @@ -73,9 +73,9 @@ export function LeapSettings(props: { api: GlobalApi; }) { return ( <> - - - + + + Leap @@ -84,7 +84,7 @@ export function LeapSettings(props: { api: GlobalApi; }) { - + Customize default Leap sections diff --git a/pkg/interface/src/views/apps/settings/components/lib/NotificationPref.tsx b/pkg/interface/src/views/apps/settings/components/lib/NotificationPref.tsx index abed89bb11..2cecbf9da7 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/NotificationPref.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/NotificationPref.tsx @@ -1,7 +1,7 @@ import { - Col, + Col, - ManagedToggleSwitchField as Toggle, Text + ManagedToggleSwitchField as Toggle, Text } from '@tlon/indigo-react'; import { Form, Formik, FormikHelpers } from 'formik'; import _ from 'lodash'; @@ -72,9 +72,9 @@ export function NotificationPreferences(props: { return ( <> - - - + + + Notification Preferences @@ -84,7 +84,7 @@ export function NotificationPreferences(props: { - + - + Activity diff --git a/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx b/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx index 4e2b00ce4f..cf07907be5 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/S3Form.tsx @@ -1,7 +1,7 @@ import { - Anchor, Col, ManagedForm as Form, ManagedTextInputField as Input, + Anchor, Col, ManagedForm as Form, ManagedTextInputField as Input, - Text + Text } from '@tlon/indigo-react'; import { Formik, FormikHelpers } from 'formik'; import React, { ReactElement, useCallback } from 'react'; @@ -47,7 +47,7 @@ export default function S3Form(props: S3FormProps): ReactElement { return ( <> - + - - + + S3 Storage Setup @@ -72,8 +72,8 @@ export default function S3Form(props: S3FormProps): ReactElement { Learn more @@ -94,8 +94,8 @@ export default function S3Form(props: S3FormProps): ReactElement { - - + + S3 Buckets diff --git a/pkg/interface/src/views/apps/settings/components/lib/Security.tsx b/pkg/interface/src/views/apps/settings/components/lib/Security.tsx index 9ad5d06063..1cb273557b 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/Security.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/Security.tsx @@ -1,7 +1,7 @@ import { - Button, - Col, - StatelessCheckboxField, Text + Button, + Col, + StatelessCheckboxField, Text } from '@tlon/indigo-react'; import React, { useState } from 'react'; import GlobalApi from '~/logic/api/global'; @@ -16,8 +16,8 @@ export default function SecuritySettings({ api }: SecuritySettingsProps) { return ( <> - - + + Security Preferences @@ -25,17 +25,17 @@ export default function SecuritySettings({ api }: SecuritySettingsProps) { Manage sessions, login credentials and Landscape access - + Log out of this session - + {allSessions ? 'You will be logged out of all browsers that have currently logged into your Urbit.' : 'You will be logged out of your Urbit on this browser.'} setAllSessions(s => !s)} > diff --git a/pkg/interface/src/views/apps/settings/components/settings.tsx b/pkg/interface/src/views/apps/settings/components/settings.tsx index 158cdef78b..769702e130 100644 --- a/pkg/interface/src/views/apps/settings/components/settings.tsx +++ b/pkg/interface/src/views/apps/settings/components/settings.tsx @@ -10,14 +10,14 @@ export function SettingsItem(props: { const { to, title, description } = props; return ( - + - + {title} {description} @@ -28,9 +28,9 @@ export function SettingsItem(props: { export default function Settings(props: {}) { return ( - - - System Preferences + + + System Preferences Configure and customize Landscape + {children} ); @@ -94,13 +94,13 @@ return; - + System Preferences diff --git a/pkg/interface/src/views/apps/term/api.tsx b/pkg/interface/src/views/apps/term/api.tsx index 8216a771dc..077263efc3 100644 --- a/pkg/interface/src/views/apps/term/api.tsx +++ b/pkg/interface/src/views/apps/term/api.tsx @@ -1,6 +1,9 @@ import _ from 'lodash'; export default class Api { + ship: any; + channel: any; + bindPaths: any[]; constructor(ship, channel) { this.ship = ship; this.channel = channel; @@ -10,7 +13,7 @@ export default class Api { bind(path, method, ship = this.ship, appl = 'herm', success, fail) { this.bindPaths = _.uniq([...this.bindPaths, path]); - window.subscriptionId = this.channel.subscribe(ship, appl, path, + (window as any).subscriptionId = this.channel.subscribe(ship, appl, path, (err) => { fail(err); }, diff --git a/pkg/interface/src/views/apps/term/app.tsx b/pkg/interface/src/views/apps/term/app.tsx index 58f1a0cbaa..cd0ba942f1 100644 --- a/pkg/interface/src/views/apps/term/app.tsx +++ b/pkg/interface/src/views/apps/term/app.tsx @@ -12,6 +12,11 @@ import Store from './store'; import Subscription from './subscription'; class TermApp extends Component { + store: Store; + api: any; + subscription: any; + props: any; + state: any; constructor(props) { super(props); this.store = new Store(); @@ -27,7 +32,7 @@ class TermApp extends Component { componentDidMount() { this.resetControllers(); - const channel = new window.channel(); + const channel = new (window as any).channel(); this.api = new Api(this.props.ship, channel); this.store.api = this.api; @@ -61,13 +66,13 @@ class TermApp extends Component { display='flex' > ; + props: any; constructor(props) { super(props); this.state = {}; @@ -69,7 +71,7 @@ belt = { met: 'bac' }; } paste(e) { - const clipboardData = e.clipboardData || window.clipboardData; + const clipboardData = e.clipboardData || (window as any).clipboardData; const clipboardText = clipboardData.getData('Text'); this.props.api.belt({ txt: [...clipboardText] }); e.preventDefault(); @@ -94,18 +96,18 @@ belt = { met: 'bac' }; } } return ( - - + + { // return ( {text} diff --git a/pkg/interface/src/views/apps/term/store.tsx b/pkg/interface/src/views/apps/term/store.tsx index ebc1bce730..d2166083a4 100644 --- a/pkg/interface/src/views/apps/term/store.tsx +++ b/pkg/interface/src/views/apps/term/store.tsx @@ -2,6 +2,9 @@ import { saveAs } from 'file-saver'; import bel from '../../../logic/lib/bel'; export default class Store { + state: any; + api: any; + setState: any; constructor() { this.state = this.initialState(); } @@ -69,6 +72,7 @@ return h; break; case 'sag': blit.sav = blit.sag; + break; case 'sav': const name = blit.sav.path.split('/').slice(-2).join('.'); const buff = new Buffer(blit.sav.file, 'base64'); diff --git a/pkg/interface/src/views/apps/term/subscription.tsx b/pkg/interface/src/views/apps/term/subscription.tsx index c75c679ae1..178246e43f 100644 --- a/pkg/interface/src/views/apps/term/subscription.tsx +++ b/pkg/interface/src/views/apps/term/subscription.tsx @@ -1,4 +1,8 @@ export default class Subscription { + store: any; + api: any; + channel: any; + firstRoundComplete: boolean; constructor(store, api, channel) { this.store = store; this.api = api; @@ -51,13 +55,13 @@ return; console.error('event source error: ', err); console.log('initiating new channel'); this.firstRoundComplete = false; - setTimeout(2000, () => { + setTimeout(() => { this.store.handleEvent({ data: { clear : true } }); this.start(); - }); + }, 2000); } subscribe(path, app) { diff --git a/pkg/interface/src/views/components/Author.tsx b/pkg/interface/src/views/components/Author.tsx index ab557697fa..614ebd07a0 100644 --- a/pkg/interface/src/views/components/Author.tsx +++ b/pkg/interface/src/views/components/Author.tsx @@ -2,6 +2,7 @@ import { BaseImage, Box, Row } from '@tlon/indigo-react'; import moment from 'moment'; import React, { ReactElement, ReactNode, useState } from 'react'; import { useHistory } from 'react-router-dom'; +import GlobalApi from '~/logic/api/global'; import { Sigil } from '~/logic/lib/sigil'; import { useCopy } from '~/logic/lib/useCopy'; import { cite, deSig, useShowNickname, uxToHex } from '~/logic/lib/util'; @@ -20,7 +21,7 @@ interface AuthorProps { unread?: boolean; api?: GlobalApi; size?: number; - lineHeight?: string; + lineHeight?: string | number; isRelativeTime?: boolean; } diff --git a/pkg/interface/src/views/components/ChipInput.tsx b/pkg/interface/src/views/components/ChipInput.tsx index 6b374394cc..bc075d86f2 100644 --- a/pkg/interface/src/views/components/ChipInput.tsx +++ b/pkg/interface/src/views/components/ChipInput.tsx @@ -1,18 +1,18 @@ import { - Col, + Col, - ErrorLabel, Label, - Row, + ErrorLabel, Label, + Row, - StatelessTextInput as Input + StatelessTextInput as Input } from '@tlon/indigo-react'; import { useField } from 'formik'; import Mousetrap from 'mousetrap'; import React, { - ReactElement, ReactNode, useCallback, + ReactElement, ReactNode, useCallback, - useEffect, - useRef, useState + useEffect, + useRef, useState } from 'react'; function Chip(props: { children: ReactNode }): ReactElement { @@ -20,9 +20,9 @@ function Chip(props: { children: ReactNode }): ReactElement { @@ -93,15 +93,15 @@ export function ChipInput(props: ChipInputProps): ReactElement { }, [inputRef.current, addNewChip, newChip]); return ( - + {caption && } - + {meta.error} diff --git a/pkg/interface/src/views/components/ColorInput.tsx b/pkg/interface/src/views/components/ColorInput.tsx index c947ee9d01..cf68ca0e5d 100644 --- a/pkg/interface/src/views/components/ColorInput.tsx +++ b/pkg/interface/src/views/components/ColorInput.tsx @@ -1,10 +1,10 @@ import { - Box, Col, + Box, Col, - ErrorLabel, Label, - Row, + ErrorLabel, Label, + Row, - StatelessTextInput as Input + StatelessTextInput as Input } from '@tlon/indigo-react'; import { useField } from 'formik'; import React, { FormEvent } from 'react'; @@ -40,11 +40,11 @@ export function ColorInput(props: ColorInputProps) { {caption ? ( - - + {meta.error} diff --git a/pkg/interface/src/views/components/CommentItem.tsx b/pkg/interface/src/views/components/CommentItem.tsx index cb2caa2f98..de8ebd88ab 100644 --- a/pkg/interface/src/views/components/CommentItem.tsx +++ b/pkg/interface/src/views/components/CommentItem.tsx @@ -11,8 +11,8 @@ import { getPermalinkForGraph } from '~/logic/lib/permalinks'; import { getLatestCommentRevision } from '~/logic/lib/publish'; import { useCopy } from '~/logic/lib/useCopy'; import useMetadataState from '~/logic/state/metadata'; -import { GraphContent } from '../landscape/components/Graph/GraphContent'; import Author from '~/views/components/Author'; +import { GraphContent } from '../landscape/components/Graph/GraphContent'; const ClickBox = styled(Box)` cursor: pointer; @@ -60,8 +60,9 @@ export function CommentItem(props: CommentItemProps) { }; const ourMention = post?.contents?.some((e) => { - return e?.mention && e?.mention === window.ship; - }); + if (!('mention' in e)) return false; + return e?.mention && e?.mention === window.ship; + }); if (!highlighted) { if (ourMention) { @@ -118,7 +119,7 @@ export function CommentItem(props: CommentItemProps) { return ( - + - + {copyDisplay} {adminLinks} ) { const post = createPost( content, commentNode.post.index, - parseInt(idx + 1, 10) + parseInt((idx + 1).toString(), 10).toString() ); await api.graph.addPost(ship, name, post); history.push(baseUrl); @@ -128,7 +128,7 @@ export function Comments(props: CommentsProps & PropFunc) { const canComment = isWriter(group, association.resource) || association.metadata.vip === 'reader-comments'; return ( - + {( !editCommentId && canComment ? : null )} {( editCommentId ? ( + {children} diff --git a/pkg/interface/src/views/components/DropdownSearch.tsx b/pkg/interface/src/views/components/DropdownSearch.tsx index 7beda190c8..9141b41d24 100644 --- a/pkg/interface/src/views/components/DropdownSearch.tsx +++ b/pkg/interface/src/views/components/DropdownSearch.tsx @@ -1,14 +1,14 @@ import { - Box, - StatelessTextInput as Input + Box, + StatelessTextInput as Input } from '@tlon/indigo-react'; import _ from 'lodash'; import Mousetrap from 'mousetrap'; import React, { - ChangeEvent, - ReactElement, useCallback, - useEffect, useMemo, useRef, - useState + ChangeEvent, + ReactElement, useCallback, + useEffect, useMemo, useRef, + useState } from 'react'; import { useDropdown } from '~/logic/lib/useDropdown'; import { PropFunc } from '~/types/util'; @@ -140,9 +140,9 @@ export function DropdownSearch(props: DropdownSearchProps): ReactElement { /> {dropdown.length !== 0 && query.length !== 0 && ( { body =`\`\`\`%0A${error.stack?.replaceAll('\n', '%0A')}%0A\`\`\``; } return ( - + {code ? code : 'Error'} diff --git a/pkg/interface/src/views/components/FormGroup.tsx b/pkg/interface/src/views/components/FormGroup.tsx index 6d82ee84a8..84a5cc0910 100644 --- a/pkg/interface/src/views/components/FormGroup.tsx +++ b/pkg/interface/src/views/components/FormGroup.tsx @@ -2,9 +2,9 @@ import { Box, Button, Row } from '@tlon/indigo-react'; import { useFormikContext } from 'formik'; import _ from 'lodash'; import React, { - useCallback, useEffect, + useCallback, useEffect, - useMemo, useState + useMemo, useState } from 'react'; import { Prompt } from 'react-router-dom'; import { FormGroupContext, SubmitHandler } from '~/logic/lib/formGroup'; @@ -152,10 +152,10 @@ export function FormGroup(props: { onReset?: () => void; } & PropFunc diff --git a/pkg/interface/src/views/components/FormSubmit.tsx b/pkg/interface/src/views/components/FormSubmit.tsx index 22f3320f29..ad53f6b3f0 100644 --- a/pkg/interface/src/views/components/FormSubmit.tsx +++ b/pkg/interface/src/views/components/FormSubmit.tsx @@ -22,10 +22,10 @@ export function FormSubmit(props: FormSubmitProps): ReactElement { return ( {dirty && !isSubmitting && ( diff --git a/pkg/interface/src/views/components/GroupLink.tsx b/pkg/interface/src/views/components/GroupLink.tsx index e497cda3b9..7e86370b16 100644 --- a/pkg/interface/src/views/components/GroupLink.tsx +++ b/pkg/interface/src/views/components/GroupLink.tsx @@ -1,7 +1,7 @@ +import { Box, Col, Icon, Row, Text } from '@tlon/indigo-react'; +import { MetadataUpdatePreview } from '@urbit/api'; import React, { ReactElement, useEffect, useLayoutEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; -import { Box, Text, Row, Col, Icon } from '@tlon/indigo-react'; -import { Associations, Groups } from '@urbit/api'; import GlobalApi from '~/logic/api/global'; import { useModal } from '~/logic/lib/useModal'; import { useVirtual } from '~/logic/lib/virtualContext'; @@ -62,16 +62,16 @@ export function GroupLink( width="fit-content" flexShrink={1} alignItems="center" - py="2" - pr="2" + py={2} + pr={2} onClick={ joined ? () => history.push(`/~landscape/ship/${name}`) : showModal } opacity={preview ? '1' : '0.6'} > - + - + {preview ? preview.metadata.title : name} diff --git a/pkg/interface/src/views/components/GroupSearch.tsx b/pkg/interface/src/views/components/GroupSearch.tsx index 0675a73da4..eb4c77f744 100644 --- a/pkg/interface/src/views/components/GroupSearch.tsx +++ b/pkg/interface/src/views/components/GroupSearch.tsx @@ -1,10 +1,10 @@ import { - Box, + Box, - Col, + Col, - ErrorLabel, Icon, Label, - Row, Text + ErrorLabel, Icon, Label, + Row, Text } from '@tlon/indigo-react'; import { Association } from '@urbit/api/metadata'; import { FieldArray, useFormikContext } from 'formik'; @@ -132,12 +132,12 @@ export function GroupSearch>(props: Gr {caption && ( -