diff --git a/pkg/interface/package-lock.json b/pkg/interface/package-lock.json index d3d4de7740..f93f7f9e53 100644 --- a/pkg/interface/package-lock.json +++ b/pkg/interface/package-lock.json @@ -1551,6 +1551,15 @@ "integrity": "sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==", "dev": true }, + "@types/mdast": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.3.tgz", + "integrity": "sha512-SXPBMnFVQg1s00dlMCc/jCdvPqdE4mXaMMCeRlxLDmTAEoegHT53xKtkDnzDTOcmMHUfcjyf36/YYZ6SxRdnsw==", + "dev": true, + "requires": { + "@types/unist": "*" + } + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -10811,6 +10820,16 @@ "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==" }, + "ts-mdast": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ts-mdast/-/ts-mdast-1.0.0.tgz", + "integrity": "sha512-FmT5GbMU629/ty64741v7TdO8jm5xW09okr2VNExkLuRk5ngjKIDdn/woTB8lDtcgCMRS8lUNubImen0MkdF6g==", + "dev": true, + "requires": { + "@types/mdast": "^3.0.3", + "@types/unist": "^2.0.3" + } + }, "tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", @@ -11313,7 +11332,6 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, - "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -11380,7 +11398,6 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2" } diff --git a/pkg/interface/package.json b/pkg/interface/package.json index 8f2646c27f..5f7978e499 100644 --- a/pkg/interface/package.json +++ b/pkg/interface/package.json @@ -91,6 +91,7 @@ "react-hot-loader": "^4.13.0", "sass": "^1.32.5", "sass-loader": "^8.0.2", + "ts-mdast": "^1.0.0", "typescript": "^4.2.4", "webpack": "^4.46.0", "webpack-cli": "^3.3.12", diff --git a/pkg/interface/src/logic/lib/formGroup.ts b/pkg/interface/src/logic/lib/formGroup.ts index db679f2d3d..91a18532fe 100644 --- a/pkg/interface/src/logic/lib/formGroup.ts +++ b/pkg/interface/src/logic/lib/formGroup.ts @@ -6,13 +6,15 @@ interface IFormGroupContext { onDirty: (id: string, touched: boolean) => void; onErrors: (id: string, errors: boolean) => void; submitAll: () => Promise; + addReset: (id: string, r: any) => any; } const fallback: IFormGroupContext = { addSubmit: () => {}, onDirty: () => {}, onErrors: () => {}, - submitAll: () => Promise.resolve() + submitAll: () => Promise.resolve(), + addReset: () => {} }; export const FormGroupContext = React.createContext(fallback); diff --git a/pkg/interface/src/logic/lib/hark.ts b/pkg/interface/src/logic/lib/hark.ts index c99d00726e..a3f215668e 100644 --- a/pkg/interface/src/logic/lib/hark.ts +++ b/pkg/interface/src/logic/lib/hark.ts @@ -89,6 +89,7 @@ export function describeNotification(notification: IndexedNotification) { return `New comment${plural ? 's' : ''} on`; case 'note': return `New Note${plural ? 's' : ''} in`; + // @ts-ignore case 'edit-note': return `updated ${pluralize('note', plural)} in`; case 'mention': @@ -105,6 +106,7 @@ export function describeNotification(notification: IndexedNotification) { if('group' in notification.index) { return group(notification.index.group); } else if('graph' in notification.index) { + // @ts-ignore needs better type guard const contents = notification.notification?.contents?.graph ?? [] as Post[]; return graph(notification.index.graph, contents.length > 1, _.uniq(_.map(contents, 'author')).length === 1) diff --git a/pkg/interface/src/logic/lib/publish.ts b/pkg/interface/src/logic/lib/publish.ts index 22fd166cca..8fa32d5e09 100644 --- a/pkg/interface/src/logic/lib/publish.ts +++ b/pkg/interface/src/logic/lib/publish.ts @@ -76,7 +76,7 @@ export function editPost(rev: number, noteId: BigInteger, title: string, body: s return nodes; } -export function getLatestRevision(node: GraphNode): [number, string, string, Post] { +export function getLatestRevision(node: GraphNode): [number, string, any, Post] { const empty = [1, '', '', buntPost()] as [number, string, string, Post]; const revs = node.children?.get(bigInt(1)); if(!revs) { diff --git a/pkg/interface/src/logic/lib/useLocalStorageState.ts b/pkg/interface/src/logic/lib/useLocalStorageState.ts index 5e35a6a761..d64b9f6d09 100644 --- a/pkg/interface/src/logic/lib/useLocalStorageState.ts +++ b/pkg/interface/src/logic/lib/useLocalStorageState.ts @@ -17,7 +17,7 @@ interface SetStateFunc { } // See microsoft/typescript#37663 for filed bug type SetState = T extends any ? SetStateFunc : never; -export function useLocalStorageState(key: string, initial: T) { +export function useLocalStorageState(key: string, initial: T): any { const [state, _setState] = useState(() => retrieve(key, initial)); useEffect(() => { diff --git a/pkg/interface/src/logic/lib/util.tsx b/pkg/interface/src/logic/lib/util.tsx index 2b36048a8a..7ea44bca77 100644 --- a/pkg/interface/src/logic/lib/util.tsx +++ b/pkg/interface/src/logic/lib/util.tsx @@ -462,6 +462,7 @@ export const useHovering = (): useHoveringInterface => { export function withHovering(Component: React.ComponentType) { return React.forwardRef((props, ref) => { const { hovering, bind } = useHovering(); + // @ts-ignore needs type signature on return? return }) } diff --git a/pkg/interface/src/logic/reducers/graph-update.ts b/pkg/interface/src/logic/reducers/graph-update.ts index b049119131..3b15bc56fe 100644 --- a/pkg/interface/src/logic/reducers/graph-update.ts +++ b/pkg/interface/src/logic/reducers/graph-update.ts @@ -71,6 +71,7 @@ const addGraph = (json, state: GraphState): GraphState => { const data = _.get(json, 'add-graph', false); if (data) { if (!('graphs' in state)) { + // @ts-ignore investigate zustand types state.graphs = {}; } @@ -91,6 +92,7 @@ const removeGraph = (json, state: GraphState): GraphState => { const data = _.get(json, 'remove-graph', false); if (data) { if (!('graphs' in state)) { + // @ts-ignore investigate zustand types state.graphs = {}; } const resource = data.ship + '/' + data.name; @@ -248,7 +250,7 @@ const removePosts = (json, state: GraphState): GraphState => { } else { const child = graph.get(index[0]); if (child) { - return graph.set(index[0], produce((draft) => { + return graph.set(index[0], produce((draft: any) => { draft.children = _remove(draft.children, index.slice(1)); })); } diff --git a/pkg/interface/src/logic/reducers/hark-update.ts b/pkg/interface/src/logic/reducers/hark-update.ts index faa4a3c66a..3fca58261c 100644 --- a/pkg/interface/src/logic/reducers/hark-update.ts +++ b/pkg/interface/src/logic/reducers/hark-update.ts @@ -20,18 +20,26 @@ export const HarkReducer = (json: any) => { const graphHookData = _.get(json, 'hark-graph-hook-update', false); if (graphHookData) { reduceState(useHarkState, graphHookData, [ + // @ts-ignore investigate zustand types graphInitial, + // @ts-ignore investigate zustand types graphIgnore, + // @ts-ignore investigate zustand types graphListen, + // @ts-ignore investigate zustand types graphWatchSelf, + // @ts-ignore investigate zustand types graphMentions ]); } const groupHookData = _.get(json, 'hark-group-hook-update', false); if (groupHookData) { reduceState(useHarkState, groupHookData, [ + // @ts-ignore investigate zustand types groupInitial, + // @ts-ignore investigate zustand types groupListen, + // @ts-ignore investigate zustand types groupIgnore ]); } diff --git a/pkg/interface/src/logic/reducers/launch-update.ts b/pkg/interface/src/logic/reducers/launch-update.ts index 441a3b0a05..2046733434 100644 --- a/pkg/interface/src/logic/reducers/launch-update.ts +++ b/pkg/interface/src/logic/reducers/launch-update.ts @@ -20,6 +20,7 @@ export default class LaunchReducer { const weatherData: WeatherState | boolean | Record = _.get(json, 'weather', false); if (weatherData) { useLaunchState.getState().set((state) => { + // @ts-ignore investigate zustand types state.weather = weatherData; }); } @@ -27,6 +28,7 @@ export default class LaunchReducer { const locationData = _.get(json, 'location', false); if (locationData) { useLaunchState.getState().set((state) => { + // @ts-ignore investigate zustand types state.userLocation = locationData; }); } @@ -34,6 +36,7 @@ export default class LaunchReducer { const baseHash = _.get(json, 'baseHash', false); if (baseHash) { useLaunchState.getState().set((state) => { + // @ts-ignore investigate zustand types state.baseHash = baseHash; }); } @@ -41,6 +44,7 @@ export default class LaunchReducer { const runtimeLag = _.get(json, 'runtimeLag', null); if (runtimeLag !== null) { useLaunchState.getState().set(state => { + // @ts-ignore investigate zustand types state.runtimeLag = runtimeLag; }); } diff --git a/pkg/interface/src/logic/state/base.ts b/pkg/interface/src/logic/state/base.ts index 493eef7c76..a0a735e8af 100644 --- a/pkg/interface/src/logic/state/base.ts +++ b/pkg/interface/src/logic/state/base.ts @@ -83,17 +83,20 @@ export const createState = ( properties: T, blacklist: (keyof BaseState | keyof T)[] = [] ): UseStore> => create>(persist>((set, get) => ({ + // @ts-ignore investigate zustand types set: fn => stateSetter(fn, set), optSet: fn => { return optStateSetter(fn, set, get); }, patches: {}, addPatch: (id: string, ...patch: Patch[]) => { + // @ts-ignore investigate immer types set(({ patches }) => ({ patches: {...patches, [id]: patch }})); }, removePatch: (id: string) => { + // @ts-ignore investigate immer types set(({ patches }) => ({ patches: _.omit(patches, id)})); - }, + }, rollback: (id: string) => { set(state => { const applying = state.patches[id] diff --git a/pkg/interface/src/logic/state/contact.ts b/pkg/interface/src/logic/state/contact.ts index c28ccb996d..1f48833cfc 100644 --- a/pkg/interface/src/logic/state/contact.ts +++ b/pkg/interface/src/logic/state/contact.ts @@ -9,6 +9,7 @@ export interface ContactState extends BaseState { // fetchIsAllowed: (entity, name, ship, personal) => Promise; } +// @ts-ignore investigate zustand types const useContactState = createState('Contact', { contacts: {}, nackedContacts: new Set(), diff --git a/pkg/interface/src/logic/state/graph.ts b/pkg/interface/src/logic/state/graph.ts index 569efc2164..a4a04e2d92 100644 --- a/pkg/interface/src/logic/state/graph.ts +++ b/pkg/interface/src/logic/state/graph.ts @@ -22,7 +22,7 @@ export interface GraphState extends BaseState { // getGraphSubset: (ship: string, resource: string, start: string, end: string) => Promise; // getNode: (ship: string, resource: string, index: string) => Promise; } - +// @ts-ignore investigate zustand types const useGraphState = createState('Graph', { graphs: {}, graphKeys: new Set(), @@ -142,6 +142,4 @@ export function useGraphForAssoc(association: Association) { return useGraph(ship, name); } -window.useGraphState = useGraphState; - export default useGraphState; diff --git a/pkg/interface/src/logic/state/group.ts b/pkg/interface/src/logic/state/group.ts index bd6c478eb2..5f7324124c 100644 --- a/pkg/interface/src/logic/state/group.ts +++ b/pkg/interface/src/logic/state/group.ts @@ -9,6 +9,7 @@ export interface GroupState extends BaseState { pendingJoin: JoinRequests; } +// @ts-ignore investigate zustand types const useGroupState = createState('Group', { groups: {}, pendingJoin: {} diff --git a/pkg/interface/src/logic/state/invite.ts b/pkg/interface/src/logic/state/invite.ts index 0aab291b32..54bd3906b2 100644 --- a/pkg/interface/src/logic/state/invite.ts +++ b/pkg/interface/src/logic/state/invite.ts @@ -5,6 +5,7 @@ export interface InviteState extends BaseState { invites: Invites; } +// @ts-ignore investigate zustand types const useInviteState = createState('Invite', { invites: {} }); diff --git a/pkg/interface/src/logic/state/launch.ts b/pkg/interface/src/logic/state/launch.ts index adeb8a721a..4cefc57e2e 100644 --- a/pkg/interface/src/logic/state/launch.ts +++ b/pkg/interface/src/logic/state/launch.ts @@ -13,6 +13,7 @@ export interface LaunchState extends BaseState { runtimeLag: boolean; }; +// @ts-ignore investigate zustand types const useLaunchState = createState('Launch', { firstTime: true, tileOrdering: [], diff --git a/pkg/interface/src/logic/state/local.tsx b/pkg/interface/src/logic/state/local.tsx index 5d6b883719..fe9becd8c7 100644 --- a/pkg/interface/src/logic/state/local.tsx +++ b/pkg/interface/src/logic/state/local.tsx @@ -82,6 +82,7 @@ const useLocalState = create(persist((set, get) => ({ state.suspendedFocus.blur(); } })), + // @ts-ignore investigate zustand types set: fn => set(produce(fn)) }), { blacklist: [ @@ -98,6 +99,7 @@ function withLocalState ({ ...object, [key]: state[key] }), {} ) ): useLocalState(); + // @ts-ignore call signature forwarding unclear return ; }); } diff --git a/pkg/interface/src/logic/state/metadata.ts b/pkg/interface/src/logic/state/metadata.ts index 38a4a627ee..4983d6d580 100644 --- a/pkg/interface/src/logic/state/metadata.ts +++ b/pkg/interface/src/logic/state/metadata.ts @@ -22,7 +22,7 @@ export function useGraphsForGroup(group: string) { const graphs = useMetadataState(s => s.associations.graph); return _.pickBy(graphs, (a: Association) => a.group === group); } - +// @ts-ignore investigate zustand types const useMetadataState = createState('Metadata', { associations: { groups: {}, graph: {}, contacts: {}, chat: {}, link: {}, publish: {} } // preview: async (group): Promise => { diff --git a/pkg/interface/src/logic/state/settings.ts b/pkg/interface/src/logic/state/settings.ts index 4f1c441125..a1026e3919 100644 --- a/pkg/interface/src/logic/state/settings.ts +++ b/pkg/interface/src/logic/state/settings.ts @@ -45,6 +45,7 @@ export const selectCalmState = (s: SettingsState) => s.calm; export const selectDisplayState = (s: SettingsState) => s.display; +// @ts-ignore investigate zustand types const useSettingsState = createState('Settings', { display: { backgroundType: 'none', diff --git a/pkg/interface/src/logic/state/storage.ts b/pkg/interface/src/logic/state/storage.ts index d803ade400..7ad79ceeea 100644 --- a/pkg/interface/src/logic/state/storage.ts +++ b/pkg/interface/src/logic/state/storage.ts @@ -19,6 +19,7 @@ export interface StorageState extends BaseState { } } +// @ts-ignore investigate zustand types const useStorageState = createState('Storage', { gcp: {}, s3: { diff --git a/pkg/interface/src/views/apps/chat/components/ChatInput.tsx b/pkg/interface/src/views/apps/chat/components/ChatInput.tsx index 5d0524ed43..62422a0167 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatInput.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatInput.tsx @@ -226,7 +226,9 @@ export class ChatInput extends Component { } } +// @ts-ignore withLocalState prop passing weirdness export default withLocalState, 'hideAvatars', ChatInput>( + // @ts-ignore withLocalState prop passing weirdness withStorage(ChatInput, { accept: 'image/*' }), ['hideAvatars'] ); diff --git a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx index 6bee90d048..d965fd369f 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatMessage.tsx @@ -251,8 +251,7 @@ function ChatMessage(props: ChatMessageProps) { let onDelete = props?.onDelete ?? (() => {}); const transcluded = props?.transcluded ?? 0; const renderSigil = props.renderSigil ?? (Boolean(nextMsg && msg.author !== nextMsg.author) || - !nextMsg || - msg.number === 1 + !nextMsg ); const ourMention = msg?.contents?.some((e: MentionContent) => { diff --git a/pkg/interface/src/views/apps/chat/components/ChatPane.tsx b/pkg/interface/src/views/apps/chat/components/ChatPane.tsx index dd6ebf46fb..6218cd7129 100644 --- a/pkg/interface/src/views/apps/chat/components/ChatPane.tsx +++ b/pkg/interface/src/views/apps/chat/components/ChatPane.tsx @@ -136,6 +136,7 @@ export function ChatPane(props: ChatPaneProps): ReactElement { } return ( + // @ts-ignore [0]) { unreads={unreadCount} path={group?.group} title={group.metadata.title} - picture={group.metadata.picture} /> ); })} @@ -96,7 +95,7 @@ function Group(props: GroupProps) { .diff(moment())) .as('days'))) || 0; return ( - + {title} {!hideUnreads && ( diff --git a/pkg/interface/src/views/apps/launch/components/tiles.tsx b/pkg/interface/src/views/apps/launch/components/tiles.tsx index 377e0d2674..c788b03aab 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles.tsx +++ b/pkg/interface/src/views/apps/launch/components/tiles.tsx @@ -35,6 +35,7 @@ const Tiles = (props: TileProps): ReactElement => { return ( ); diff --git a/pkg/interface/src/views/apps/launch/components/tiles/weather.tsx b/pkg/interface/src/views/apps/launch/components/tiles/weather.tsx index 9fa4f59329..ce049c1502 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles/weather.tsx +++ b/pkg/interface/src/views/apps/launch/components/tiles/weather.tsx @@ -135,7 +135,7 @@ class WeatherTile extends React.Component { {locationName ? ` Current location is near ${locationName}.` : ''} {error} - + state.groups); @@ -62,13 +63,14 @@ export function LinkResource(props: LinkResourceProps) { path={relativePath('')} render={(props) => { return ( + // @ts-ignore diff --git a/pkg/interface/src/views/apps/links/LinkWindow.tsx b/pkg/interface/src/views/apps/links/LinkWindow.tsx index 05a13e5c75..7bd564462e 100644 --- a/pkg/interface/src/views/apps/links/LinkWindow.tsx +++ b/pkg/interface/src/views/apps/links/LinkWindow.tsx @@ -21,6 +21,7 @@ interface LinkWindowProps { path: string; api: GlobalApi; pendingSize: number; + mb?: number; } const style = { @@ -48,6 +49,7 @@ class LinkWindow extends Component { const { props } = this; const { association, graph, api } = props; const [, , ship, name] = association.resource.split('/'); + // @ts-ignore Uint8Array vs. BigInt mismatch? const node = graph.get(index); const first = graph.peekLargest()?.[0]; const post = node?.post; @@ -58,6 +60,7 @@ class LinkWindow extends Component { ...props, node }; + {/* @ts-ignore calling @liam-fitzgerald on Uint8Array props */} if (this.canWrite() && index.eq(first ?? bigInt.zero)) { return ( @@ -125,6 +128,7 @@ class LinkWindow extends Component { return ( + {/* @ts-ignore calling @liam-fitzgerald on virtualscroller */} ): ReactElement => { const { @@ -49,6 +51,7 @@ export const LinkItem = React.forwardRef((props: LinkItemProps, ref: RefObject { console.log(remoteRef.current); if(document.activeElement instanceof HTMLIFrameElement + // @ts-ignore forwardref prop passing && remoteRef?.current?.containerRef?.contains(document.activeElement)) { markRead(); } @@ -100,6 +103,7 @@ export const LinkItem = React.forwardRef((props: LinkItemProps, ref: RefObject state.unreads); const commColor = (unreads.graph?.[appPath]?.[`/${index}`]?.unreads ?? 0) > 0 ? 'blue' : 'gray'; + // @ts-ignore hark will have to choose between sets and numbers const isUnread = unreads.graph?.[appPath]?.['/']?.unreads?.has(node.post.index); return ( @@ -135,8 +139,10 @@ export const LinkItem = React.forwardRef((props: LinkItemProps, ref: RefObject { + // @ts-ignore RemoteContent weirdness remoteRef.current = r; }} + // @ts-ignore RemoteContent weirdness renderUrl={false} url={href} text={contents[0].text} diff --git a/pkg/interface/src/views/apps/links/components/LinkSubmit.tsx b/pkg/interface/src/views/apps/links/components/LinkSubmit.tsx index b5c7b415bc..43e684817f 100644 --- a/pkg/interface/src/views/apps/links/components/LinkSubmit.tsx +++ b/pkg/interface/src/views/apps/links/components/LinkSubmit.tsx @@ -12,6 +12,7 @@ interface LinkSubmitProps { api: GlobalApi; name: string; ship: string; + parentIndex?: any; } const LinkSubmit = (props: LinkSubmitProps) => { @@ -157,6 +158,7 @@ const LinkSubmit = (props: LinkSubmitProps) => { return ( <> + {/* @ts-ignore archaic event type mismatch */} { onBlur={() => [setUrlFocused(false), setSubmitFocused(false)]} onFocus={() => [setUrlFocused(true), setSubmitFocused(true)]} spellCheck="false" + // @ts-ignore archaic event type mismatch error onPaste={onPaste} onKeyPress={onKeyPress} value={linkValue} diff --git a/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx b/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx index 010675ebbc..ddfcaae8f1 100644 --- a/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx +++ b/pkg/interface/src/views/apps/permalinks/TranscludedNode.tsx @@ -49,7 +49,7 @@ function TranscludedLinkNode(props: { @@ -197,6 +189,7 @@ export function PermalinkEmbed(props: { transcluded: number; showOurContact?: boolean; full?: boolean; + pending?: any; }) { const permalink = parsePermalink(props.link); diff --git a/pkg/interface/src/views/apps/profile/components/SetStatus.tsx b/pkg/interface/src/views/apps/profile/components/SetStatus.tsx index 11541c077c..af66a6395b 100644 --- a/pkg/interface/src/views/apps/profile/components/SetStatus.tsx +++ b/pkg/interface/src/views/apps/profile/components/SetStatus.tsx @@ -39,7 +39,7 @@ export function SetStatus(props: any) { ref={inputRef} onChange={onStatusChange} value={_status} - autocomplete='off' + autoComplete='off' width='75%' mr={2} onKeyPress={(evt) => { diff --git a/pkg/interface/src/views/apps/publish/PublishResource.tsx b/pkg/interface/src/views/apps/publish/PublishResource.tsx index ea5dc102f4..2b455aa2b8 100644 --- a/pkg/interface/src/views/apps/publish/PublishResource.tsx +++ b/pkg/interface/src/views/apps/publish/PublishResource.tsx @@ -10,10 +10,13 @@ type PublishResourceProps = StoreState & { association: Association; api: GlobalApi; baseUrl: string; + history?: any; + match?: any; + location?: any; }; export function PublishResource(props: PublishResourceProps) { - const { association, api, baseUrl, notebooks } = props; + const { association, api, baseUrl } = props; const rid = association.resource; const [, , ship, book] = rid.split('/'); const location = useLocation(); diff --git a/pkg/interface/src/views/apps/publish/components/NotePreview.tsx b/pkg/interface/src/views/apps/publish/components/NotePreview.tsx index ca8c201681..3f9ecc0954 100644 --- a/pkg/interface/src/views/apps/publish/components/NotePreview.tsx +++ b/pkg/interface/src/views/apps/publish/components/NotePreview.tsx @@ -69,6 +69,7 @@ export function NotePreview(props: NotePreviewProps) { const [rev, title, body, content] = getLatestRevision(node); const appPath = `/ship/${props.host}/${props.book}`; const unreads = useHarkState(state => state.unreads); + // @ts-ignore hark will have to choose between sets and numbers const isUnread = unreads.graph?.[appPath]?.['/']?.unreads?.has(`/${noteId}/1/1`); const snippet = getSnippet(body); diff --git a/pkg/interface/src/views/apps/publish/components/Notebook.tsx b/pkg/interface/src/views/apps/publish/components/Notebook.tsx index 00b4401b66..ac18958d65 100644 --- a/pkg/interface/src/views/apps/publish/components/Notebook.tsx +++ b/pkg/interface/src/views/apps/publish/components/Notebook.tsx @@ -1,5 +1,5 @@ import { Box, Col, Row, Text } from '@tlon/indigo-react'; -import { Association, Graph, Unreads } from '@urbit/api'; +import { Association, Graph } from '@urbit/api'; import React, { ReactElement } from 'react'; import { RouteComponentProps } from 'react-router-dom'; import { useShowNickname } from '~/logic/lib/util'; @@ -14,7 +14,6 @@ interface NotebookProps { association: Association; baseUrl: string; rootUrl: string; - unreads: Unreads; } export function Notebook(props: NotebookProps & RouteComponentProps): ReactElement | null { diff --git a/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx b/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx index 352966c5e6..36d196be0c 100644 --- a/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx +++ b/pkg/interface/src/views/apps/publish/components/NotebookPosts.tsx @@ -15,7 +15,6 @@ interface NotebookPostsProps { } export function NotebookPosts(props: NotebookPostsProps) { - const contacts = useContactState(state => state.contacts); return ( {Array.from(props.graph || []).map( @@ -25,7 +24,6 @@ export function NotebookPosts(props: NotebookPostsProps) { key={date.toString()} host={props.host} book={props.book} - contact={contacts[`~${node.post.author}`]} node={node} baseUrl={props.baseUrl} group={props.group} 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 e6b6171721..d15edaa0fa 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/Debug.tsx @@ -57,7 +57,9 @@ const StoreDebugger = (props: StoreDebuggerProps) => { placeholder="Drill Down" width="100%" onKeyUp={(event) => { + // @ts-ignore clearly value is in eventtarget if (event.target.value) { + // @ts-ignore clearly value is in eventtarget tryFilter(event.target.value); } else { setFilter(''); 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 64a0b049c1..a6c3745e5d 100644 --- a/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx +++ b/pkg/interface/src/views/apps/settings/components/lib/DisplayForm.tsx @@ -98,7 +98,9 @@ export default function DisplayForm(props: DisplayFormProps) { Customize visual interfaces across your Landscape - diff --git a/pkg/interface/src/views/apps/term/app.tsx b/pkg/interface/src/views/apps/term/app.tsx index cd0ba942f1..edd546fdbf 100644 --- a/pkg/interface/src/views/apps/term/app.tsx +++ b/pkg/interface/src/views/apps/term/app.tsx @@ -78,6 +78,7 @@ class TermApp extends Component { border={['0','1']} cursor='text' > + {/* @ts-ignore declare props in later pass */} + {/* @ts-ignore declare props in later pass */} {this.props.log.map((line, i) => { + // @ts-ignore react memo not passing props return ; })} diff --git a/pkg/interface/src/views/apps/term/components/input.tsx b/pkg/interface/src/views/apps/term/components/input.tsx index b2f9dc26ef..8a8ebc1eb7 100644 --- a/pkg/interface/src/views/apps/term/components/input.tsx +++ b/pkg/interface/src/views/apps/term/components/input.tsx @@ -15,10 +15,11 @@ export class Input extends Component { componentDidUpdate() { if ( - !document.activeElement == document.body - || document.activeElement == this.inputRef.current + document.activeElement == this.inputRef.current ) { + // @ts-ignore ref type issues this.inputRef.current.focus(); + // @ts-ignore ref type issues this.inputRef.current.setSelectionRange(this.props.cursor, this.props.cursor); } } @@ -26,7 +27,7 @@ export class Input extends Component { keyPress(e) { const key = e.key; // let paste and leap events pass - if ((e.getModifierState('Control') || event.getModifierState('Meta')) + if ((e.getModifierState('Control') || e.getModifierState('Meta')) && (e.key === 'v' || e.key === '/')) { return; } @@ -115,6 +116,7 @@ belt = { met: 'bac' }; onKeyDown={this.keyPress} onClick={this.click} onPaste={this.paste} + // @ts-ignore indigo-react doesn't let us pass refs ref={this.inputRef} defaultValue="connecting..." value={prompt} diff --git a/pkg/interface/src/views/apps/term/components/line.tsx b/pkg/interface/src/views/apps/term/components/line.tsx index 3852984f8e..5f8f5c1314 100644 --- a/pkg/interface/src/views/apps/term/components/line.tsx +++ b/pkg/interface/src/views/apps/term/components/line.tsx @@ -1,6 +1,6 @@ import { Text } from '@tlon/indigo-react'; import React from 'react'; - +// @ts-ignore line isn't in props? export default React.memo(({ line }) => { // line body to jsx // NOTE lines are lists of characters that might span multiple codepoints diff --git a/pkg/interface/src/views/components/CommentItem.tsx b/pkg/interface/src/views/components/CommentItem.tsx index de8ebd88ab..2b751a81dc 100644 --- a/pkg/interface/src/views/components/CommentItem.tsx +++ b/pkg/interface/src/views/components/CommentItem.tsx @@ -46,7 +46,7 @@ export function CommentItem(props: CommentItemProps) { const children = Array.from(revs.children); const indices = []; for (const child in children) { - const node = children[child]; + const node = children[child] as any; if (!node?.post || typeof node.post !== 'string') { indices.push(node.post?.index); } diff --git a/pkg/interface/src/views/components/DropdownSearch.tsx b/pkg/interface/src/views/components/DropdownSearch.tsx index 9141b41d24..e2ba2dd2e2 100644 --- a/pkg/interface/src/views/components/DropdownSearch.tsx +++ b/pkg/interface/src/views/components/DropdownSearch.tsx @@ -129,6 +129,7 @@ export function DropdownSearch(props: DropdownSearchProps): ReactElement { return ( + { /* @ts-ignore investigate onblur on styled-system component later */} >(props: Gr return Object.values( Object.keys(associations.groups) .filter( - e => groupState?.[e]?.policy?.open + e => (groupState?.[e]?.policy as OpenPolicy)?.open ) .reduce((obj, key) => { obj[key] = associations.groups[key]; diff --git a/pkg/interface/src/views/components/ImageInput.tsx b/pkg/interface/src/views/components/ImageInput.tsx index 71e27a0def..417258a815 100644 --- a/pkg/interface/src/views/components/ImageInput.tsx +++ b/pkg/interface/src/views/components/ImageInput.tsx @@ -13,7 +13,7 @@ import useStorage from '~/logic/lib/useStorage'; type ImageInputProps = Parameters[0] & { id: string; - label: string; + label?: string; placeholder?: string; }; diff --git a/pkg/interface/src/views/components/Invite/Group.tsx b/pkg/interface/src/views/components/Invite/Group.tsx index e5c6f08f42..642774bf55 100644 --- a/pkg/interface/src/views/components/Invite/Group.tsx +++ b/pkg/interface/src/views/components/Invite/Group.tsx @@ -10,7 +10,7 @@ import { Metadata, MetadataUpdatePreview, resourceFromPath } from '@urbit/api'; -import { GraphConfig } from '@urbit/api/dist'; +import { GraphConfig } from '@urbit/api'; import _ from 'lodash'; import React, { ReactElement, ReactNode, useCallback } from 'react'; import { useHistory } from 'react-router-dom'; @@ -217,6 +217,7 @@ function InviteActions(props: { const hideJoin = useCallback(async (e) => { if(status?.progress === 'done') { set(s => { + // @ts-ignore investigate zustand types delete s.pendingJoin[resource] }); e.stopPropagation(); @@ -245,14 +246,14 @@ function InviteActions(props: { color="blue" height={4} backgroundColor="white" - onClick={inviteAccept} + onClick={inviteAccept as any} > Accept Decline diff --git a/pkg/interface/src/views/components/ProfileOverlay.tsx b/pkg/interface/src/views/components/ProfileOverlay.tsx index 266242b7b2..aad2b92d0f 100644 --- a/pkg/interface/src/views/components/ProfileOverlay.tsx +++ b/pkg/interface/src/views/components/ProfileOverlay.tsx @@ -218,7 +218,7 @@ const ProfileOverlay = (props: ProfileOverlayProps) => { textOverflow='ellipsis' overflow='hidden' whiteSpace='pre' - marginBottom={0} + mb={0} disableRemoteContent gray title={contact?.status ? contact.status : ''} diff --git a/pkg/interface/src/views/components/ProfileStatus.tsx b/pkg/interface/src/views/components/ProfileStatus.tsx index e38e2ddc2e..ef35a3288a 100644 --- a/pkg/interface/src/views/components/ProfileStatus.tsx +++ b/pkg/interface/src/views/components/ProfileStatus.tsx @@ -41,7 +41,7 @@ export const ProfileStatus = (props) => { { diff --git a/pkg/interface/src/views/components/ReconnectButton.tsx b/pkg/interface/src/views/components/ReconnectButton.tsx index 725506ce46..5921780b47 100644 --- a/pkg/interface/src/views/components/ReconnectButton.tsx +++ b/pkg/interface/src/views/components/ReconnectButton.tsx @@ -8,15 +8,15 @@ const ReconnectButton = ({ connection, subscription }) => { if (connectedStatus === 'disconnected') { return ( ); } else if (connectedStatus === 'reconnecting') { return ( ); } else { diff --git a/pkg/interface/src/views/components/RichText.tsx b/pkg/interface/src/views/components/RichText.tsx index 3134464ac8..575f73ce03 100644 --- a/pkg/interface/src/views/components/RichText.tsx +++ b/pkg/interface/src/views/components/RichText.tsx @@ -24,7 +24,7 @@ const DISABLED_BLOCK_TOKENS = [ const DISABLED_INLINE_TOKENS = []; type RichTextProps = ReactMarkdownProps & { - api: GlobalApi; + api?: GlobalApi; disableRemoteContent?: boolean; contact?: Contact; group?: Group; @@ -34,6 +34,20 @@ type RichTextProps = ReactMarkdownProps & { color?: string; children?: any; width?: string; + display?: string[] | string; + mono?: boolean; + mb?: number; + minWidth?: number | string; + maxWidth?: number | string; + flexShrink?: number; + textOverflow?: string; + overflow?: string; + whiteSpace?: string; + gray?: boolean; + title?: string; + py?: number; + overflowX?: any; + verticalAlign?: any; } const RichText = React.memo(({ disableRemoteContent = false, api, ...props }: RichTextProps) => ( @@ -48,6 +62,7 @@ const RichText = React.memo(({ disableRemoteContent = false, api, ...props }: Ri oembedShown: false } : null; if (!disableRemoteContent) { + // @ts-ignore RemoteContent weirdness return ; } @@ -59,16 +74,16 @@ const RichText = React.memo(({ disableRemoteContent = false, api, ...props }: Ri borderBottom='1px solid' remoteContentPolicy={remoteContentPolicy} onClick={(e) => { - e.stopPropagation(); -}} + e.stopPropagation(); + }} {...linkProps} >{linkProps.children} ); }, - linkReference: (linkProps) => { + linkReference: (linkProps): any => { const linkText = String(linkProps.children[0].props.children); if (isValidPatp(linkText)) { - return ; + return ; } else if(linkText.startsWith('web+urbitgraph://')) { return ( {text} diff --git a/pkg/interface/src/views/components/StatusBar.tsx b/pkg/interface/src/views/components/StatusBar.tsx index f7cbc058e0..ac38a202c1 100644 --- a/pkg/interface/src/views/components/StatusBar.tsx +++ b/pkg/interface/src/views/components/StatusBar.tsx @@ -73,7 +73,7 @@ const StatusBar = (props) => { px={3} pb={3} > - +